Re: PHP5 SoapClient and Apache Axis interop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We had similar problems with gSOAP and PHP5 SOAP, IF using SOAP1.2. With SOAP1.1 it worked fine. Difference was that namespace among and few small differences. Strangest thing was that the array complex type we were passing was intepreted by PHP SOAP Client as empty if using 1.2, but with 1.1 the result set was just fine.

Yes we tried pretty much everything, set PHP SOAP versions, and even hacking the gSOAP to return a bit different xml with some optional attributes.


Mark Slater wrote:
I am cross-posting this message because it contains information I believe will be useful to both PHP Soap users and Apache Axis users. I apologize for any inconvenience this may cause to those who read both forums.

First, I'd like to thank those who shared their experiences and gave their assistance... knowing that things were supposed to work is always a good motivator.

After I was able to get other Axis hosted web services to work with PHP 5.0.3's SoapClient class, including the example solution I was basing my code off of (SpringFramework's jpetstore), I started looking at differences between them. The only difference I found was Axis itself. Axis 1.2RC3 seems to react differently (throwing a fit you might say) than Axis 1.1. Obviously 1.1 has been around longer, but now that 1.2 is almost out, I'm hoping PHP's SoapClient will find a way to be compatible.

For the sake of any developers who might read this, here's the difference in the WSDL generated by Axis 1.1 and Axis 1.2RC3. The former works, the latter doesn't. All functions here are dummy in the sense that they don't rely on any external code. The addNumbers method will return the sum of the two parameters, changePassword ignores parameters and returns true, and confirmCredentials returns true if the username is asdf, and false otherwise. None of them work and all cause Axis 1.2RC3 to fail with:

2005-04-10 21:15:45,756 ERROR [StandardWrapper[/whisper-server:axis]] - <Servlet.service() for servlet axis threw exception>
java.lang.IncompatibleClassChangeError
at org.apache.axis.message.MessageElement.addTextNode(MessageElement.java: 1387)
at org.apache.axis.message.SOAPHandler.addTextNode(SOAPHandler.java:148)
at org.apache.axis.message.SOAPHandler.endElement(SOAPHandler.java:112)
at org.apache.axis.encoding.DeserializationContext.endElement(Deserializati onContext.java:1087)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
....
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationCon text.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
at org.apache.axis.server.AxisServer.initSOAPConstants(AxisServer.java: 345)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:279)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.j ava:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:237)
....
at java.lang.Thread.run(Thread.java:552)


I'm new at this, but I did notice that Axis 1.1 uses the xmlns:xsd="http://www.w3.org/2001/XMLSchema"; namespace for parameter encoding, while Axis 1.2 RC3 uses xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";. The other thing I noticed is that SoapClient's __getFunctions() method returned different values:

Axis 1.1 generated WSDL -
array(3) { [0]=> string(37) "int addNumbers(int $left, int $right)" [1]=> string(62) "boolean confirmCredentials(string $username, string $password)" [2]=> string(79) "boolean changePassword(string $username, string $password, string $newPassword)" }


Axis 1.2RC3 generated WSDL -

array(3) { [0]=> string(37) "int addNumbers(int $left, int $right)" [1]=> string(64) "boolean confirmCredentials(UNKNOWN $username, UNKNOWN $password)" [2]=> string(82) "boolean changePassword(UNKNOWN $username, UNKNOWN $password, UNKNOWN $newPassword)" }


Mark

=== Axis 1.1 WSDL ===

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="https://localhost:8043/whisper-server/ws/UserService"; xmlns:apachesoap="http://xml.apache.org/xml-soap"; xmlns:impl="https://localhost:8043/whisper-server/ws/UserService"; xmlns:intf="https://localhost:8043/whisper-server/ws/UserService"; xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
<wsdl:message name="confirmCredentialsRequest">
<wsdl:part name="username" type="xsd:string"/>
<wsdl:part name="password" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="addNumbersRequest">
<wsdl:part name="left" type="xsd:int"/>
<wsdl:part name="right" type="xsd:int"/>
</wsdl:message>
<wsdl:message name="addNumbersResponse">
<wsdl:part name="addNumbersReturn" type="xsd:int"/>
</wsdl:message>
<wsdl:message name="changePasswordRequest">
<wsdl:part name="username" type="xsd:string"/>
<wsdl:part name="password" type="xsd:string"/>
<wsdl:part name="newPassword" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="confirmCredentialsResponse">
<wsdl:part name="confirmCredentialsReturn" type="xsd:boolean"/>
</wsdl:message>
<wsdl:message name="changePasswordResponse">
<wsdl:part name="changePasswordReturn" type="xsd:boolean"/>
</wsdl:message>
<wsdl:portType name="JaxRpcUserService">
<wsdl:operation name="addNumbers" parameterOrder="left right">
<wsdl:input message="impl:addNumbersRequest" name="addNumbersRequest"/>
<wsdl:output message="impl:addNumbersResponse" name="addNumbersResponse"/>
</wsdl:operation>
<wsdl:operation name="confirmCredentials" parameterOrder="username password">
<wsdl:input message="impl:confirmCredentialsRequest" name="confirmCredentialsRequest"/>
<wsdl:output message="impl:confirmCredentialsResponse" name="confirmCredentialsResponse"/>
</wsdl:operation>
<wsdl:operation name="changePassword" parameterOrder="username password newPassword">
<wsdl:input message="impl:changePasswordRequest" name="changePasswordRequest"/>
<wsdl:output message="impl:changePasswordResponse" name="changePasswordResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="UserServiceSoapBinding" type="impl:JaxRpcUserService">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="addNumbers">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="addNumbersRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="http://rpc.whisper.ucsc.edu"; use="encoded"/>
</wsdl:input>
<wsdl:output name="addNumbersResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="https://localhost:8043/whisper-server/ws/UserService"; use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="confirmCredentials">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="confirmCredentialsRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="http://rpc.whisper.ucsc.edu"; use="encoded"/>
</wsdl:input>
<wsdl:output name="confirmCredentialsResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="https://localhost:8043/whisper-server/ws/UserService"; use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="changePassword">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="changePasswordRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="http://rpc.whisper.ucsc.edu"; use="encoded"/>
</wsdl:input>
<wsdl:output name="changePasswordResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="https://localhost:8043/whisper-server/ws/UserService"; use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="JaxRpcUserServiceService">
<wsdl:port binding="impl:UserServiceSoapBinding" name="UserService">
<wsdlsoap:address location="https://localhost:8043/whisper-server/ws/UserService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>


