0

I have a working Curl to consume a web service with xml, but at the moment I am also required to create something with Nusoap to invoke a web service with xml(serve as a backup). And this is where the problem starts:

At the moment, I have this:

function execute_nusoap($xml,$url)
{
    require_once 'nusoap/nusoap.php';

    $client = new nusoap_client($url,false);

    $msg = $client->serializeEnvelope($xml);

    $result = $client->send($msg ,$url);

    return $result;
}

I am having an error in nusoap.php line 7677:

<p>Severity: Notice</p>
<p>Message:  Undefined property: nusoap_client::$operation</p>
<p>Filename: nusoap/nusoap.php</p>
<p>Line Number: 7678</p>

which is this line:

$parser = new nusoap_parser(
    $data, $this->xml_encoding, $this->operation, $this->decode_utf8
);

So, I tried editing it to

$parser = new nusoap_parser(
    $data, $this->xml_encoding, $this->decode_utf8
);

And now I am getting this reponse instead from the webservice I am trying to invoke:

var_dump($result);

array(1) 
{
  ["Result"]=>
  string(0) ""
}

Which is not listed in any of the possible web service response list.

I have been reading this tutorial:

  1. http://itworkarounds.blogspot.com/2011/07/send-raw-xml-with-php-nusoap.html
Cœur
  • 37,241
  • 25
  • 195
  • 267
rfpdl
  • 956
  • 1
  • 11
  • 35
  • The error message looks correct to me. What is your concrete programming question? Only seeing a warning does not qualify as a question. – hakre Oct 30 '13 at 07:09
  • possible duplicate of [Reference - What does this error mean in PHP?](http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) – hakre Oct 30 '13 at 07:11
  • And just a general advice: Undefined properties will remain undefined until they are defined. For the `nusoap_parser::__construct` make each parameter a variable of it's own and then re-think where to obtain that parameter from. E.g. if operation is undefined, specify the operation manually. Works easy with a variable of your own. – hakre Oct 30 '13 at 07:13
  • @hakre: Based on the tutorial I have been following, the writer did not have to edit the nusoap.php file at line 7677 due to the 'operation error' and getting result. meanwhile I have to comment that part out and when running the code, it returns empty result/no result. Wonder what is wrong with it, if I use CURL it works, but with nusoap it does not. – rfpdl Nov 01 '13 at 05:59
  • Okay, that sounds like the HTTP transport Nusoap is using is not activated. Look which one it is (probably PHP HTTP streams), check your PHP configuration that it is activated. – hakre Nov 02 '13 at 06:29

0 Answers0