0

Hello im trying to get a hello world program to work from c# to wcf and then call it with php
now have gone as far as i can get.

You have created a service.

To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:

svcutil.exe http://localhost:8731/phpwcf/?wsdl
This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:

C#

class Test
{
    static void Main()
    {
        Service1Client client = new Service1Client();

        // Use the 'client' variable to call operations on the service.

        // Always close the client.
        client.Close();
    }
}

So i guess that means the problem does not lie with the c# but the php part
my php code looks like this

<?php
    $client = new SoapClient("http://localhost:8731/phpwcf/?wsdl");
    $args = array('text' => 'Hello World');
    $response = $Client->ENtoJP($args);
    echo $response->ENtoJPResult;
?>

and <add baseAddress = "http://localhost:8731/phpwcf/" />

is correct and i have included my method like so

[OperationContract]
string ENtoJP(string text);

method looks like this

public string ENtoJP(string text)
        {
            if (text.Equals("Hello World", StringComparison.CurrentCultureIgnoreCase))
            {
                return "Ohayou Sekai";
            }
            else
            {
                return "Could not translate.";
            }
        }

should'nt be any problems (but what do i know) xD

My php version is 5.4.3 and as i understood you need 5 or higher and i have uncommented the
extension=php_soap.dll
so my question is why do i still get error? :O whats wrong?!

i get the errors

Notice: Undefined variable: Client in C:\wamp\www\test\test.php on line 13
Fatal error: Call to a member function ENtoJP() on a non-object in C:\wamp\www\test\test.php on line 13

Thank you for answers :)

2
Contributors
3
Replies
5
Views
4 Years
Discussion Span
Last Post by adam.adamski.96155
0

Adam.Adamski.96155
What? should it look like

<?php

    $client:$client = new SoapClient("http://localhost:8731/phpwcf/?wsdl");


    $args = array('text' => 'Hello World');
    $Client:$response = $Client->ENtoJP($args);

    echo $response->ENtoJPResult;

?>

wont work either :P or what do you mean

EDIT : ok i see now .... wow so many things it can be and its a stupic case letter xD embarrassing
well thank you so much adam :)

Edited by Dendei

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.