=== Axis 1.1 (end) ===


=== Axis 1.2RC3 WSDL ===
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="https://localhost:8043/whisper-server/ws/UserService"; xmlns:apachesoap="http://xml.apache.org/xml-soap"; xmlns:impl="https://localhost:8043/whisper-server/ws/UserService"; xmlns:intf="https://localhost:8043/whisper-server/ws/UserService"; xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
<!--WSDL created by Apache Axis version: 1.2RC3
Built on Feb 28, 2005 (10:15:14 EST)-->


   <wsdl:message name="confirmCredentialsRequest">

      <wsdl:part name="username" type="soapenc:string"/>

      <wsdl:part name="password" type="soapenc:string"/>

   </wsdl:message>

   <wsdl:message name="addNumbersRequest">

      <wsdl:part name="left" type="xsd:int"/>

      <wsdl:part name="right" type="xsd:int"/>

   </wsdl:message>

   <wsdl:message name="addNumbersResponse">

      <wsdl:part name="addNumbersReturn" type="xsd:int"/>

   </wsdl:message>

   <wsdl:message name="changePasswordRequest">

      <wsdl:part name="username" type="soapenc:string"/>

      <wsdl:part name="password" type="soapenc:string"/>

      <wsdl:part name="newPassword" type="soapenc:string"/>

   </wsdl:message>

   <wsdl:message name="confirmCredentialsResponse">

      <wsdl:part name="confirmCredentialsReturn" type="xsd:boolean"/>

   </wsdl:message>

   <wsdl:message name="changePasswordResponse">

      <wsdl:part name="changePasswordReturn" type="xsd:boolean"/>

   </wsdl:message>

   <wsdl:portType name="JaxRpcUserService">

      <wsdl:operation name="addNumbers" parameterOrder="left right">

<wsdl:input message="impl:addNumbersRequest" name="addNumbersRequest"/>

<wsdl:output message="impl:addNumbersResponse" name="addNumbersResponse"/>

      </wsdl:operation>

<wsdl:operation name="confirmCredentials" parameterOrder="username password">

<wsdl:input message="impl:confirmCredentialsRequest" name="confirmCredentialsRequest"/>

<wsdl:output message="impl:confirmCredentialsResponse" name="confirmCredentialsResponse"/>

      </wsdl:operation>

<wsdl:operation name="changePassword" parameterOrder="username password newPassword">

<wsdl:input message="impl:changePasswordRequest" name="changePasswordRequest"/>

<wsdl:output message="impl:changePasswordResponse" name="changePasswordResponse"/>

      </wsdl:operation>

   </wsdl:portType>

<wsdl:binding name="UserServiceSoapBinding" type="impl:JaxRpcUserService">

<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="addNumbers">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="addNumbersRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="http://rpc.whisper.ucsc.edu"; use="encoded"/>

         </wsdl:input>

         <wsdl:output name="addNumbersResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="https://localhost:8043/whisper-server/ws/UserService"; use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="confirmCredentials">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="confirmCredentialsRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="http://rpc.whisper.ucsc.edu"; use="encoded"/>

         </wsdl:input>

         <wsdl:output name="confirmCredentialsResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="https://localhost:8043/whisper-server/ws/UserService"; use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="changePassword">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="changePasswordRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="http://rpc.whisper.ucsc.edu"; use="encoded"/>

         </wsdl:input>

         <wsdl:output name="changePasswordResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="https://localhost:8043/whisper-server/ws/UserService"; use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="JaxRpcUserServiceService">

      <wsdl:port binding="impl:UserServiceSoapBinding"  name="UserService">

<wsdlsoap:address location="https://localhost:8043/whisper-server/ws/UserService"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>
=== Axis 1.2RC3 (end) ===



--
-Jouni

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux