网络服务工作javascript但不是.net - “无法连接/主动拒绝”

时间:2012-08-02 18:21:39

标签: .net web-services

从asp.net 2.0调用Web服务并且“无法连接到远程服务器”/“无法建立连接,因为目标计算机主动拒绝它”错误。它适用于简单的html页面和javascript,但不适用于.net

javascript(有效):

var soapEnv = 
          "<soapenv:Envelope                                           " +
          "  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'     " +
          "  xmlns:xsd='http://www.w3.org/2001/XMLSchema'              " +
          "  xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' " +
          "  xmlns:urn='urn:TBEDispatcherAPI'>                         " +
          "  <soapenv:Header/>                                         " +
          "  <soapenv:Body>                                            " +
          "    <urn:getURL soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'> " +
          "      <orgCode xsi:type='xsd:string'>" + CODE + "</orgCode> " +
          "    </urn:getURL>                                           " +
          "  </soapenv:Body>                                           " +
          "</soapenv:Envelope>                                         ";

     xmlDoc = new ActiveXObject("Microsoft.XMLHTTP");
     xmlDoc.onreadystatechange = process ;   
     xmlDoc.open( "POST", URL, true );     
     xmlDoc.setRequestHeader("Content-Type", "text/xml; charset=\"utf-8\"");
     xmlDoc.setRequestHeader("SOAPAction", '""');
     xmlDoc.send(soapEnv);

达网络:

DispatcherAPI.DispatcherAPIService dispatcher = new DispatcherAPI.DispatcherAPIService();
dispatcher.Url = URL;
string otherURL = dispatcher.getURL(CODE);

id猜测javascript版本中设置的值之一 - soapaction,content-type,method - 在.net版本中没有设置,但我真的不知道是什么或如何。也可能是.net使用的不同端口?不知道

0 个答案:

没有答案