简体   繁体   中英

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

I reference the WSDL file and make a request to the SAP web-service and get the exception below

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)

I can consume the web service via WSDL from SOAPUI.

Also I have set the following binding properties.

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

I trace the visual studio request from fiddler and can execute the same request from SoapUI, but while trying to consume through Visual Studio, the exception occurs.

I actually started from scratch and solved the problem.

The response was over 8mb and request was taking over 100 seconds.

I made the following changes in the config file and the problem was solved.

    <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" />
   ....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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