incorrect soap message format

0
When mendix uses the Domian to xml mapping to create a soap message the format of the message is not exactly as it should be the message that mendix generates looks as the following <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header> <ns1:Security xmlns:ns1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <ns1:UsernameToken http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd:Id="UsernameToken-0000"> <ns1:Username>username</ns1:Username> <ns1:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">password</ns1:Password> <ns1:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">PKpZ50jd</ns1:Nonce> <ns2:Created xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2016-03-6603:43:33+0000</ns2:Created> </ns1:UsernameToken> </ns1:Security> </soapenv:Header> while in reality it should look like the following <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv: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"> <wsse:UsernameToken wsu:Id="UsernameToken-0000"> <wsse:Username>username</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">password</wsse:Password> <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">PKpZ50jd</wsse:Nonce> <wsu:Created>2016-03-03T08:50:37Z</wsu:Created> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> the domain to xml mapping is based from a consumed webservice that is imported trough a wsdl file how can I make mendix generate namespaces prefixes that match wsse and wsu instead of ns1 and ns2 how can I include the wsu namespace definition in security tag?
asked
1 answers
2

In the webservice call action select the custom option on the request header tab. Then select the insert template option WS Security User Name Token and your header will look like:

<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
  <wsse:UsernameToken>
    <wsse:Username>{1}</wsse:Username>
    <wsse:Password>{2}</wsse:Password>
  </wsse:UsernameToken>
</wsse:Security>

Almost what you need add the additional tag and the namespace declaration in the template and map the variables in the parameters section and you should get the required structure in your webservice header when calling the webservice.

If the template isn't completely what you need then just write the header manually and add the needed parameters and you have the same results.

answered