What does the schema look like for the createAndStartRequestByValueException 
element?    From that error message, it looks like 
createAndStartRequestByValueException is not allowed to have a 
"createException" child element.   The only expected element is a "requestKey" 
element.   

Dan


On Tue February 2 2010 5:04:16 am KnutIvar wrote:
> 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:7
> 64) at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:6
> 23) at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:128)
>  at
> org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteral
> InInterceptor.java:190) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai
> n.java:236) at
>  org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:671) at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRespons
> eInternal(HTTPConduit.java:2177) at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRespons
> e(HTTPConduit.java:2057) at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPCon
> duit.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$MessageSenderEndingInte
> rceptor.handleMessage(MessageSenderInterceptor.java:62) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai
> n.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/OrderManageme
> nt-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.
> 

-- 
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to