Hi!

I'm trying to call a service, but gets unmarshalling error when I get a
response which (in my eyes) seems valid.

>From the wsdl;
<wsdl:operation name="createAndStartRequestByValue">
    <wsdl:input name="createAndStartRequestByValueRequest"
message="omWS-v1-0:createAndStartRequestByValueRequest"/>
    <wsdl:output name="createAndStartRequestByValueResponse"
message="omWS-v1-0:createAndStartRequestByValueResponse"/>
    <wsdl:fault name="createAndStartRequestByValueException"
message="omWS-v1-0:createAndStartRequestByValueException"/>
</wsdl:operation>

The return message from the service (and now my mock...) looks kind of like
this;
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
    <soapenv:Body>
        <om-v1-0:createAndStartRequestByValueException
                xmlns:om-v1-0="http://os.org/xml/Management/v1-0";
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
                xmlns:co-v1-5="http://os.org/xml/Common/v1-5";
                xmlns:jrc-v2-0="http://jrc.com/ossj/xml/Common/v2-0";>
            <om-v1-0:createException xsi:type="jrc-v2-0:JrCreateException">
                <co-v1-5:message></co-v1-5:message>
                <jrc-v2-0:jrExceptionDetails>
                    <jrc-v2-0:errorCode>60003</jrc-v2-0:errorCode>
                    <jrc-v2-0:retryable>false</jrc-v2-0:retryable>
                    <jrc-v2-0:errorMessage>Order state
invalid.</jrc-v2-0:errorMessage>
                   
<jrc-v2-0:component>com.jr.ordermanager</jrc-v2-0:component>
                    <jrc-v2-0:severity>Medium</jrc-v2-0:severity>
                    <jrc-v2-0:reason>No subscriber found for
productExternalID [98802-1]</jrc-v2-0:reason>
                   
<jrc-v2-0:requestPrimaryKey>936</jrc-v2-0:requestPrimaryKey>
                </jrc-v2-0:jrExceptionDetails>
            </om-v1-0:createException>
        </om-v1-0:createAndStartRequestByValueException>
    </soapenv:Body>
</soapenv:Envelope>

However; CXF doesn't like it and gives me the following stacktrace;
org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element
(uri:"http://ossj.org/xml/Management/v1-0";, local:"createException").
Expected elements are <{http://ossj.org/xml/Management/v1-0}requestKey> 
        at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:764)
        at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:623)
        at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:128)
        at
org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:190)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
        at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:671)
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2177)
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2057)
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1982)
        at 
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
        at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:637)
        at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:483)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309)
DefaultValidationEventHandler: [ERROR]: unexpected element
(uri:"http://ossj.org/xml/Management/v1-0";, local:"createException").
Expected elements are <{http://ossj.org/xml/Management/v1-0}requestKey> 
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261)

It expects a parameter which is located in the wsdl:output instead of
mapping it to the wsdl:fault. 
Do I have to write a custom faultinterceptor in order to handle this, or
could I add a standard interceptor to my client?

Client; 
org.apache.cxf.jaxws.JaxWsProxyFactoryBean clientFactory = new
org.apache.cxf.jaxws.JaxWsProxyFactoryBean();
clientFactory.setAddress("http://localhost:8088/soap/services/OrderManagement-mock";);
clientFactory.setServiceClass(JVTManagementSessionWSPort.class);
JVTManagementSessionWSPort client =
(JVTManagementSessionWSPort)clientFactory.create();

-----
http://www.knutivars.net www.knutivars.net 
"http://www.knutivars.net/cxf/index.html Document first Apache CXF and
XMLBeans with Spring. 
-- 
View this message in context: 
http://old.nabble.com/Client-side--service-returns-fault--Unmarshalling-Error%3A-unexpected-element-tp27417976p27417976.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to