Guys, I\'m stuck, banging my head off the desk for the past few hours.
I am trying to consume a service, and I have 8 other functions that I call that are almost IDE
I had this issue in PhpStorm when doing unit tests. I disabled the wsdl cache and it worked:
ini_set("soap.wsdl_cache_enabled", "0");
I had the same problem and I resolved using this syntax for __soapCall
:
...
$params = new SoapParam($data, 'parameters');
$response = $this->__soapCall('methodName',
array(new SoapVar($data, XSD_ANYTYPE, 'parameters'))
);
...
Instead of
__soapCall('methodName', array($params)
There's also a kind of bug in PHP where a wrong type leaves no room for giving a proper SOAPfault back to the client.
http://bugs.php.net/bug.php?id=50547
Similar to @bezz, my issue was also caused by the WSDL being cached in a temp directory.
I cleared out the wsdl-* files in /tmp and it worked.
It looks like you have a type mismatch somewhere, either while assembling your request (one of the parameters is not of type string), or the server returns something other than an int (violating the WSDL response definition and thus causing the client to consider the response invalid, as it expects something else).
Some additional observations/questions:
$client->__soapCall("CanLoadProduct", $params)
instead of $client->CanLoadProduct($username, $password, etc.)
? (The first version is a lower level variation which is intended to be used for non_WSDL scenarios. The second version might give you a more detailed error/exception)I had the same problem when trying to pass XML as a parameter to one of my webservices. Wrapping the XML data in <![CDATA[ ... ]]>
got rid of the SOAP-ERROR: Encoding: Violation of encoding rules and everything worked fine.
Other details:
1. The parameter was defined as xsd:string as well.
2. WSDL was document/literal.
3. Using built in SOAP class with php 5.2.10.