作者:先森还爱么z | 来源:互联网 | 2023-06-04 16:39
iamtryingtosubmitaxmlrequesttoawebserviceviaNode.jsusinghttp.request.我正在尝试使用http.req
i am trying to submit a xml request to a web service via Node.js using http.request
.
我正在尝试使用http.request通过Node.js向Web服务提交xml请求。
Here is my code. My issue is that instead of data=1
i want to post xml to the service.
这是我的代码。我的问题是,我想将xml发布到服务而不是data = 1。
http.request({
host: 'service.x.yyy.x',
port: 80,
path: "/a.asmx?data=1",
method: 'POST'
}, function(resp) {
console.log(resp.statusCode);
if(resp.statusCode) {
resp.on('data', function (chunk) {
console.log(chunk);
str += chunk;
});
resp.on('end', function (chunk) {
console.log(str);
});
}
}).end();
Ho to do this?
何要这样做?
2 个解决方案