Soap request with multiple name spaces

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”>

soapenv:Header/

soapenv:Body

myr:MyRateRequest

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?

What are you trying to achieve? Can’t you simply generate proxy classes and merely call a method? If so, you don’t have to bother with such implementation details.

I am submitting a rate request to a freight carrier. I chose to build the request this way because the number of arguments in the request vary from order to order.

What do you mean by the varying number of arguments? How does it prevent you from using proxy classes?