Post an XML file using SOAP

Post Reply
apietrocini
Member
Posts: 32
Joined: Fri Mar 24, 2017 7:06 pm
Location: Cleveland, OH

Post an XML file using SOAP

Post 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
dkelly
TOP CONTRIBUTOR
Posts: 658
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Re: Post an XML file using SOAP

Post 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]);
	}
}
loicaigon
Advanced member
Posts: 363
Joined: Wed Jul 10, 2013 10:22 am

Re: Post an XML file using SOAP

Post by loicaigon »

Post Reply