I am using AX2012 to create a soap web request but I don’t have the namespace info correct.
This is what the request needs to look like.
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:myr=“http://mysite.com”>
I receive the error root element missing when I use my code:
static void CreateXML_odfl(salesQuotationTable _quotation)
{
XmlDocument xmlDoc; //to create blank XMLDocument
XMLNode xmlRoot, soapEnvelope, soapHeader, soapBody,MyRateRequest;
XMLNode nOriginPostalCode, nOriginCountry, nDestinationPostalCode, dCountry;
str envelopeNameSpace, rateNameSpace, inputxml;
FileName xmlFileName;
xmlDoc = XmlDocument::newBlank(“UTF-8”);
envelopeNameSpace = 'schemas.xmlsoap.org/…/’;
rateNameSpace = 'http://mysite.com/’;
//create nodes
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));
//argument nodes added
inputXML = xmlDoc.documentElement().outerXml();
if(!xmlDoc.loadXML(this.rateServiceConsumer(inputXML)))
{
error = xmlDoc.parseError();
info (error.reason());
return;
}
}
Can anyone help me get the namespace correct?