2011-12-27 13 views
5

aspxページからサーバーでホストされているWebサービスを呼び出すときに、「要求が空の応答で失敗しました。Webサービスを呼び出すときに「空の応答で要求が失敗しました」

私のページのコード

try { 
    HttpWebRequest request1 = (HttpWebRequest)WebRequest.Create("https://login.erp.com/rodeprovisioning/provisioning.asmx"); 
    request1.Accept = "text/xml"; 
    request1.Method = "POST"; 
    WebProxy proxyObject = new System.Net.WebProxy("http://10.0.0.1:8080/", true); 
    request1.Proxy.Credentials = CredentialCache.DefaultCredentials; 
    string sReturnValue = null; 
    if (string.IsNullOrEmpty(Session["Test"])) { 
     sReturnValue = callservice(); 
     if (sReturnValue == "Success") { 
      ErrorLabel.Text = sReturnValue; 
      Session["Test"] = "True"; 
     } else { 
      ErrorLabel.Text = sReturnValue; 
     } 
    } 

} catch (Exception ex) { 

} 

とweb.configファイルで

<system.net> 
    <authenticationModules> 
     <add type = "System.Net.DigestClient" /> 
     <add type = "System.Net.NegotiateClient" /> 
     <add type = "System.Net.KerberosClient" /> 
     <add type = "System.Net.NtlmClient" /> 
     <add type = "System.Net.BasicClient" /> 
    </authenticationModules> 
    <connectionManagement> 
     <add address = "*" maxconnection = "2" /> 
    </connectionManagement> 
    <defaultProxy> 
     <proxy usesystemdefault="True" bypassonlocal = "True" /> 
    </defaultProxy> 
    <webRequestModules> 
     <add prefix = "http" type = "System.Net.HttpRequestCreator"  /> 
     <add prefix = "https" type = "System.Net.HttpRequestCreator"  /> 
     <add prefix = "file" type = "System.Net.FileWebRequestCreator"   /> 
    </webRequestModules> 
    </system.net> 

それは、ファイアウォールproblem.Anyの提案ですか?

+1

HTTPレベルで何が起こっているかを知るためにWiresharkを試しましたか? –

+0

jon私havent ... – bala3569

+4

それから私はあなたの次のステップであることをお勧めします。サーバー側の問題の場合はクライアントをデバッグしようとすることには意味がありません。 –

答えて

15

私はこれが古い質問ですけど、私たちは、統合環境の1つで起こっ同じ例外があった:

System.Net.WebException: The request failed with an empty response 

問題は、我々は、サーバーのハードウェアをアップグレードしたときに、我々はまた、私たちのすべてを切り替えるということでしたHTTPSを使用しているエンドポイント。エンドポイントを呼び出すコードはアップグレードされていないため、通常のHTTPを使用していました。どうやら、HTTPSサービスをHTTPとして呼び出そうとすると、これは例外です。これが誰かを助けることを願っています。

+0

それは2年後に私を助けました!ありがとう! – UrsulRosu

-2

クライアントapp.configまたはweb.configでは、最初にWebサービスURLをチェックします.SSLファイルがあるWebサービスURLであれば、同じSecure Sockets Layer有効URLをapp.configまたはweb.configに追加します。この「https://crm.XXXX.com/webServiceName.asmx

System.Net.WebExceptionのように:要求は、私はAndaciousが述べたものに追加したいと思い、空の応答

4

で失敗しました。私はhttpsのWebサービスを呼び出していましたが、呼び出しを行っているオブジェクトのプロパティを見たときに実際にhttpを使用していました。だから私は特にURLプロパティを設定します。

私はSoapHttpClientProtocolから継承するインターチェンジと呼ばれるクラスを持っています。

interchangeWS = new InterchangeWS(); 
interchangeWS.Url = "https://somesite/interchange.asmx"; 

string x = interchangeWS.SomeMethod("someParameter"); 
関連する問題