tags:

views:

403

answers:

3

Hi All, I have a long xml file the content of the file are below:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    <s:Header>
        <a:Action s:mustUnderstand="1">http://example.org/person&lt;/a:Action&gt;
    </s:Header>
    <s:Body>
        <OrderDataBDO xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.datacontract.org/2004/07/BasWare.OM.BusinessDataObjects"&gt;
            <selected i:type="x:boolean" xmlns="">false</selected>
            <isSaved i:type="x:boolean" xmlns="">false</isSaved>
            <metadata i:nil="true" xmlns=""/>
            <hasUnsavedValues i:type="x:boolean" xmlns="">false</hasUnsavedValues>
            <hasChanged i:type="x:boolean" xmlns="">false</hasChanged>
            <defaultResourceId i:type="x:string" xmlns="">BWRc.OM.BUSINESSOBJECTS.ORDERDATABDO.ORDER_DATA</defaultResourceId>
            <_x0031_ xmlns:d4p1="http://schemas.datacontract.org/2004/07/BasWare.ProductFramework.BDOFramework" i:type="d4p1:ADate" xmlns="">
                <_x0031_ i:type="x:boolean">false</_x0031_>
                <_x0032_ i:type="x:boolean">false</_x0032_>
                <_x0033_ i:type="x:boolean">false</_x0033_>
                <_x0034_ i:nil="true"/>
                <_x0035_ i:type="x:boolean">true</_x0035_>
                <_x0036_ i:type="x:dateTime">1753-01-01T12:00:00</_x0036_>
                <_x0037_ i:type="x:string">d</_x0037_>
                <_x0038_ i:type="x:string">ActualDeliveryDate</_x0038_>
            </_x0031_>
            <_x0032_ xmlns:d4p1="http://schemas.datacontract.org/2004/07/BasWare.ProductFramework.BDOFramework" i:type="d4p1:AString" xmlns="">
                <_x0031_ i:type="x:boolean">false</_x0031_>
                <_x0032_ i:type="x:boolean">false</_x0032_>
                <_x0033_ i:type="x:boolean">false</_x0033_>
                <_x0034_ i:nil="true"/>
                <_x0035_ i:type="x:boolean">true</_x0035_>
                <_x0036_ i:type="x:string"/>
                <_x0037_ i:nil="true"/>
                <_x0038_ i:type="x:string">BuyerCode</_x0038_>
            </_x0032_>
            <_x0033_ xmlns:d4p1="http://schemas.datacontract.org/2004/07/BasWare.ProductFramework.BDOFramework" i:type="d4p1:AID" xmlns="">
                <_x0031_ i:type="x:boolean">false</_x0031_>
                <_x0032_ i:type="x:boolean">false</_x0032_>
                <_x0033_ i:type="x:boolean">false</_x0033_>
                <_x0034_ i:nil="true"/>
                <_x0035_ i:type="x:boolean">true</_x0035_>
                <_x0036_ i:type="x:string"/>
                <_x0037_ i:nil="true"/>
                <_x0038_ i:type="x:string">BuyerId</_x0038_>
            </_x0033_>
            <!--etc-->
            <_x0034_6 xmlns:d4p1="http://schemas.datacontract.org/2004/07/BasWare.ProductFramework.BDOFramework" i:type="d4p1:AMoney" xmlns="">
                <_x0031_ i:type="x:boolean">false</_x0031_>
                <_x0032_ i:type="x:boolean">false</_x0032_>
                <_x0033_ i:type="x:boolean">false</_x0033_>
                <_x0034_ i:nil="true"/>
                <_x0035_ i:type="x:boolean">true</_x0035_>
                <_x0036_ i:type="x:decimal">0</_x0036_>
                <_x0037_ i:type="x:string">N2</_x0037_>
                <_x0038_ i:type="x:string">TaxSum</_x0038_>
            </_x0034_6>
            <_x0034_7 xmlns:d4p1="http://schemas.datacontract.org/2004/07/BasWare.ProductFramework.BDOFramework" i:type="d4p1:AString" xmlns="">
                <_x0031_ i:type="x:boolean">false</_x0031_>
                <_x0032_ i:type="x:boolean">false</_x0032_>
                <_x0033_ i:type="x:boolean">false</_x0033_>
                <_x0034_ i:nil="true"/>
                <_x0035_ i:type="x:boolean">true</_x0035_>
                <_x0036_ i:type="x:string"/>
                <_x0037_ i:nil="true"/>
                <_x0038_ i:type="x:string">Text1</_x0038_>
            </_x0034_7>
            <_x0034_8 xmlns:d4p1="http://schemas.datacontract.org/2004/07/BasWare.ProductFramework.BDOFramework" i:type="d4p1:AString" xmlns="">
                <_x0031_ i:type="x:boolean">false</_x0031_>
                <_x0032_ i:type="x:boolean">false</_x0032_>
                <_x0033_ i:type="x:boolean">false</_x0033_>
            </_x0034_8>
        </OrderDataBDO>
    </s:Body>
