halit emre halit emre - 1 year ago 198
C# Question

Consuming Sap Web Service from .net(Works On Soapui, not in .net)

I reference the wsdl file and make a request to the Sap webservice and get the exception below.

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, following exception occurs.

Any help would be appreciated.

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)

Answer Source

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"
                            maxNameTableCharCount="20000000" />
    <security mode="Transport">
                <transport clientCredentialType="Basic" realm="XISOAPApps" />