1

I've made ASP.NET web service, which contains one initial method called HelloWorld. I want to access to mentioned method using php and following code:

$client = new SoapClient("http://localhost:4925/Service1.asmx?WSDL");

$result = $client->HelloWorld()->TestMethodResult;
echo $result;

When I run php script, i get following error:

***Notice: Undefined property: stdClass::$TestMethodResult in C:\wamp\www\probe\servis.php on line 8***

Can someone please help?

7
  • 1
    Is TestMethodResult correct? Commented Sep 7, 2012 at 15:24
  • Yes, send the code for TestMethodResult Commented Sep 7, 2012 at 15:24
  • I used following post as star guide, but stopped with given problem: stackoverflow.com/questions/9711502/… Commented Sep 7, 2012 at 15:25
  • 1
    what does __getFunctions return? Commented Sep 7, 2012 at 15:26
  • Do you really need to use SOAP? Could you use JSON or REST instead? SOAP is horribly bloated and slow; if you can use something quicker, I'd strongly recommend it. (and if you're writing both ends of the service, there's no reason why not) Commented Sep 7, 2012 at 15:30

1 Answer 1

2

Since HelloWorld is the method you are trying to call, try:

$result = $client->__soapCall('HelloWord', $params);

or

$result = $client->HelloWorld($params);

Where $params are any parameters you need to send for the method.

Sign up to request clarification or add additional context in comments.

3 Comments

Can you provide results of $client->__getFunctions()?
This works: $params = array('bla'=>'opala'); $response = $client->HelloWorld($params); var_dump($response); echo "$response->HelloWorldResult";
@Mr.M Ahh... so HelloWorld is the actual method not TestMethodResult. I guess I don't know where. I have updated the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.