note 79642 deleted from ref.soap by cmb
| From: | cmb@php.net | Date: | Sun, 24 Nov 2019 08:29:22 +0000 |
| Subject: | note 79642 deleted from ref.soap by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213174@lists.php.net to get a copy of this message | ||
Note Submitter: Emanuele Colonnelli
----
Hi,
I'd like to add this trick to get SoapClient correctly running with a WSDD-generated Axis 1
webservice.
By default, Apache Axis 1 generates a SOAP RPC/Encoded WSDL with "urn:" prefixes before
all <SERVICE_NAME> occurrences.
Axis 1 WSDL also uses an "impl:" namespace prefix.
Suppose your service's name is "myWS", your WSDL will contains a
"<wsdl:binding>" element with the name attribute valued
"urn:myWSSoapBinding":
<wsdl:binding name="myWSSoapBinding">
PHP SoapClient has a problem (I hope it will be fixed soon ) parsing this WSDL and generates this
error:
SOAP-ERROR: Parsing WSDL: No element with name 'myWSSoapBinding'
This error arise because PHP SoapClient could not resolve the "urn:impl:myWSSoapBinding"
QName in generated WSDL:
<wsdl:service name="myWSService">
<wsdl:port binding="impl:urn:myWSSoapBinding" name="urn:myWS">
<wsdlsoap:address location="http://URL/services/urn:myWS"/>
</wsdl:port>
</wsdl:service>
To solve this problem I parse WSDL applying a preg_replace to delete all "urn:"
occurrences.
Then I save this generated WSDL somewhere in my site and point my SoapClient to this location.
I also need to specify additional parameters to SoapClient constructor:
<?php
$soap = new SoapClient("wsdl/myWS.wsdl",
array(
"style" => SOAP_RPC,
"use" => SOAP_ENCODED,
"soap_version" => SOAP_1_1,
"uri"=>"urn:myWS"
));
?>
I suggest you this resources to a full understanding of this kind of problems:
http://www.ibm.com/developerworks/
webservices/library/ws-whichwsdl/
http://wso2.org/wiki/display/wsfphp/
PHP+SOAP+Extension+API+-+Backward+Compatibility
I hope this save you hours of imprecations! :)
Emanuele Colonnelli