var oXMLDoc, oXMLHttp, soapRequest, soapResponse;
oXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
oXMLHttp.open("POST", "http://nerdbox/HelloService.svc", false);
// Add HTTP headers
oXMLHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
oXMLHttp.setRequestHeader("SOAPAction", "http://tempuri.org/IHelloService/SayHello");
// Form the message
soapRequest = '<?xml version="1.0" encoding="utf-16"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><SayHello xmlns="http://tempuri.org/"><name>Zuhaib</name></SayHello></soap:Body></soap:Envelope>';
WScript.Echo("Request : " + soapRequest);
oXMLHttp.send(soapRequest);
soapResponse = oXMLHttp.responseXML.xml;
WScript.Echo("Respose : " + soapResponse);
這個JScript有什麼問題?爲什麼我會收到400個錯誤的請求。我讀了類似的線程在stackoverflow ..有人說它的肥皂信息格式問題。400錯誤請求:使用JScript/VBScript消耗WCF basicHttpBinding(Soap)
這是消息看起來像是如果我從提琴手。
實際的服務不是我寫的。我只是想連接。該腳本必須從vbscript或jscript中使用。 Json只是jscript。 – Zuhaib
好的,不要使用JSON ..嘗試發送作爲查詢或形式第一。有可能啓用這些協議。消滅肥皂包是痛苦的,可能是不必要的....看到鏈接文章的早期部分,它涵蓋了該場景.. –
沒關係,我有一個腦屁。你正在輪詢一個WCF服務。對不起...... –