You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Felix Anthony <di...@gmail.com> on 2009/08/25 17:43:04 UTC

How contruct SOAP XML using apache cxf framework

Hi,
   
   I am new to SOAP protocol.  Any one help me how to contruct SOAP xml 
through my desktop java application using apache cxf framework. 

Following is the sample soap xml, i want to know how to construct this soap
xml using apache cxf (without wsdl) through my java application:

<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope" 
xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext"
xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2006/10/policy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
xmlns:wst="http://schemas.xmlsoap.org/ws/2004/04/trust"
xmlns:sp="http://xxxxxxxxxxxxxxxxxxxx"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

<Header>
<wsse:Security>
<wsse:UsernameToken Id="user"> 
<wsse:Username>xxxxxxxx</wsse:Username>
<wsse:Password>xxxxx</wsse:Password> 
</wsse:UsernameToken>
</wsse:Security> 
</Header>
<Body> 
<sp:IssuedToken
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Always">
<sp:Issuer>
<wsa:Address>http://xxxxxxxxxxxxx</wsa:Address>
<wsa:ReferenceProperties>
<mws:RPSCluster>http://xxxxxxxx</mws:RPSCluster>
<mws:TOU>http://xxxxxxxxxxxxxx</mws:TOU>
<mws:Privacy>http://xxxxxxxxxxxxxx</mws:Privacy>
<mws:LiveIdSignUpUrl>https://xxxxxxxxxxxxxxxx</mws:LiveIdSignUpUrl>
</wsa:ReferenceProperties>
</sp:Issuer>
<sp:RequestSecurityTokenTemplate>
<wst:TokenType>xxxxxxxx</wst:TokenType>
<wst:RequestType>
http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue
</wst:RequestType>
<wsp:AppliesTo>
<wsa:EndpointReference>
<wsa:Address>xxxxxxxxxxx</wsa:Address>
</wsa:EndpointReference>
</wsp:AppliesTo>
<wsp:PolicyReference URI="MBI_KEY_OLD"/>
</sp:RequestSecurityTokenTemplate>
</sp:IssuedToken>
</Body> </Envelope>  

Thanks in advance.

Please reply as soon as possible.
-- 
View this message in context: http://www.nabble.com/How-contruct-SOAP-XML-using-apache-cxf-framework-tp25136889p25136889.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How contruct SOAP XML using apache cxf framework

Posted by dilfel Antony <di...@gmail.com>.
Hi Daniel kulp,
              Thanks for the reply.

I have few  questions which are all mentioned below,
          1.  If i have XML schema for below  xml then how to construct soap
request using apache cxf framework?
          2. how can i contruct each part using apache cxf
ws-addressing,ws-policy and ws-secuiry.? (below soap  xml has addressing
part,policy part and security part).
         3.  what are the apache cxf classes required to generate SOAP
request? can you give me java sample code on this xml? (this will be more
helpful to me).

Please reply as soon as possible.

Thanks & Regards,
Felix.



On Wed, Aug 26, 2009 at 2:05 AM, Daniel Kulp <dk...@apache.org> wrote:

