Changing Web Reference attributes

thumbs_up_ico0thumbs_down_ico0
Hello -

I am in a bit of a jam. I have a Web service that I am consuming from Service Studio. This Web service needs to have a lot of text sent to it, much more than .NET's default of 8192 bytes. However, there is no (obvious) way to make this change. In an ordinary .NET app, I would just edit the Web.config and fix the binding's attributes. Digging through the code that Service Studio produced, it is creating the code to access the Web service without using Web.config. If it was using Web.config, I would use the FactoryConfiguration system to modify the values, but it isn't.

So, how do I change the parameters that the Web reference uses? Or, will I just have to do this in Integration Studio and custom code it myself?

Thanks!

J.Ja
thumbs_up_ico0thumbs_down_ico0
Hi Justin,

I've seen web references in Service Studio sending and receiving strings with more than 8192 bytes.
After googling for this I've only found references to this error in WCF web services.
Is this what you are trying to consume? What is the error you are getting?

Cheers,
Tiago Simões
thumbs_up_ico0thumbs_down_ico0
Hi Justin,

I think that the place where you've to change the configuration is actually in the web service that you are consuming.

I've created a test WCF service in Visual Studio with a method receiving a string, and then called it from an eSpace passing along a large (>20K) string. This resulted in the following exception during the method invocation:

The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'ProcessLongString'. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 275, position 16.

This message is a bit misleading, because it seems that the error is occurring in the client side while in fact it is coming from the WCF service.

