users@jax-ws.java.net

Re: Errors consuming a PHP Based Web service through JAX-WS

From: Sergio Gutierrez <saguti_at_gmail.com>
Date: Wed, 8 Nov 2006 19:21:23 -0500

Thanks again for your answer Jitu.

Below, I paste the result of trying the invocation when I setup the service
as document/literal.

There is something I had not seen before, and it is that the server response
is an Internal Server Error (Http code 500)

The exception is:

8/11/2006 07:09:05 PM com.sun.xml.messaging.saaj.soap.impl.FaultImplsetFaultCode
GRAVE: SAAJ0140: No NamespaceURI, SOAP requires faultcode content to be a
QName
Exception in thread "main" javax.xml.ws.WebServiceException:
com.sun.xml.messaging.saaj.SOAPExceptionImpl: No NamespaceURI, SOAP requires
faultcode content to be a QName
        at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(
SOAP11Fault.java:162)
        at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(
SOAPFaultBuilder.java:83)
        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(
SyncMethodHandler.java:248)
        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(
SyncMethodHandler.java:212)
        at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:101)
        at $Proxy28.hello(Unknown Source)
        at co.com.une.mediador.Cliente.main(Cliente.java:32)
Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: No NamespaceURI,
SOAP requires faultcode content to be a QName
        at com.sun.xml.messaging.saaj.soap.impl.FaultImpl.setFaultCode(
FaultImpl.java:101)
        at com.sun.xml.messaging.saaj.soap.impl.FaultImpl.setFaultCode(
FaultImpl.java:138)
        at
com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl.createFault
(SOAPFactory1_1Impl.java:57)
        at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(
SOAP11Fault.java:153)
        ... 6 more
Java Result: 1


And the SOAP Traffic data is:

<!-- ---- WSDL Begins ----------- -->

<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:hellowsdl"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="urn:hellowsdl">
<types><xsd:schema targetNamespace="urn:hellowsdl">
 <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
 <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
 <xsd:complexType name="helloRequestType">
  <xsd:all>
   <xsd:element name="name" type="xsd:string"/>
  </xsd:all>
 </xsd:complexType>
 <xsd:complexType name="helloResponseType">
  <xsd:all>
   <xsd:element name="return" type="xsd:string"/>
  </xsd:all>
 </xsd:complexType>
 <xsd:element name="hello" type="tns:helloRequestType"/>
 <xsd:element name="helloResponse" type="tns:helloResponseType"/>
</xsd:schema>
</types>
<message name="helloRequest">
    <part name="parameters" element="tns:hello" />
</message>

<message name="helloResponse">
    <part name="parameters" element="tns:helloResponse" />
</message>


<portType name="hellowsdlPortType">
    <operation name="hello">
        <documentation>Says hello to the caller</documentation>
        <input message="tns:helloRequest"/>
        <output message="tns:helloResponse"/>
    </operation>
</portType>


<binding name="hellowsdlBinding" type="tns:hellowsdlPortType">
    <soap:binding style="rpc" transport="
http://schemas.xmlsoap.org/soap/http"/>
        <operation name="hello">
            <soap:operation soapAction="urn:hellowsdl#hello"
style="document"/>
            <input>
                <soap:body use="literal" namespace="urn:hellowsdl"/>
            </input>
            <output>
                <soap:body use="literal" namespace="urn:hellowsdl"/>
            </output>
        </operation>
    </binding>

<service name="hellowsdl">
    <port name="hellowsdlPort" binding="tns:hellowsdlBinding">
        <soap:address location="http://calumma.une.net.co/Centrex/hello.php
"/>
    </port>
</service>

</definitions>


<!-- ---- WSDL Ends ----------- -->



<<!-- Request Begins ------------ -->


POST /Centrex/hello.php HTTP/1.1

SOAPAction: urn:hellowsdl#hello

Content-Type: text/xml; charset="utf-8"

Accept: text/xml, multipart/related, text/html, image/gif, image/jpeg, *;
q=.2, */*; q=.2

User-Agent: Java/1.5.0_06

Host: calumma.une.net.co

Connection: keep-alive

Content-Length: 184



<?xml version="1.0" ?>
    <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:hello xmlns:ns2="urn:hellowsdl">
            <name>Sergio</name>
        </ns2:hello>
    </S:Body>
    </S:Envelope>



<!-- Request Ends ------------ -->


<!-- Response Begins ------------ -->

HTTP/1.1 500 Internal Server Error

Date: Thu, 09 Nov 2006 00:09:16 GMT

Server: Apache/1.3.36 (Unix) PHP/5.1.4 mod_ssl/2.8.27 OpenSSL/0.9.8b

X-Powered-By: PHP/5.1.4

Status: 500 Internal Server Error

X-SOAP-Server: NuSOAP/0.7.2 (1.94)

Content-Length: 651

Connection: close

Content-Type: text/xml; charset=ISO-8859-1


<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">

<SOAP-ENV:Body>
    <SOAP-ENV:Fault>
        <faultcode xsi:type="xsd:string">Server</faultcode>
        <faultactor xsi:type="xsd:string"></faultactor>
        <faultstring xsi:type="xsd:string">unable to serialize
result</faultstring>
        <detail xsi:type="xsd:string"></detail>
    </SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

<!-- Response Ends -->


I am afraid that this shows problems with the implementation of SOAP
protocol within PHP NuSOAP. What do you think?

Anyway, I will try not using NuSOAP, but the native core implementation of
SOAP which PHP has built it.



Thanks in advance for your help.


Kind regards.

Sergio G.