3

我已将第三方 Web 服务与我的 Web 应用程序连接起来,它在localhost中运行良好。但是在我将项目上传到服务器后,它显示以下错误。

A connection attempt failed because the connected party did not properly respond after a   period of time, or established connection failed because connected host has failed to respond 100.100.100.100:9090

这是我的肥皂请求:

  StringBuilder soapmsg = new StringBuilder();
    soapmsg.Append("<?xml version='1.0' encoding='UTF-8'?>");
    soapmsg.Append("<soap:Envelope xmlns='http://www.opentravel.org/OTA/2003/05'   xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:wsse='http://schemas.xmlsoap.org/ws/2002/12/secext'>");
    soapmsg.Append("<soap:Body><OTA_AirLowFareSearchRQ EchoToken='' SequenceNmbr='0' TransactionIdentifier='0' Version='1.001' xmlns='http://www.opentravel.org/OTA/2003/05' DirectFlightsOnly='false'>");
    soapmsg.Append("<POS xmlns='http://www.opentravel.org/OTA/2003/05'><Source AgentSine='' PseudoCityCode='NPCK' TerminalID='1'><RequestorID ID='AFFILIATE'/></Source><YatraRequests><YatraRequest AffiliateID='YTFABTRAVEL' MidOfficeAgentID='' AgentEmailID='' Destination='' AgentTypeCode='' Description='' DoNotCache='false' DoNotHitCache='true' IsYatraAgent='' LastResultFromCache='true' RequestType='"+di+"' YatraRequestTypeCode='SMPA'/></YatraRequests></POS>");
    soapmsg.Append("<OriginDestinationInformation>");
    soapmsg.Append("<DepartureDateTime WindowAfter='" + flexi + "' WindowBefore='" + flexi + "'>" + date + "</DepartureDateTime>");
    soapmsg.Append("<OriginLocation CodeContext='IATA' LocationCode='" + origin + "'>'" + origin + "'</OriginLocation>");
    soapmsg.Append("<DestinationLocation CodeContext='IATA' LocationCode='" + destination + "'>'" + destination + "'</DestinationLocation>");
    soapmsg.Append("</OriginDestinationInformation>");
    soapmsg.Append("</OTA_AirLowFareSearchRQ></soap:Body></soap:Envelope>");

    HttpWebRequest request = (HttpWebRequest)WebRequest.CreateDefault(new Uri(@"http://100.100.100.100:9090/services/spm/spm"));
    request.ContentType = "text/xml; charset=utf-8";
    request.Method = "POST";
    request.Accept = "text/xml";
    request.Headers.Add("SOAPAction", @"http://100.100.100.100:9090/services/spm/spm");
    StreamWriter writer = new StreamWriter(request.GetRequestStream(), Encoding.UTF8);
    writer.Write(soapmsg);
    writer.Flush();
    writer.Close();

    using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
    {
        XNamespace ns = "http://www.opentravel.org/OTA/2003/05";
        XDocument xd = XDocument.Load(response.GetResponseStream());
     }        


  **The following exception i got after i tried to connect the web service:**

    SocketException (0x274c): A connection attempt failed because the connected party     did not properly respond after a period of time, or established connection failed because connected host has failed to respond 100.100.100.100:9090]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddresssocketAddress) +251System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4,  Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout,   Exception& exception) +279

我已经搜索了很多。我是网络服务的新手。 如果您需要更多信息,请告诉我。 提前致谢,

4

0 回答 0