You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Lukasz L." <Lu...@sabre.com> on 2008/10/15 16:01:20 UTC

Using CXF with prepared XML

Consider such case:
I want to make a call to a web service using SOAP
I have ready XML request that the web service expects so I want to send it
using CXF on client side.
Is it possible? 
This is an opposite case to the one when I have Java classes generated from
WSDL and I use them to construct request. In this case the request is
already prepared in XML.

It seems that ServiceMix CXF Provider does similar thing using its own
interceptors like JbiOutInterceptor and JbiOutWsdl1Interceptor.
Are there any interceptors that can be used for this purpose that are
available by default in CXF? (not coupling to servicemix)
-- 
View this message in context: http://www.nabble.com/Using-CXF-with-prepared-XML-tp19994142p19994142.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Using CXF with prepared XML

Posted by "Lukasz L." <Lu...@sabre.com>.
yes, that's what I asked, thanks!


Andrew Clegg wrote:
> 
> 2008/10/15 Lukasz L. <Lu...@sabre.com>:
>>
>> Consider such case:
>> I want to make a call to a web service using SOAP
>> I have ready XML request that the web service expects so I want to send
>> it
>> using CXF on client side.
>> Is it possible?
> 
> Yep, you can use javax.xml.ws.Dispatch to send raw XML as a SOAP
> message. Have a look at Glen Mazza's post about testing web services
> here:
> 
> http://www.jroller.com/gmazza/date/20080904
> 
> and look for Dispatch<SOAPMessage> and Dispatch<Source> in code
> listing 2. The Dispatch<SOAPMessage> example shows you how to send an
> entire message (read from a local XML file in this case). The
> Dispatch<Source> example is similar but just sends the payload -- the
> SOAP envelope is still generated for you.
> 
> Is this the sort of thing you mean?
> 
> Andrew.
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-CXF-with-prepared-XML-tp19994142p20033886.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Using CXF with prepared XML

Posted by Andrew Clegg <an...@gmail.com>.
Personally I would say there's little point unmarshalling it to Java
objects, only to have CXF marshal it again behind the scenes to send
down the wire!

I suppose this would give you a warning at the client end if the
payload is malformed, but you could do schema validation yourself and
not have to pay the cost of creating the JAXB objects.

Andrew.

2008/10/15 Adrian Corcoran <ad...@gmail.com>:
> do you have the payload of the body or the raw request? if you have raw
> request as Andrew is talking about then you can use Dispatch. If you have
> the pay load you could use your binding to parse it if Jaxb just create an
> instance of the context and unmarshall it. You will then have the object to
> pass as the request to your operation...
>
> On Wed, Oct 15, 2008 at 3:12 PM, Andrew Clegg <an...@gmail.com>wrote:
>
>> 2008/10/15 Lukasz L. <Lu...@sabre.com>:
>> >
>> > Consider such case:
>> > I want to make a call to a web service using SOAP
>> > I have ready XML request that the web service expects so I want to send
>> it
>> > using CXF on client side.
>> > Is it possible?
>>
>> Yep, you can use javax.xml.ws.Dispatch to send raw XML as a SOAP
>> message. Have a look at Glen Mazza's post about testing web services
>> here:
>>
>> http://www.jroller.com/gmazza/date/20080904
>>
>> and look for Dispatch<SOAPMessage> and Dispatch<Source> in code
>> listing 2. The Dispatch<SOAPMessage> example shows you how to send an
>> entire message (read from a local XML file in this case). The
>> Dispatch<Source> example is similar but just sends the payload -- the
>> SOAP envelope is still generated for you.
>>
>> Is this the sort of thing you mean?
>>
>> Andrew.
>>
>

Re: Using CXF with prepared XML

Posted by Adrian Corcoran <ad...@gmail.com>.
do you have the payload of the body or the raw request? if you have raw
request as Andrew is talking about then you can use Dispatch. If you have
the pay load you could use your binding to parse it if Jaxb just create an
instance of the context and unmarshall it. You will then have the object to
pass as the request to your operation...

On Wed, Oct 15, 2008 at 3:12 PM, Andrew Clegg <an...@gmail.com>wrote:

> 2008/10/15 Lukasz L. <Lu...@sabre.com>:
> >
> > Consider such case:
> > I want to make a call to a web service using SOAP
> > I have ready XML request that the web service expects so I want to send
> it
> > using CXF on client side.
> > Is it possible?
>
> Yep, you can use javax.xml.ws.Dispatch to send raw XML as a SOAP
> message. Have a look at Glen Mazza's post about testing web services
> here:
>
> http://www.jroller.com/gmazza/date/20080904
>
> and look for Dispatch<SOAPMessage> and Dispatch<Source> in code
> listing 2. The Dispatch<SOAPMessage> example shows you how to send an
> entire message (read from a local XML file in this case). The
> Dispatch<Source> example is similar but just sends the payload -- the
> SOAP envelope is still generated for you.
>
> Is this the sort of thing you mean?
>
> Andrew.
>

Re: Using CXF with prepared XML

Posted by Andrew Clegg <an...@gmail.com>.
2008/10/15 Lukasz L. <Lu...@sabre.com>:
>
> Consider such case:
> I want to make a call to a web service using SOAP
> I have ready XML request that the web service expects so I want to send it
> using CXF on client side.
> Is it possible?

Yep, you can use javax.xml.ws.Dispatch to send raw XML as a SOAP
message. Have a look at Glen Mazza's post about testing web services
here:

http://www.jroller.com/gmazza/date/20080904

and look for Dispatch<SOAPMessage> and Dispatch<Source> in code
listing 2. The Dispatch<SOAPMessage> example shows you how to send an
entire message (read from a local XML file in this case). The
Dispatch<Source> example is similar but just sends the payload -- the
SOAP envelope is still generated for you.

Is this the sort of thing you mean?

Andrew.