Page 1 of 1
Post an XML file using SOAP
Posted: Mon Apr 30, 2018 9:21 pm
by apietrocini
I have an xml file that contains order information... Is there an easy way to post that order to a web service that is SOAP based and not REST... My thought was that I could use the HTTP request, but if I understand correctly that is a REST based web service...?
Thanks,
Anthony
Re: Post an XML file using SOAP
Posted: Mon Apr 30, 2018 11:17 pm
by dkelly
Here's a SOAP example
Code: Select all
// create soap request
var theRequest = {
"http://www.webserviceX.NET/:ConvertTemp" : {
"http://www.webserviceX.NET/:Temperature" : 100.0,
"http://www.webserviceX.NET/:FromUnit" : "degreeCelsius",
"http://www.webserviceX.NET/:ToUnit" : "degreeFahrenheit"
}
};
var SOAPRequest = new SOAP(theRequest);
SOAPRequest.writeToFile("/tmp/request.env");
var SOAPResponse = SOAPRequest.requestMessage("http://www.webserviceX.NET/ConvertTemperature.asmx", "http://www.webserviceX.NET/ConvertTemp");
SOAPResponse.writeToFile("/tmp/response.env");
var values = SOAPResponse.parseBody("//dn:ConvertTempResult");
for (var i=0; i<values.length; i++) {
s.log(1, "value = " + values[i]);
}
}
Re: Post an XML file using SOAP
Posted: Tue May 01, 2018 5:57 pm
by loicaigon