>
> Generally, if you don't have a schema/wsdl for the service, the best bet is
> the Dispatch clients.
>
> http://cxf.apache.org/docs/jax-ws-dispatch-api.html
>
> You can build up the message exactly as you need it and send it out.
>
> Dan
>
>
> On Tue August 25 2009 11:43:04 am Felix Anthony wrote:
> > Hi,
> >
> >    I am new to SOAP protocol.  Any one help me how to contruct SOAP xml
> > through my desktop java application using apache cxf framework.
> >
> > Following is the sample soap xml, i want to know how to construct this
> soap
> > xml using apache cxf (without wsdl) through my java application:
> >
> > <Envelope xmlns="http://www.w3.org/2003/05/soap-envelope"
> > xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext"
> > xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion"
> > xmlns:wsp="http://schemas.xmlsoap.org/ws/2006/10/policy"
> > xmlns:wsu="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
> >ty-utility-1.0.xsd" xmlns:wst="
> http://schemas.xmlsoap.org/ws/2004/04/trust"
> > xmlns:sp="http://xxxxxxxxxxxxxxxxxxxx"
> > xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">
> >
> > <Header>
> > <wsse:Security>
> > <wsse:UsernameToken Id="user">
> > <wsse:Username>xxxxxxxx</wsse:Username>
> > <wsse:Password>xxxxx</wsse:Password>
> > </wsse:UsernameToken>
> > </wsse:Security>
> > </Header>
> > <Body>
> > <sp:IssuedToken
> > sp:IncludeToken="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/Inclu
> >deToken/Always"> <sp:Issuer>
> > <wsa:Address>http://xxxxxxxxxxxxx</wsa:Address>
> > <wsa:ReferenceProperties>
> > <mws:RPSCluster>http://xxxxxxxx</mws:RPSCluster>
> > <mws:TOU>http://xxxxxxxxxxxxxx</mws:TOU>
> > <mws:Privacy>http://xxxxxxxxxxxxxx</mws:Privacy>
> > <mws:LiveIdSignUpUrl>https://xxxxxxxxxxxxxxxx</mws:LiveIdSignUpUrl>
> > </wsa:ReferenceProperties>
> > </sp:Issuer>
> > <sp:RequestSecurityTokenTemplate>
> > <wst:TokenType>xxxxxxxx</wst:TokenType>
> > <wst:RequestType>
> > http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue
> > </wst:RequestType>
> > <wsp:AppliesTo>
> > <wsa:EndpointReference>
> > <wsa:Address>xxxxxxxxxxx</wsa:Address>
> > </wsa:EndpointReference>
> > </wsp:AppliesTo>
> > <wsp:PolicyReference URI="MBI_KEY_OLD"/>
> > </sp:RequestSecurityTokenTemplate>
> > </sp:IssuedToken>
> > </Body> </Envelope>
> >
> > Thanks in advance.
> >
> > Please reply as soon as possible.
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>

Re: How contruct SOAP XML using apache cxf framework

Posted by Daniel Kulp <dk...@apache.org>.
Generally, if you don't have a schema/wsdl for the service, the best bet is 
the Dispatch clients.

http://cxf.apache.org/docs/jax-ws-dispatch-api.html

You can build up the message exactly as you need it and send it out.

Dan


On Tue August 25 2009 11:43:04 am Felix Anthony wrote:
> Hi,
>
>    I am new to SOAP protocol.  Any one help me how to contruct SOAP xml
> through my desktop java application using apache cxf framework.
>
> Following is the sample soap xml, i want to know how to construct this soap
> xml using apache cxf (without wsdl) through my java application:
>
> <Envelope xmlns="http://www.w3.org/2003/05/soap-envelope"
> xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext"
> xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion"
> xmlns:wsp="http://schemas.xmlsoap.org/ws/2006/10/policy"
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
>ty-utility-1.0.xsd" xmlns:wst="http://schemas.xmlsoap.org/ws/2004/04/trust"
> xmlns:sp="http://xxxxxxxxxxxxxxxxxxxx"
> xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">
>
> <Header>
> <wsse:Security>
> <wsse:UsernameToken Id="user">
> <wsse:Username>xxxxxxxx</wsse:Username>
> <wsse:Password>xxxxx</wsse:Password>
> </wsse:UsernameToken>
> </wsse:Security>
> </Header>
> <Body>
> <sp:IssuedToken
> sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/Inclu
>deToken/Always"> <sp:Issuer>
> <wsa:Address>http://xxxxxxxxxxxxx</wsa:Address>
> <wsa:ReferenceProperties>
> <mws:RPSCluster>http://xxxxxxxx</mws:RPSCluster>
> <mws:TOU>http://xxxxxxxxxxxxxx</mws:TOU>
> <mws:Privacy>http://xxxxxxxxxxxxxx</mws:Privacy>
> <mws:LiveIdSignUpUrl>https://xxxxxxxxxxxxxxxx</mws:LiveIdSignUpUrl>
> </wsa:ReferenceProperties>
> </sp:Issuer>
> <sp:RequestSecurityTokenTemplate>
> <wst:TokenType>xxxxxxxx</wst:TokenType>
> <wst:RequestType>
> http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue
> </wst:RequestType>
> <wsp:AppliesTo>
> <wsa:EndpointReference>
> <wsa:Address>xxxxxxxxxxx</wsa:Address>
> </wsa:EndpointReference>
> </wsp:AppliesTo>
> <wsp:PolicyReference URI="MBI_KEY_OLD"/>
> </sp:RequestSecurityTokenTemplate>
> </sp:IssuedToken>
> </Body> </Envelope>
>
> Thanks in advance.
>
> Please reply as soon as possible.

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog