You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by pradet <pd...@gmail.com> on 2012/09/21 11:14:21 UTC

Extract SOAP Body in blueprint XML

Hi,

I have been trying to get the following requirements in blueprint XML.

- An External client invokes the servicemix URL along with the SOAP Payload.

1. Inside the blueprint, I want to extract this SOAP Payload (Header, Body)
and get few informations like Username, CountryCode, SiteID, etc.

My SOAP message looks like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsa:Action>http://dummyWS.com/system/Access/ServiceOne</wsa:Action>
      <wsa:ReplyTo>
        
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
      </wsa:ReplyTo>
      <wsse:Security>
            <wsse:Username>scheduling</wsse:Username>
            <wsse:Password
wsse:Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">Password</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
         <ns2:UserName>TEST1</ns2:UserName>
         <ns2:SiteId>0000</ns2:SiteId>
         <ns2:CountryCode>XX</ns2:CountryCode>
</soapenv:Body>
</soapenv:Envelope> 


- How I can extract this information from a Blueprint XML. (No java methods
can be used for our project). 

Are there any alternate way of extracting SOAP message without using java. ?


2.  Going fwd, Once after extracting the SOAP data, I need to construct a
SOAP message (along with the extracted data like username, siteID,
CountryCode, etc )and call another REST service and pass this SOAP message
using POST method. 

- How to invoke a REST service in Blueprint XML, without using CXFRS since
it uses Java.

Could anyone update me with an information about this ?

Regards,
Pradeep



--
View this message in context: http://servicemix.396122.n5.nabble.com/Extract-SOAP-Body-in-blueprint-XML-tp5714486.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Extract SOAP Body in blueprint XML

Posted by pradet <pd...@gmail.com>.
Hi

I am able to retreive the SOAP Body details like below. I have used the
XPATH expression.

I had to use the resultType as String. Since, I am getting the SOAP
extracted variable as an Object. Do I know why this happens ? No Auto
TypeConverters are there for XPATH variables ?

<camel:setHeader headerName="xpathUserName">
            	<camel:xpath
resultType="java.lang.String">//soapenv:Body/n:UserName[text()]</camel:xpath>
</camel:setHeader>
            
<camel:setHeader headerName="xpathPassword">
         	<camel:xpath
resultType="java.lang.String">//soapenv:Body/n:siteID[text()]</camel:xpath>
</camel:setHeader>

<camel:setHeader headerName="xpathPassword">
            	<camel:xpath
resultType="java.lang.String">//soapenv:Body/n:countryCode[text()]</camel:xpath>
</camel:setHeader>


And Also, I would like to know, after extracting the above information. *I
want to construct a new SOAP request message for other WebService which I am
Invoking,. How I can construct the SOAP request message at runtime ?*

Thanks in Advance,
Pradeep





--
View this message in context: http://servicemix.396122.n5.nabble.com/Extract-SOAP-Body-in-blueprint-XML-tp5714486p5714488.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Extract SOAP Body in blueprint XML

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

XPath or XQuery can extract data from XML messages. And thus also from SOAP.
The big problem though is to get the namespace and xpath/xquery
expressions to work, so it can get the data.

If you use Camel then Camel supports them out of the box
http://camel.apache.org/xpath
http://camel.apache.org/xquery




On Fri, Sep 21, 2012 at 11:14 AM, pradet <pd...@gmail.com> wrote:
> Hi,
>
> I have been trying to get the following requirements in blueprint XML.
>
> - An External client invokes the servicemix URL along with the SOAP Payload.
>
> 1. Inside the blueprint, I want to extract this SOAP Payload (Header, Body)
> and get few informations like Username, CountryCode, SiteID, etc.
>
> My SOAP message looks like this:
>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"
> xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
>       <wsa:Action>http://dummyWS.com/system/Access/ServiceOne</wsa:Action>
>       <wsa:ReplyTo>
>
> <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
>       </wsa:ReplyTo>
>       <wsse:Security>
>             <wsse:Username>scheduling</wsse:Username>
>             <wsse:Password
> wsse:Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">Password</wsse:Password>
>          </wsse:UsernameToken>
>       </wsse:Security>
>    </soapenv:Header>
>    <soapenv:Body>
>          <ns2:UserName>TEST1</ns2:UserName>
>          <ns2:SiteId>0000</ns2:SiteId>
>          <ns2:CountryCode>XX</ns2:CountryCode>
> </soapenv:Body>
> </soapenv:Envelope>
>
>
> - How I can extract this information from a Blueprint XML. (No java methods
> can be used for our project).
>
> Are there any alternate way of extracting SOAP message without using java. ?
>
>
> 2.  Going fwd, Once after extracting the SOAP data, I need to construct a
> SOAP message (along with the extracted data like username, siteID,
> CountryCode, etc )and call another REST service and pass this SOAP message
> using POST method.
>
> - How to invoke a REST service in Blueprint XML, without using CXFRS since
> it uses Java.
>
> Could anyone update me with an information about this ?
>
> Regards,
> Pradeep
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Extract-SOAP-Body-in-blueprint-XML-tp5714486.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen