Hi,
i use CXF 3.14
i would like to remove some namespaces for some elements and preserve
other..
the original XML is like that :
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<wsse:Security
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-371dcf1d-2ef6-4e29-8b96-eedd053fdf69">
<wsse:Username>MYUSER</wsse:Username>
<wsse:Password
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">QTh0CuaMLVIUpyLCM8vvobZZg28=</wsse:Password>
<wsse:Nonce
EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">B2BolkOOPUgz4uXRDQJlJA==</wsse:Nonce>
<wsu:Created>2016-01-12T15:58:31.142Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
<Action
xmlns="http://www.w3.org/2005/08/addressing">http://webservices.afterbit.com/HSFREQ_07_3_1A</Action>
<MessageID
xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:59eeb370-c04c-4457-bd77-b67784c37eab</MessageID>
<To
xmlns="http://www.w3.org/2005/08/addressing">https://test.webservices.afterbit.com/MYUSER</To>
<ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
<Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
</ReplyTo>
<ns6:AMA_SecurityHostedUser
xmlns:ns6="http://xml.afterbit.com/2010/06/Security_v1"
xmlns:ns70="http://xml.afterbit.com/HSFREQ_07_3_1A"
xmlns:ns71="http://xml.afterbit.com/HSFRES_07_3_1A" >
<ns6:UserID AgentDutyCode="SS" POS_Type="0"
PseudoCityCode="AAABBB" RequestorType="X"/>
</ns6:AMA_SecurityHostedUser>
</soap:Header>
<soap:Body>
<ns70:Command_Cryptic
xmlns:ns6="http://xml.afterbit.com/2010/06/Security_v1"
xmlns:ns70="http://xml.afterbit.com/HSFREQ_07_3_1A"
xmlns:ns71="http://xml.afterbit.com/HSFRES_07_3_1A" >
<ns70:longTextString>
<ns70:textStringDetails>Hi</ns70:textStringDetails>
</ns70:longTextString>
</ns70:Command_Cryptic>
</soap:Body>
</soap:Envelope>
and this is what i would want :
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<wsse:Security
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-371dcf1d-2ef6-4e29-8b96-eedd053fdf69">
<wsse:Username>MYUSER</wsse:Username>
<wsse:Password
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">QTh0CuaMLVIUpyLCM8vvobZZg28=</wsse:Password>
<wsse:Nonce
EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">B2BolkOOPUgz4uXRDQJlJA==</wsse:Nonce>
<wsu:Created>2016-01-12T15:58:31.142Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
<Action
xmlns="http://www.w3.org/2005/08/addressing">http://webservices.afterbit.com/HSFREQ_07_3_1A</Action>
<MessageID
xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:59eeb370-c04c-4457-bd77-b67784c37eab</MessageID>
<To
xmlns="http://www.w3.org/2005/08/addressing">https://test.webservices.afterbit.com/MYUSER</To>
<ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
<Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
</ReplyTo>
<ns6:AMA_SecurityHostedUser
xmlns:ns6="http://xml.afterbit.com/2010/06/Security_v1">
<ns6:UserID AgentDutyCode="SS" POS_Type="0"
PseudoCityCode="AAABBB" RequestorType="X"/>
</ns6:AMA_SecurityHostedUser>
</soap:Header>
<soap:Body>
<ns70:Command_Cryptic>
<ns70:longTextString>
<ns70:textStringDetails>Hi</ns70:textStringDetails>
</ns70:longTextString>
</ns70:Command_Cryptic>
</soap:Body>
</soap:Envelope>
that is :
1) <ns6:AMA_SecurityHostedUser
xmlns:ns6="http://xml.afterbit.com/2010/06/Security_v1"
xmlns:ns70="http://xml.afterbit.com/HSFREQ_07_3_1A"
xmlns:ns71="http://xml.afterbit.com/HSFRES_07_3_1A" >
becomes :
<ns6:AMA_SecurityHostedUser
xmlns:ns6="http://xml.afterbit.com/2010/06/Security_v1" >
2) <ns70:Command_Cryptic
xmlns:ns6="http://xml.afterbit.com/2010/06/Security_v1"
xmlns:ns70="http://xml.afterbit.com/HSFREQ_07_3_1A"
xmlns:ns71="http://xml.afterbit.com/HSFRES_07_3_1A" >
becomes :
<ns70:Command_Cryptic >
this is my java unsuccessful code :
Map<String, String> outTransformMap = new HashMap<String, String>();
outTransformMap.put("{http://xml.afterbit.com/HSFREQ_07_3_1A}*", "*");
outTransformMap.put("{http://xml.afterbit.com/HSFRES_07_3_1A}*", "*");
outTransformMap.put("{http://xml.afterbit.com/2010/06/Security_v1}*",
"*");
outTransformMap.put("AMA_SecurityHostedUser",
"{http://xml.afterbit.com/2010/06/Security_v1}AMA_SecurityHostedUser");
org.apache.cxf.interceptor.transform.TransformOutInterceptor
transformOutInterceptor = new
org.apache.cxf.interceptor.transform.TransformOutInterceptor();
transformOutInterceptor.setOutTransformElements(outTransformMap);
client.getOutInterceptors().add(transformOutInterceptor);
Thanks!