We have an AX customization that requests and returns freight quotes to our carriers using XML documents. I need to modify this system for a new carrier that uses the SOAP protocol and web services. I have successfully programmed AX to send the web request and parse the response using a sample XML file. Now I am trying to create the XML document within AX2009, and am having trouble getting the SOAP envelope formatted correctly. I will admit here, that I am not familiar with SOAP at all. To me, it looks like a specifically formatted XML document that the XML Document class should be able to create. If it isn't, please steer me in the right direction.
The soap request needs to be formatted as shown below. Notice that there are two namespaces defined on the soapenv:Envelope node. That is the portion that I can't figure out how to generate.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/.../envelope xmlns:myr="http://myurl.com/" >
<soapenv:Header/>
<soapenv:Body>
<myr:takeSomeAction>
<node1>?</node1>
</myr:takeSomeAction>
</soapenv:Body>
</soapenv:Envelope>
This is the code I have tried..
xmlDoc = XmlDocument::newBlank("UTF-8");
envelopeNameSpace = 'schemas.xmlsoap.org/.../envelope';
rateNameSpace = 'http://myRate.ws.odfl.com/';
soapEnvelope = xmlDoc.appendChild(xmlDoc.createElement3('soapenv','Envelope',envelopeNamespace));
soapHeader = soapEnvelope.appendChild(xmlDoc.createElement3('soapenv','Header', envelopeNamespace));
soapBody = soapEnvelope.appendChild(xmlDoc.createelement3('soapenv','Body', envelopeNamespace));
MyRateRequest = soapBody.appendChild(xmlDoc.createElement3('myr','GetLTLRateEstimate', rateNameSpace));