从 .NET 使用 SAP Web 服务引发异常 ServiceModel.FaultException

Consuming SAP web-service from .NET throws exception ServiceModel.FaultException

我引用 WSDL 文件并向 SAP 网络服务发出请求并得到以下异常

System.ServiceModel.FaultException: Server Error Server stack trace: at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)

at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]:

at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

我可以通过 SOAPUI 中的 WSDL 使用 Web 服务。

我还设置了以下绑定属性。

 var binding = new BasicHttpsBinding
        {
            SendTimeout = TimeSpan.MaxValue,
            MaxReceivedMessageSize = Int32.MaxValue,
            CloseTimeout = TimeSpan.MaxValue,
            OpenTimeout = TimeSpan.MaxValue,
            ReceiveTimeout = TimeSpan.MaxValue,
            MaxBufferPoolSize = Int64.MaxValue
            
        };

我跟踪了来自 fiddler 的 visual studio 请求,并且可以从 SoapUI 执行相同的请求,但是在尝试通过 Visual Studio 进行消费时,发生了异常。

其实我是从头开始解决问题的

响应超过 8mb,请求耗时超过 100 秒。

我在配置文件中进行了以下更改,问题已解决。

    <binding receiveTimeout="00:20:00" sendTimeout="00:20:00"
openTimeout="00:05:00"  closeTimeout="00:05:00"
maxReceivedMessageSize="20000000"  maxBufferSize="20000000" maxBufferPoolSize="20000000" >
<readerQuotas maxDepth="20000000"
                            maxStringContentLength="20000000"
                            maxArrayLength="20000000"
                            maxBytesPerRead="20000000"
                            maxNameTableCharCount="20000000" />
   ....