我如何知道WCF服务期望的是什么?
我正在使用Node.js和wcf.js模块(npm安装wcf.js) 我尝试使用的服务是 我已经了解到,这包含了服务希望接收的内容,并且这些内容是要提交给它们的uri 我到底该如何确定我应该如何构造请求? 这是wcf.js给my的示例我如何知道WCF服务期望的是什么?,wcf,node.js,soap,Wcf,Node.js,Soap,我正在使用Node.js和wcf.js模块(npm安装wcf.js) 我尝试使用的服务是 我已经了解到,这包含了服务希望接收的内容,并且这些内容是要提交给它们的uri 我到底该如何确定我应该如何构造请求? 这是wcf.js给my的示例 var BasicHttpBinding = require('wcf.js').BasicHttpBinding , Proxy = require('wcf.js').Proxy , binding = new BasicHttpBinding()
var BasicHttpBinding = require('wcf.js').BasicHttpBinding
, Proxy = require('wcf.js').Proxy
, binding = new BasicHttpBinding()
, proxy = new Proxy(binding, " https://webservice.kareo.com/services/soap/2.1/")
, message = '<Envelope xmlns=' +
'"http://schemas.xmlsoap.org/soap/envelope/">' +
'<Header />' +
'<Body>' +
'<GetData xmlns="http://tempuri.org/">' +
'<value>GetAppointments</value>' +
'</GetData>' +
'</Body>' +
'</Envelope>'
proxy.send(message, "http://www.kareo.com/api/schemas/KareoServices/GetAppointments", function(response, ctx) {
console.log(response)
});
var BasicHttpBinding=require('wcf.js').BasicHttpBinding
,Proxy=require('wcf.js')。Proxy
,binding=new BasicHttpBinding()
,proxy=新代理(绑定)https://webservice.kareo.com/services/soap/2.1/")
,消息=“”+
'' +
'' +
'' +
“获取约会”+
'' +
'' +
''
代理。发送(消息,“http://www.kareo.com/api/schemas/KareoServices/GetAppointments,功能(响应,ctx){
console.log(响应)
});
根据wsdl,此服务使用BasicHttpBinding,这意味着不使用ws-secrutiy或寻址。在这种情况下,除了使用wcf.js之外,wcf.js不会给您带来太多附加值,但您仍然可以使用wcf.js。您需要正确设置3个值—url、soapaction(代理构造函数中的第二个参数)和soap。我建议通过为该服务生成一个c#客户机,验证客户机是否正常工作,然后设置fiddler并将客户机指向“http://localhost:8888“因此,您将在fiddler中看到所有3个值,并可以配置它们。我对wcf.js没有任何经验,但是,如果您只需要了解如何构造soap信封以发出请求,我建议您启动并连接到服务。连接后,您可以调用任何操作并查看soap消息。下面是对GetAppointments操作的空请求
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://www.kareo.com/api/schemas/KareoServices/GetAppointments</Action>
</s:Header>
<s:Body>
<GetAppointments xmlns="http://www.kareo.com/api/schemas/">
<request xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<RequestHeader i:nil="true" />
<Fields i:nil="true" />
<Filter i:nil="true" />
</request>
</GetAppointments>
</s:Body>
</s:Envelope>
http://www.kareo.com/api/schemas/KareoServices/GetAppointments
效果很好!费德勒把我引向正确的方向!现在有没有办法将输出转换成json?或者更清晰地解析它?比如(var i=0;o