</s:Envelope>
A: 

Change your Max Message Size (for example, depending on your binding) on the client and server as described here.

Something else may be going wrong. Can you enable tracing for WCF and use the trace log viewer to narrow down the exception?

JP Alioto
i have changed the settings as below : <readerQuotas maxDepth="100" maxStringContentLength="33200" maxArrayLength="33178" maxBytesPerRead="10000" maxNameTableCharCount="33178" />but still the same error.
Praveen
That's just over 30k of data - not extremely high values.....
marc_s
even with 2147483647 value it's not working.
Praveen
+2  A: 

You need to set various of your settings - play around with the values, and see which work.

First, use whatever binding you're using and tweak the <readerQuotas> (maxStringContentLength, maxArrayLength, maxNameTableCharCount) - if that works, fine!

  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="LargeMessages">
          <readerQuotas maxDepth="32"
            maxStringContentLength="2147483647"
            maxArrayLength="2147483647"
            maxBytesPerRead="4096"
            maxNameTableCharCount="2147483647" />
        </binding>
      </wsHttpBinding>
    </bindings>
  </system.serviceModel>

If that doesn't solve your problem, you'll need to create your own custom binding in config, and set the limits on the message level as well - something like this:

  <system.serviceModel>
    <bindings>
      <customBinding>
        <binding name="ExtraLargeMessages">
          <textMessageEncoding>
            <readerQuotas maxDepth="32"
              maxStringContentLength="2147483647"
              maxArrayLength="2147483647"
              maxBytesPerRead="4096"
              maxNameTableCharCount="2147483647" />
          </textMessageEncoding> 
          <httpsTransport 
              maxBufferPoolSize="1048576"
              maxReceivedMessageSize="1048576"
              maxBufferSize="1048576"/>
        </binding>
      </customBinding>
    </bindings>
  </system.serviceModel>

Hope this helps.

Marc

UPDATE:
I would tryto add this behavior to your service, and then call the method again.

  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DetailedDebug" >
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="yourService" behaviorConfiguration="DetailedDebug">
        .....
      </service>
    </services>
  </system.serviceModel>

You should now get detailed exception info on your client - can you tell us what it is?? Maybe it's something totally different.......

Marc

marc_s
thanks marc_s , i tried all the settings but it doesn't work.
Praveen
updated with "serviceDebug" behavior to find out what the error REALLY is.
marc_s
A: 

Maybe it's the number of objects: try adding something like this

  <serviceBehaviors>
    <behavior name="PutTheNameOfYourBehaviorHere">
      <dataContractSerializer maxItemsInObjectGraph="10000000" />
    </behavior>
  </serviceBehaviors>

to your config file.

Giulio Vian
thanks Giulio , Giulio can u pls create a sample wcf app with one method which takes one string parameter and prints it. Then from client please pass the above xml which i have posted , and call the method on service , u will see the exception and maybe will have more idea about my prob. Please try it.
Praveen
following is the message: The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter tempuri.org/:msg. The InnerException message was 'There was an error deserializing the object of type System.IO.MemoryStream. The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 44708.'. Please see InnerException for more details.
Praveen