I then manually changed the web.config in the WCF service by adding the required binding (Visual Studio doesn't add it by default) and a suitable MaxStringContentLength value.


Could you check if this applies to your scenario?

Thanks,
Hugo Lourenço

thumbs_up_ico0thumbs_down_ico0
Yes, it is a WCF service. I was changing the on the server side, but still receiving the error on the client side. When consuming a WCF service, you actually need to change the setting on both sides of the connection, if you are connecting to it as a WCF service (as opposed to a Web Service). After doing some work, I was able to find out why the service side was still throwing the error even though I had changed the settings. So the original problem is fixed.

But, I have a new problem, unfortunately. The service is returning results, but my application is not receiving them. I have tested this with the service running locally and stepping through it in debugger mode, and I have tested it with VS 2010's Web Service testing system, it is definitely generating the correct output. But when I step through it in Service Studio, even though the Web service provides results, the application is getting nothing back in the Out1 output variable.

Any ideas?

Thanks!

J.Ja
thumbs_up_ico0thumbs_down_ico0
Hi,

It seems Service Studio is incorrectly importing some WCF web services. I've managed to reproduce your problem with a simple service with the following methods:

        [OperationContract]
        string GetString();

        [OperationContract]
        int  GetInt();

When you import it into Service Studio, GetString is represented incorrectly but GetInt is OK. The problem is that the output parameter that represents GetString's result is being named "Out1" instead of "GetStringResult" (which is what is declared in the SOAP response definition).

At a first glance this seems to affect only the result when it is of a reference type. Parameters are not affected by this, and old-style (i.e., non WCF) web services are also OK. 

As a workaround, and assuming that you may change the WCF service,  I suggest that you alter the method signature to:

        [OperationContract]
        void GetString(out string result);

Then change the implementation accordingly and refresh the web service in Service Studio.

In the meantime I'll submit this issue to our maintenance team.

Hope this helps,
Hugo Lourenço



thumbs_up_ico0thumbs_down_ico0
Hugo -

You are a magician, thanks! That solved the problem, even though I had a much more complex signature than that, changing it to be an out parameter instead of a return result did the trick.

J.Ja
thumbs_up_ico0thumbs_down_ico0
Hi To All,

i have also the same problem.

 i need to pass xml as a string value  to my wcf service but when my string size exceed more than 9.12 kb it gives exception  up to 9.12 kb it is working fine.

my wcf service calling through routing4.0 using endpoint name filter.

the web config file of wcf service as follows :
<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IWorkflowService" closeTimeout="00:01:00"
          openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost/EISWorkflow/EISWorkflow.xamlx"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWorkflowService"
        contract="EISWorkflowReference.IWorkflowService" name="BasicHttpBinding_IWorkflowService" />
    </client>
    <behaviors>
      <serviceBehaviors>
        <behavior name="SmartOfficeServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>

      <service name="Ebix.EIS.EISService.SmartOfficeService" behaviorConfiguration="SmartOfficeServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost/SmartOfficeService"/>
          </baseAddresses>
        </host>
        <endpoint address="" binding="basicHttpBinding" contract="Ebix.EIS.ServiceInterfaceLayer.Contract.IClient"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

exception is as follows.

<Fault xmlns="http://schemas.microsoft.com/ws/2005/05/envelope/none"><Code><Value>Receiver</Value><Subcode><Value xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</Value></Subcode></Code><Reason><Text xml:lang="en-US">The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'ProcessMessage'. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 11225.</Text></Reason><Detail><ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'ProcessMessage'. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 11225.</Message><StackTrace>
Server stack trace:
   at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc&amp; 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&amp; msgData, Int32 type)
   at Ebix.EIS.ServiceInterfaceLayer.Contract.IClient.ProcessMessage(String requestxml)
   at Ebix.EIS.EISService.EISRESTService.ProcessMessage(Message request) in D:\Projects\EBIX-EIS\SourceCode\Ebix.EIS\Ebix.EIS\Ebix.EIS.EISService.RESTService\Process.svc.cs:line 94
   at SyncInvokeProcessMessage(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc&amp; rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp; rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp; rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&amp; rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&amp; rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc&amp; rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&amp; rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.ServiceModel.ProtocolException</Type></ExceptionDetail></Detail></Fault>

Please Suggest me soon
thumbs_up_ico0thumbs_down_ico0
Hi Aishraj, and welcome to the OutSystems community forums.

I am not really sure if you are discussing the same problem as Justin, since it would seem to me that you are invoking the webservice directly in ASP.NET. In this community we specialize in developing web applications using the OutSystems Agile Platform, so even though we do interact with other systems and languages, it's very unlikely that you'll find many people here who will know precisely how to solve your specific situation.

That being said, if you are having trouble invoking it in OutSystems, do attach your eSpace here so that others can look into it and figure out what's wrong.

I hope this helps, and good luck with your project.

Regards,

Paulo Tavares
thumbs_up_ico0thumbs_down_ico0
Hi To All,

Thanks for Support me, actually i find out my little mistake in web config file regarding binding configuration.

Actually i am calling multiple services so that in my web.config file  in between multiple end points i miss one of them service of without maximizing the size using binding configuration.

So Now i resolve that exception " The maximum string content length quota (8192) has been exceeded"

I Need To know one more thing if i  am consuming the work flow 4.0 then i can able to increase its reader quota size at client end but how can i increase its size in worflow service, actually its working by default without defining end point at service end.

Client web config file :


<basicHttpBinding>
        <binding name="BasicHttpBinding_IWorkflowService" closeTimeout="00:01:00"
          openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="104857600" maxBufferPoolSize="2147483647" maxReceivedMessageSize="104857600"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="104857600"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding> 
</basicHttpBinding>
 </bindings>
    <client>
      <endpoint address="http://localhost/EISWorkflow/EISWorkflow.xamlx"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWorkflowService"
        contract="EISWorkflowReference.IWorkflowService" name="BasicHttpBinding_IWorkflowService" />
    </client>
  </system.serviceModel>

Work Flow Service Web.Config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>


  <system.web>
    
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
 
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
       
          <serviceMetadata httpGetEnabled="true"/>
     
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>


Thanks in Advance
Aishraj Sharma
thumbs_up_ico0thumbs_down_ico0
Hi Aishraj,

I'm glad to hear you've solved part of your problem. However, I'm not sure anyone here will be able to help you without looking into your eSpace or XIF extension.

Can you attach your OML or XIF file here so someone can take a look at it in our Service Studio or Integration Studio?

If you are not using the OutSystems Agile Platform, I am really skeptical about you being able to find someone here who has been through the exact same problem as you, so it'll be hard to figure out what the problem is.

Regards,

Paulo Tavares