users@jax-ws.java.net

Error in decoding SOAP Message / Dispatch method cannot be found due to namespace problem

From: <breadfan_at_gmx.de>
Date: Tue, 9 May 2006 14:08:30 +0200 (MEST)

I have a webservice-wsdl (simplified for this testcase), generated the jaxb
and jaxws java binding files and implemented the client and the server (J2SE
Client) with JAX-WS (nightly 20060504). When I call the service, the
following exception is thrown at the serverside during the parse of the soap
message:

08.05.2006 17:50:18
com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.toMessageInfo
SCHWERWIEGEND: Error in decoding SOAP Message
 Error in decoding SOAP Message at
com.sun.xml.ws.encoding.soap.server.SOAPXMLDecoder.toInternalMessage(SOAPXMLDecoder.java:89)
 at
com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.toMessageInfo(SOAPMessageDispatcher.java:187)
...
and more interesting below:
Caused by: javax.xml.ws.soap.SOAPFaultException: Cannot find the dispatch
method

My Jaxws-client sends the following soap request:

<?xml version="1.0" ?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soapenv:Body>
<ans:checkAddress xmlns:ans="http://fss.o2.com/portal/input">
<checkAddressRequestPart>TestRequestString</checkAddressRequestPart>
</ans:checkAddress>
</soapenv:Body>
</soapenv:Envelope>

If you look at the ans:checkAddress, it is bound to the 'input' namespace
(http://fss.o2.com/portal/input). The jaxws server implementation on the
other side tries to find the correct java method in the method
decodeDispatchMethod of com.sun.xml.ws.encoding.soap.server.SOAPXMLDecoder.
It interrogates a hash map (mapping QNames to java methods) via the code :
JavaMethod javaMethod = rtModel.getJavaMethod(name);

If I debug, the parameter 'name' is :
{http://fss.o2.com/portal/input}checkAddress
But the map contains the following entry :
{{http://fss.o2.com/portal/services}checkAddress=com.sun.xml.ws.model.JavaMethod@e5ace9}

So the getJavaMethod-call obviously returns null, which causes the exception
to be thrown.

Looking at the soap message above, I think the client implementation of
jax-ws does it wrong, because it binds the checkAddress-Tag to the input
namespace. If you look at the wsdl below I would expect the targetNamespace
of the wsdl here, but I don't know what's in the specs here, so I'm not
sure. Has anyone more detailed infos here?

Btw. I've already posted a bug defect (#14) for this.


The wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://fss.o2.com/portal/services"
targetNamespace="http://fss.o2.com/portal/services"
xmlns:transport="http://fss.o2.com/portal/transport">
        <wsdl:types>
        </wsdl:types>
        <wsdl:message name="checkAddressRequestMsg">
                <wsdl:part name="checkAddressRequestPart" type="xsd:string"/>
        </wsdl:message>
        <wsdl:message name="checkAddressResultMsg">
                <wsdl:part name="checkAddressResultPart" type="xsd:string"/>
        </wsdl:message>
        <wsdl:portType name="PortalEaiPortType">
                <wsdl:operation name="checkAddress">
                        <wsdl:input message="tns:checkAddressRequestMsg"/>
                        <wsdl:output message="tns:checkAddressResultMsg"/>
                </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="PortalEaiBinding" type="tns:PortalEaiPortType">
                <soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
                <wsdl:operation name="checkAddress">
                        <wsdl:documentation>The operation has no
documentation</wsdl:documentation>
                        <soap:operation style="rpc" soapAction="Portal_Portal2BPM_checkAddress"/>
                        <wsdl:input>
                                <soap:body parts="checkAddressRequestPart" use="literal"
namespace="http://fss.o2.com/portal/input"/>
                        </wsdl:input>
                        <wsdl:output>
                                <soap:body parts="checkAddressResultPart" use="literal"
namespace="http://fss.o2.com/portal/output"/>
                        </wsdl:output>
                </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="PortalEaiService">
                <wsdl:port name="PortalEaiHttpPort" binding="tns:PortalEaiBinding">
                        <soap:address
location="http://tibco13413008:2020/Business__Processes/Adapters/Portal/Inbound/portalEai"/>
                </wsdl:port>
        </wsdl:service>
</wsdl:definitions>

The java code of the testcase:

        // Server
        PortalEaiPortBugRepImpl portalEaiPortImpl = new
PortalEaiPortBugRepImpl();
        Endpoint portalEaiEndpoint =
Endpoint.publish("http://localhost:8080/jaxws-test/portalEai",
            portalEaiPortImpl);

        // Client Start
        PortalEaiService portalEaiService = new PortalEaiService();
        PortalEaiPortType portalEaiPortType =
portalEaiService.getPortalEaiHttpPort();

        Map requestContext = ((BindingProvider)
portalEaiPortType).getRequestContext();
        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            "http://localhost:82/jaxws-test/portalEai");

        String checkAddressResult =
portalEaiPortType.checkAddress("TestRequestString");

        assertEquals("checkAddressResult.getOverallRemark()", "OverallRemark
response",
            checkAddressResult);

        // Client end

        // Server stop
        portalEaiEndpoint.stop();


The dummy server implementation:

@WebService(endpointInterface =
"com.o2.portal.fss.connector.jaxws.PortalEaiPortType")
public class PortalEaiPortBugRepImpl implements PortalEaiPortType
{
    public String checkAddress(String checkAddressRequest)
    {
        return "Response test string";
    }
}

Thanks in advance,
Chris Wewerka

-- 
Analog-/ISDN-Nutzer sparen mit GMX SmartSurfer bis zu 70%!
Kostenlos downloaden: http://www.gmx.net/de/go/smartsurfer