Soap envelope unwrapping?

View: New views
2 Messages — Rating Filter:   Alert me  

Soap envelope unwrapping?

by metro-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everyone,
I'm looking for some help with an axis web service that I invoke using a JAX-WS client. The client uses a wsdl - see the attached file "consult2.wsdl". I Generated the client top-down from the wsdl file. BAsically there is the operation defined in the wsdl file (I have attached the whole wsdl):
[i]
                  <wsdl:operation name="processEnvelope">
                           <wsdlsoap:operation soapAction=""/>
                           <wsdl:input name="processEnvelopeRequest">
                                    <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:publicid:-:DGTAXUD:EOS:EORI:WEBSERVICE:1.0" use="encoded"/>
                           </wsdl:input>
                           <wsdl:output name="processEnvelopeResponse">
                                    <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:publicid:-:DGTAXUD:EOS:EORI:WEBSERVICE:1.0" use="encoded"/>
                           </wsdl:output>
                  </wsdl:operation>[/i]

The generated classes consist of the client:

[i]@WebServiceClient(name = "WSMessageHandlerService", targetNamespace = "urn:publicid:-:DGTAXUD:EOS:EORI:WEBSERVICE:1.0", wsdlLocation = "wsdl/EORI.wsdl")
public class WSMessageHandlerService extends Service {
private final static URL WSMESSAGEHANDLERSERVICE_WSDL_LOCATION;
static{//............... WSMESSAGEHANDLERSERVICE_WSDL_LOCATION is instantiated here}

    /**
     * Constructor
     *
     * @param wsdlLocation
     *            the location of the WSDL
     * @param serviceName
     *            The name of the service
     */
    public WSMessageHandlerService(URL wsdlLocation, QName serviceName) {
        super(wsdlLocation, serviceName);
    }

    /**
     * default constructor
     */
    public WSMessageHandlerService() {
        super(WSMESSAGEHANDLERSERVICE_WSDL_LOCATION, new QName(
                "urn:publicid:-:DGTAXUD:EOS:EORI:WEBSERVICE:1.0",
                "WSMessageHandlerService"));
    }

    /**
     *
     * @return returns WSMessageHandler Instance of the web service endpoint
     */
    @WebEndpoint(name = "consult")
    public WSMessageHandler getConsult() {
        return super.getPort(new QName(
                "urn:publicid:-:DGTAXUD:EOS:EORI:WEBSERVICE:1.0", "consult"),
                WSMessageHandler.class);
    }

}[/i]

And also the interface declaring the web service and its method:

[i]@WebService(name = "WSMessageHandler", targetNamespace = "urn:publicid:-:DGTAXUD:EOS:EORI:WEBSERVICE:1.0")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public interface WSMessageHandler {

    /**
     *
     * @param in0
     *            input paramether
     * @return returns byte[]
     */
    @WebMethod
    @WebResult(name = "processEnvelopeReturn", partName = "processEnvelopeReturn")
    public byte[] processEnvelope(
            @WebParam(name = "in0", partName = "in0") byte[] in0);[/i]

The problem is - if I invoke the method WSMessageHandler.processEnvelop trough the stub returned from my WS client, I get the following error:
[i]
javax.xml.ws.WebServiceException: Unexpected response
 element {http://schemas.xmlsoap.org/soap/envelope/}Body expected: {urn:publicid
:-:DGTAXUD:EOS:EORI:WEBSERVICE:1.0}processEnvelopeResponse[/i]

The response is wrapped in a <soap:Body> element, where the soap: namespace is "http://schemas.xmlsoap.org/soap/envelope/".
Is there a way to specify in my client to unwrap the soap envelope automatically? Any help is greatly appreciated!
[Message sent by forum member 'swapper' (swapper)]

http://forums.java.net/jive/thread.jspa?messageID=354993

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Soap envelope unwrapping?

by Glen Mazza :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You're accessing an older RPC/encoded WSDL (you can see in the wsdl:binding section), which JAX-WS implementations like Metro and CXF normally can't handle.  For RPC/encoded, you can use Axis1, the older JAX-RPC implementation, or, if you really want to stay with Metro, the JAX-WS Dispatch mechanism[1].

Glen

[1] http://www.jroller.com/gmazza/entry/calling_rpc_encoded_web_services

metro-3 wrote:
Hi everyone,
I'm looking for some help with an axis web service that I invoke using a JAX-WS client. The client uses a wsdl - see the attached file "consult2.wsdl". I Generated the client top-down from the wsdl file. BAsically there is the operation defined in the wsdl file (I have attached the whole wsdl):
[i]
                  <wsdl:operation name="processEnvelope">
                           <wsdlsoap:operation soapAction=""/>
                           <wsdl:input name="processEnvelopeRequest">
                                    <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:publicid:-:DGTAXUD:EOS:EORI:WEBSERVICE:1.0" use="encoded"/>
                           </wsdl:input>
                           <wsdl:output name="processEnvelopeResponse">
                                    <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:publicid:-:DGTAXUD:EOS:EORI:WEBSERVICE:1.0" use="encoded"/>
                           </wsdl:output>
                  </wsdl:operation>[/i]