Hi,
I am trying to post data on a soap server but I am failed to send it.
Given service returns city weather again a zip code
http://wsf.cdyne.com/WeatherWS/Weather.asmx/GetCityWeatherByZIP
http://wsf.cdyne.com/WeatherWS/Weather.asmx?op=GetCityWeatherByZIP (main site )
here are fully params for that
POST /WeatherWS/Weather.asmx HTTP/1.1
Host: wsf.cdyne.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://ws.cdyne.com/WeatherWS/GetCityWeatherByZIP"
<?xml version="1.0" encoding="utf-8"?>
soap:Body
string
/soap:Body
/soap:Envelope
here is my code
var body = '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetCityWeatherByZIP xmlns="http://ws.cdyne.com/WeatherWS/"> <ZIP>string</ZIP> </GetCityWeatherByZIP> </soap:Body>
</soap:Envelope>';
var url = "http://wsf.cdyne.com/WeatherWS/Weather.asmx/GetCityWeatherByZIP";
var Curl = require('node-libcurl').Curl;
curl = new Curl();
curl.setOpt('URL', url);
curl.setOpt('SSL_VERIFYHOST', 0);
curl.setOpt('SSL_VERIFYPEER', 0);
curl.setOpt('HTTPHEADER', [{"Content-Type": 'text/xml'}]);
curl.setOpt('POSTFIELDS', body);
curl.on('end', function (statusCode, body, headers) {
});
curl.on('error', function (error) {
console.log(error);
});
curl.perform();