I see the problem-  I was passing JAXBContext.class instead of a JAXBContext
object.
My current problem is when using the dispatch method, if the service returns
a bad response such as a 500 instead of a SoapFaultException being thrown I
get an Unmarshalling Error since it could not create the response object. 
Is there a way around this?



tirtza wrote:
> 
> I created a dispatch client since I am invoking a service that returns the
> soap message as rpc/encoded.
> I am using PAYLOAD mode since I want a JaxB object returned.
> My client generates this exception
> 
> org.apache.cxf.interceptor.Fault: Exception occurred while marshalling
> Dispatch object to stream
>       at
> org.apache.cxf.jaxws.interceptors.DispatchOutDatabindingInterceptor.handleMessage(DispatchOutDatabindingInterceptor.java:116)
>       at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
>       at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:172)
>       at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:121)
>       at
> net.idt.svp.Nomad.client.BalanceEnquiryClient.main(BalanceEnquiryClient.java:38)
> Caused by: java.lang.ClassCastException:
> net.idt.svp.Nomad.client.communication.BalanceEnquiryRqstInfo
>       at
> org.apache.cxf.databinding.source.NodeDataWriter.write(NodeDataWriter.java:52)
>       at
> org.apache.cxf.databinding.source.NodeDataWriter.write(NodeDataWriter.java:43)
>       at
> org.apache.cxf.jaxws.interceptors.DispatchOutDatabindingInterceptor.handleMessage(DispatchOutDatabindingInterceptor.java:112)
>       ... 4 more
> Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Exception
> occurred while marshalling Dispatch object to stream
>       at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:183)
>       at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:121)
>       at
> net.idt.svp.Nomad.client.BalanceEnquiryClient.main(BalanceEnquiryClient.java:38)
> 
> What am I doing wrong?
> Here is my client code.
> 
> URL wsdlURL =  new
> URL("http://someurl:20903/webservices/services/BalanceEnquiry?wsdl";);
> QName qName=new QName("urn:BalanceEnquiry", "BalanceEnquiryService");
> QName portName=new QName("urn:BalanceEnquiry", "BalanceEnquiry");
> BalanceEnquiryService ss = new BalanceEnquiryService(wsdlURL, qName);
> 
> Dispatch dispatch = ss.createDispatch(portName, JAXBContext.class ,
> Service.Mode.PAYLOAD);
> BalanceEnquiryRspsInfo resp= (BalanceEnquiryRspsInfo)
> dispatch.invoke(getRequest());
> 
> My request and response object were generated using wsdl2java
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Dispatch-Client-%2B-JaxB-tf4717372.html#a13485745
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to