camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Fredrik Wedén <jfwe...@gmail.com>
Subject Re: Using Spring WS component to call service which sends response as attachment
Date Tue, 28 Feb 2012 08:15:09 GMT
Yeah, I was afraid of that. For the time being we achieve our goal using a
custom processor to do the work with Spring WS Template.

We are already dicussing putting in some time to extend the camel component
so there might be a patch coming up in the near future as well. Would be
nice to rid ourselves of our custom logic :)

On Sat, Feb 25, 2012 at 00:42, Richard Kettelerij <
richardkettelerij@gmail.com> wrote:

> Hi,
>
> Currently the Camel spring-ws producer doesn't contain any logic to extract
> attachments from response messages. It just returns the resulting XML for
> further processing in your Camel route [1]. The Camel spring-ws producer
> uses a simple SourceExtractor (NoopSourceExtractor) to return the XML
> response as a Camel message body.
>
> You can try replacing this SourceExtractor with a
> WebServiceMessageExtractor that is capable of handeling attachments. The
> code in this sample [2] shows such an extractor (starting at line 128).
> This requires some modifications to the current Camel spring-ws
> producer. Consider filing a JIRA if you need this functionality or better
> yet, contribute a patch [3]. Patches are greatly appreciated.
>
> Regards,
> Richard
>
> [1] One can optionally leverage JAXB, Jibx, etc for this purpose. See
> http://camel.apache.org/data-format.html
> [2]
>
> https://fisheye.springsource.org/browse/spring-ws/trunk/samples/mtom/client/spring-ws/src/org/springframework/ws/samples/mtom/client/sws/AxiomMtomClient.java?r=1403#l128
> [3] http://camel.apache.org/contributing.html
>
> On Fri, Feb 24, 2012 at 5:30 PM, Jan Fredrik Wedén <jfweden@gmail.com
> >wrote:
>
> > Hi,
> >
> > This is my first shot at camel routing and I'm trying to use the Spring
> WS
> > component to call a webservice and marshal the response. The problem is
> > that this particular service returns the actual payload XML as an
> > attachment and the SOAP body contains the response type element wrapping
> a
> > single XML element with reference to the attachment cid. How should I go
> > about in order to retrieve and later marshal this response?
> >
> > What I've done so far is this:
> >
> > I'm using Spring to set up my Camel context and configure
> > a org.springframework.ws.client.core.WebServiceTemplate which uses
> > a org.springframework.ws.soap.saaj.SaajSoapMessageFactory and
> > a org.springframework.ws.transport.http.CommonsHttpMessageSender
> >
> > In my route definition I route a request to this endpoint using
> "spring-ws:
> > https://the.remote.service?webServiceTemplate=#wsTemplate" as the uri.
> > Which seems to work just fine - I can even spot the attachment in the
> > response if I have httpclient log the wire contents it receives.
> >
> > The problem is when I try to process the resulting Exchange in any way.
> At
> > this point the in body just contains what was inside the SOAP body
> element
> > and the attachment is nowhere to be found.
> >
> > --
> > - Jan Fredrik Wedén
> >
>



-- 
- Jan Fredrik Wedén

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message