You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Malisetti, Ramanjaneyulu" <Ra...@ca.com> on 2014/10/25 05:53:49 UTC

wsse:UsernameToken in request header - change from 2.7.1 to 3.0.2

Hi,

 Our web services client code which used to work in CXF 2.7.1 is not working with CXF 3.0.2.  Our client is based on  Dispatch<DOMSource>. Before making request we add following map to the dispatch.getRequestContext(), it is basically builds UserNameToken in webservice request

{ws-security.username=cat, ws-security.encryption.properties={org.apache.ws.security.crypto.merlin.keystore.password=default, org.apache.ws.security.crypto.merlin.keystore.type=JKS, org.apache.ws.security.crypto.merlin.file=/C:/ default-truststore.jks, org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin}, ws-security.password=cat, ws-security.callback-handler=com.ca.ucf.security.impl.PasswordCallbackHandler@2cc782<ma...@2cc782>}

When I  trace request with CXF 2.7.1, it  shows like below ..

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><international xmlns="http://www.w3.org/2005/09/ws-i18n"><locale>en_US</locale></international><RequestContext xmlns="http://ns.ca.com/catalyst/node"></RequestContext><Action xmlns="http://www.w3.org/2005/08/addressing">http://www.w3.org/2010/08/ws-mex/GetMetadata/Request</Action><MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:f4d09ed5-390a-417c-b13b-95b817218194</MessageID><To xmlns="http://www.w3.org/2005/08/addressing">https://hostA:9443/node/wsman/DummyModuleInstance</To><ReplyTo xmlns="http://www.w3.org/2005/08/addressing"><Address>http://www.w3.org/2005/08/addressing/anonymous</Address></ReplyTo><Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soap:mustUnderstand="1"><wsse:UsernameToken wsu:Id="UsernameToken-1"><wsse:Username>cat</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">cat</wsse:Password></wsse:UsernameToken></Security></soap:Header><soap:Body><GetMetadata xmlns="http://www.w3.org/2010/08/ws-mex"><Dialect Type="SCHEMA"></Dialect></GetMetadata></soap:Body></soap:Envelope>


Same code in CXF 3.0.2,  I don't see UsernameToken is added in request. The following is the request coming from client based on CXF 3.0.2

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><international xmlns="http://www.w3.org/2005/09/ws-i18n"><locale>en_US</locale></international><RequestContext xmlns="http://ns.ca.com/catalyst/node"/><Action xmlns="http://www.w3.org/2005/08/addressing">http://www.w3.org/2010/08/ws-mex/GetMetadata/Request</Action><MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:d133fc8e-1eaa-43af-8193-0fe94fafc412</MessageID><To xmlns="http://www.w3.org/2005/08/addressing">https://hostA:9443/node/wsman/DummyModuleInstance</To><ReplyTo xmlns="http://www.w3.org/2005/08/addressing"><Address>http://www.w3.org/2005/08/addressing/anonymous</Address></ReplyTo></soap:Header><soap:Body><GetMetadata xmlns="http://www.w3.org/2010/08/ws-mex"><Dialect Type="SCHEMA"/></GetMetadata></soap:Body></soap:Envelope>


What I am missing? Could you help?

Regards
Raman


Re: wsse:UsernameToken in request header - change from 2.7.1 to 3.0.2

Posted by Colm O hEigeartaigh <co...@apache.org>.
More information is required. What does your client code look like? Is it
using PAYLOAD/MESSAGE dispatch mode? What does the security policy in the
WSDL look like?

Do you really need the UsernameToken to appear in the metadata request?

Colm.

On Sat, Oct 25, 2014 at 4:53 AM, Malisetti, Ramanjaneyulu <
Ramanjaneyulu.Malisetti@ca.com> wrote:

> Hi,
>
>  Our web services client code which used to work in CXF 2.7.1 is not
> working with CXF 3.0.2.  Our client is based on  Dispatch<DOMSource>.
> Before making request we add following map to the
> dispatch.getRequestContext(), it is basically builds UserNameToken in
> webservice request
>
> {ws-security.username=cat,
> ws-security.encryption.properties={org.apache.ws.security.crypto.merlin.keystore.password=default,
> org.apache.ws.security.crypto.merlin.keystore.type=JKS,
> org.apache.ws.security.crypto.merlin.file=/C:/ default-truststore.jks,
> org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin},
> ws-security.password=cat,
> ws-security.callback-handler=com.ca.ucf.security.impl.PasswordCallbackHandler@2cc782
> <mailto:ws-security.callback-handler
> =com.ca.ucf.security.impl.PasswordCallbackHandler@2cc782>}
>
> When I  trace request with CXF 2.7.1, it  shows like below ..
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><international
> xmlns="http://www.w3.org/2005/09/ws-i18n"><locale>en_US</locale></international><RequestContext
> xmlns="http://ns.ca.com/catalyst/node"></RequestContext><Action xmlns="
> http://www.w3.org/2005/08/addressing">
> http://www.w3.org/2010/08/ws-mex/GetMetadata/Request</Action><MessageID
> xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:f4d09ed5-390a-417c-b13b-95b817218194</MessageID><To
> xmlns="http://www.w3.org/2005/08/addressing">
> https://hostA:9443/node/wsman/DummyModuleInstance</To><ReplyTo xmlns="
> http://www.w3.org/2005/08/addressing"><Address>
> http://www.w3.org/2005/08/addressing/anonymous</Address></ReplyTo><Security
> xmlns="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
> xmlns:wsse="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
> xmlns:wsu="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
> soap:mustUnderstand="1"><wsse:UsernameToken
> wsu:Id="UsernameToken-1"><wsse:Username>cat</wsse:Username><wsse:Password
> Type="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">cat</wsse:Password></wsse:UsernameToken></Security></soap:Header><soap:Body><GetMetadata
> xmlns="http://www.w3.org/2010/08/ws-mex"><Dialect
> Type="SCHEMA"></Dialect></GetMetadata></soap:Body></soap:Envelope>
>
>
> Same code in CXF 3.0.2,  I don't see UsernameToken is added in request.
> The following is the request coming from client based on CXF 3.0.2
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><international
> xmlns="http://www.w3.org/2005/09/ws-i18n"><locale>en_US</locale></international><RequestContext
> xmlns="http://ns.ca.com/catalyst/node"/><Action xmlns="
> http://www.w3.org/2005/08/addressing">
> http://www.w3.org/2010/08/ws-mex/GetMetadata/Request</Action><MessageID
> xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:d133fc8e-1eaa-43af-8193-0fe94fafc412</MessageID><To
> xmlns="http://www.w3.org/2005/08/addressing">
> https://hostA:9443/node/wsman/DummyModuleInstance</To><ReplyTo xmlns="
> http://www.w3.org/2005/08/addressing"><Address>
> http://www.w3.org/2005/08/addressing/anonymous</Address></ReplyTo></soap:Header><soap:Body><GetMetadata
> xmlns="http://www.w3.org/2010/08/ws-mex"><Dialect
> Type="SCHEMA"/></GetMetadata></soap:Body></soap:Envelope>
>
>
> What I am missing? Could you help?
>
> Regards
> Raman
>
>


-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com