Hi,
I'm using cxf 3.0.9 with security policy added in a dynamic way:
private static void initializedP2pPolicyFeature(Client wsClient) throws
ParserConfigurationException, SAXException, IOException {
PolicyBuilder builder = wsClient.getBus().getExtension(PolicyBuilder.class);
Policy policy =
builder.getPolicy(NodeWebServiceProvider.class.getResourceAsStream(P2P_POLICY_FILE));
WSPolicyFeature wsPolicyFeature = new WSPolicyFeature(policy);
wsClient.getBus().getFeatures().add(wsPolicyFeature);
wsPolicyFeature.initialize(wsClient, wsClient.getBus());
}
When the policy is added then the root element in my soap body has no prefix:
<soap:Body
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="_50f6c0c5-1e8c-4828-8fe1-7835388d361b">
<SubmitRetrieveInterchangeAgreementsRequestRequest
xmlns:ns16="http://uri.etsi.org/01903/v1.4.1#"
xmlns:ns15="urn:oasis:names:specification:ubl:schema:xsd:Fault-1"
xmlns:ns14="ec:schema:xsd:RetrieveInterchangeAgreementsRequest-2"
xmlns:ns13="ec:schema:xsd:RetrieveInterchangeAgreementsResponse-2"
xmlns:ns12="http://uri.etsi.org/01903/v1.3.2#"
xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
xmlns:ns10="ec:schema:xsd:CommonBasicComponents-1"
xmlns:ns9="urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2"
xmlns:ns8="http://www.w3.org/2000/09/xmldsig#"
xmlns:ns7="urn:oasis:names:specification:ubl:schema:xsd:SignatureBasicComponents-2"
xmlns:ns6="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader"
xmlns:ns5="ec:schema:xsd:CommonAggregateComponents-2"
xmlns:ns4="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:ns3="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
<ece:RetrieveInterchangeAgreementsRequest>
<ns4:SenderParty>
<ns2:EndpointID>DEV1_NOTENC_WEB_PARTY</ns2:EndpointID>
</ns4:SenderParty>
<ns4:ReceiverParty>
<ns2:EndpointID>DEV1_NOTENC_APP_PARTY</ns2:EndpointID>
</ns4:ReceiverParty>
</ece:RetrieveInterchangeAgreementsRequest>
</SubmitRetrieveInterchangeAgreementsRequestRequest>
</soap:Body>
I've managed to add the prefix by adding the "soap.env.ns.map", but then the
response is failing signature validation.
Response got valid namespace prefix:
<ec:SubmitRetrieveInterchangeAgreementsRequestResponse
xmlns:ec="ec:services:wsdl:RetrieveInterchangeAgreementsRequest-2"
xmlns:ec1="ec:schema:xsd:CommonBasicComponents-0.1">...
</ec:SubmitRetrieveInterchangeAgreementsRequestResponse>
But during the signature validation the prefix was gone:
2016-06-02 16:10:42,724 DEBUG
[org.apache.jcp.xml.dsig.internal.DigesterOutputStream] - <SOAP-ENV:Body
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="XWSSGID-1464876575214141951024"><SubmitRetrieveInterchangeAgreementsRequestResponse
xmlns="ec:services:wsdl:RetrieveInterchangeAgreementsRequest-2"
xmlns:ec="ec:services:wsdl:RetrieveInterchangeAgreementsRequest-2"
xmlns:ec1="ec:schema:xsd:CommonBasicComponents-0.1">
Causing that the actual digest didn't match the expected value.
Can you please help? I'm stuck with this problem for a week already.
Best regards,
Szymon