You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by tirtza <ti...@corp.idt.net> on 2007/10/30 10:37:22 UTC

Dispatch Client + JaxB

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#a13485237
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Dispatch Client + JaxB

Posted by Glen Mazza <gl...@verizon.net>.
Hmmm...can you actually use JAXBContext with rpc/encoded?  I would have
guessed "no" (and hence you would be limited to the other two Dispatch
options--either Sources or SOAPMessages), because JAX-WS is not defined
with respect to rpc/encoded web services, only rpc/lit or doc/lit.

Glen

Am Dienstag, den 30.10.2007, 03:18 -0700 schrieb tirtza:
> 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
...


RE: Dispatch Client + JaxB

Posted by "Liu, Jervis" <jl...@iona.com>.
It would be nice if we can catch the HTTP 500 error and throw this to the client as a ProtocolException instead of failed silently.  I will file a JIRA if this sounds a reasable solution.

Cheers,
Jervis

> -----Original Message-----
> From: tirtza [mailto:tirtza.bernstein@corp.idt.net]
> Sent: 2007?10?30? 18:19
> To: cxf-user@incubator.apache.org
> Subject: Re: Dispatch Client + JaxB
> 
> 
> 
> 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.DispatchOutDatabindingInterc
> eptor.handleMessage(DispatchOutDatabindingInterceptor.java:116)
> > 	at
> > 
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIn
terceptorChain.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(BalanceEnqu
iryClient.java:38)
> > Caused by: java.lang.ClassCastException:
> > net.idt.svp.Nomad.client.communication.BalanceEnquiryRqstInfo
> > 	at
> > 
> org.apache.cxf.databinding.source.NodeDataWriter.write(NodeDat
aWriter.java:52)
> > 	at
> > 
> org.apache.cxf.databinding.source.NodeDataWriter.write(NodeDat
aWriter.java:43)
> > 	at
> > 
> org.apache.cxf.jaxws.interceptors.DispatchOutDatabindingInterc
> eptor.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(BalanceEnqu
iryClient.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.

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Re: Dispatch Client + JaxB

Posted by tirtza <ti...@corp.idt.net>.
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.