+

Search Tips   |   Advanced Search

Encoding a SOAP XML envelope

Follow these instructions to encode a SOAP XML envelope within a request body

When we need to invoke a SOAP-based service in an HTTP adapter, encode the SOAP XML envelope within the request body.

Encode XML within JavaScript using E4X. E4X is officially part of JavaScript 1.6. This technology can be used to encode any XML document, not necessarily SOAP envelopes. For more information about E4X, see the related link.


Example

var request =
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<requestMessageObject xmlns="http://acme.com/ws/">
<messageHeader>
<version>1.0</version>
<originatingDevice>{originatingDevice}</originatingDevice>
<originatingIP>
{WL.Server.configuration["local.IPAddress"]}
</originatingIP>
<requestTimestamp>
{new Date().toLocaleString()}
</requestTimestamp>
</messageHeader>
<messageData>
<context>
<userkey>{userKey}</userkey>
<sessionid>{sessionid}</sessionid>
</context>
</messageData>
</requestMessageObject>
</S:Body>
</S:Envelope>;

Use the WL.Server.signSoapMessage() method only inside a procedure declared within an HTTP adapter. It signs a fragment of the specified envelope with ID wsId, using the key in the specified keystoreAlias, inserting the digital signature into the input document.

To use WL.Server.signSoapMessage() API when running MPF on IBM WebSphere Application Server we might need to add a JVM argument that instructs WebSphere to use a specific SOAPMessageFactory implementation instead of a default one. To do this, we must go to Application servers > {server_name} > Process definition > JVM and provide the following argument under Generic JVM arguments, typing in the code phrase exactly as it is presented here: -Djavax.xml.soap.MessageFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl

You must then restart the JVM.

Important: This workaround is only for IBM WebSphere.


Parent topic: Develop the server side of a MobileFirst application

Related information:

http://w3schools.sins-realm.com/e4x/default.asp.htm