Create a SOAP Envelope

Primary tabs

Hello,

we are trying to figure out if there's a way to create a SOAP Envelope by using SOAP classes.

Right now we use a string to define the envelope element.

The string looks like :

<soap:Envelope xmlns:soap='http://www.w3.org/2003/05/soap-envelope' xmlns='urn:oasis:names:tc:SAML:2.0:assertion'>
    <soap:Header>
        <add:Action xmlns:add='http://www.w3.org/2005/08/addressing'>urn:rve:AuthenticateAndGetAssertionRequest</add:Action>
        <add:MessageID xmlns:add='http://www.w3.org/2005/08/addressing'>urn:uuid:_MessageID_</add:MessageID>
        <add:To xmlns:add='http://www.w3.org/2005/08/addressing'>_Addressing_</add:To>
        <wsse:Security xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secex...'>
            <wsse:UsernameToken xmlns:utp='http://docs.oasisopen.org/wss/2004/01/oasis-200401-wss-wssecurity-utilit...'>
                <wsse:Username>_username_</wsse:Username>
                <wsse:Password Type='rve:PasswordEncrypted'>_token_</wsse:Password>
                <wsse:Nonce>_nonce_</wsse:Nonce>
                <utp:Created>_timestamp_</utp:Created>
            </wsse:UsernameToken>
        </wsse:Security>
    </soap:Header>
    <soap:Body>_Body_</soap:Body>
</soap:Envelope>

 

There's a way to build up the SOAP Envelope and get the same result as our string but by using a class?

Replies

The answer to this question really depends on the context and where in the process you are at. If you would like to have a more in-depth discussion with someone about that, I would suggest that you reach out to your InterSystems account team or Support.

Typically when you are sending SOAP requests from an InterSystems product, you would get a WSDL from the SOAP service endpoint and use our SOAP Wizard to generate client classes. Then those client classes can be used at the object level to send requests. You can find documentation on the SOAP wizard here. To use the generated SOAP client classes, see our documentation here. Then this section in the documentation discusses how to add security elements to your SOAP request.

If you would just like a more object-friendly way to build up XML you can consider using the %XML.Writer API's, documented here and here.

Thanks for your suggestions, we have resolved our issue by using the XSLT Transformer. 

Kind regards.