简体   繁体   English

Web服务客户端超时

[英]Time out webservice client

First sorry for my english. 首先对不起我的英语。

I am having issues with a web service, this is provided by a client and sadly I cant change anything and they are refusing anyways, now they consume this webservice with java but in my work thats not posible. 我在网络服务方面遇到问题,这是由客户端提供的,可悲的是我无法更改任何内容,他们仍然拒绝,现在他们使用Java来使用此网络服务,但是在我的工作中这是不可能的。

With the following code I can retrive a response up to 8k but anything beyond that get me a "timeoutexception", I have try to use a stream a string to save the response. 通过下面的代码,我可以检索最多8k的响应,但超出此范围的任何内容都会使我收到“ timeoutexception”,我尝试使用流字符串保存响应。 I am fairly new to webservices so I maybe missing something. 我是Web服务的新手,所以我可能会缺少一些东西。

public String obtenerData(int idCuestionario, string fechaInicio, string fechaFinal, string path)
{
  try
  {

    String request = "<request><token><![CDATA[" + Globals.token + "]]></token>" +
              "<idCuest><![CDATA[" + idCuestionario + "]]></idCuest>" +
              "<fechaInit><![CDATA[" + fechaInicio + "]]></fechaInit>" +
              "<fechaFin><![CDATA[" + fechaFinal + "]]></fechaFin>" +
              "</request>";

    response = (string)(wsRep.generaReporte(request));

    try
    {
      doc.LoadXml(response);
      if (String.IsNullOrEmpty(path))
      {
        doc.Save(idCuestionario + "_" + ".xml");
      }
      else
      {
        doc.Save(path + "\\" + idCuestionario + "_" + ".xml");
      }

    }
    catch (Exception ex)
    {
      MessageBox.Show(ex.Message);
    }
    Globals.token = Globals.tokenK.obtenerToken(response);
  }

} }

And this is the web.config 这是web.config

<binding name="ReportesWebServiceSoapBinding" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="Transport">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>

Have you tried increasing the timeout? 您是否尝试过增加超时时间?

eg 例如

wsRep.Timeout = 20000; // 20 second

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM