The size of the message being read exceeds the quota of 65536 (0x10000) bytes.
- Hello all
I need some help please for a problem that I face while using Windows Web Services APIs.
After converting my wsdl to a C code, I succeed in creating the proxy, opening it on the url but while calling the web service I get the following error:
"Failed to create an heap object
Failure errorCode=0x803d0008
There was an error communicating with the endpoint at 'URL'.
The size of the message being read exceeds the quota of 65536 (0x10000) bytes. "
Here is the line of my code where I create the heap :
<!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-alt:"Calisto MT"; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-alt:"Times New Roman"; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman";} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:10.0pt; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt;} @page Section1 {size:612.0pt 792.0pt; margin:70.85pt 70.85pt 70.85pt 70.85pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} -->hr = WsCreateHeap(/*maxSize*/ 65536, /*trimSize*/ 512, NULL, 0, &heap, error);
It seems like the output message sent by the Webservice is too big to enter in the heap.
Please note that when use WireShark, the answer seems to be the correct one.
How can I make the size of the heap bigger?
Does anyone face a similar issue? Is there anything related with channel creation ?
Thanks a lot
Answers
- I am afraid I do not know why altsoap was ignoring some errors. You should update WSDL that you use to match the data on the wire - this should solve your problems.
- Marked As Answer byBob38 Wednesday, November 18, 2009 10:03 AM
All Replies
- The heap you pass into the call is for deserializing the response. You can increase the max size of that heap, but it seems that your failure occurs during send, in which case you may need to set a bigger value for channel property WS_CHANNEL_PROPERTY_MAX_BUFFERED_MESSAGE_SIZE. To learn how to set channel properties at service proxy, you can take a look at the client code in this sample: http://msdn.microsoft.com/en-us/library/dd815348(VS.85).aspx.
- Hello
Thanks for the answer!
I changed the call when creating the proxy as follow:
WS_CHANNEL_PROPERTY channelProperties[3];
WS_ADDRESSING_VERSION addressingVersion = WS_ADDRESSING_VERSION_TRANSPORT;
channelProperties[0].id = WS_CHANNEL_PROPERTY_ADDRESSING_VERSION;
channelProperties[0].value = &addressingVersion;
channelProperties[0].valueSize = sizeof(addressingVersion);
WS_ENVELOPE_VERSION envelopeVersion = WS_ENVELOPE_VERSION_SOAP_1_1;
channelProperties[1].id = WS_CHANNEL_PROPERTY_ENVELOPE_VERSION;
channelProperties[1].value = &envelopeVersion;
channelProperties[1].valueSize = sizeof(envelopeVersion);
ULONG maxMessageSize = 20000000;
channelProperties[2].id = WS_CHANNEL_PROPERTY_MAX_BUFFERED_MESSAGE_SIZE;
channelProperties[2].value = &maxMessageSize;
channelProperties[2].valueSize = sizeof(maxMessageSize);
hr = WsCreateServiceProxy(
WS_CHANNEL_TYPE_REQUEST,
WS_HTTP_CHANNEL_BINDING,
NULL,
NULL,
0,
channelProperties,
WsCountOf(channelProperties),
&proxyWebServices,
error);
and now I have another error :
An error occurred at row 1, column 321 (0x141).
An end element was expected.
A start element with the name 'nodeTypes' and namespace 'http://....'
was found, but not expected.
This error is, I guess, due to reading the deserialized xml.
previoulsy, I was using the CreateProxy method automatically generated by wsutil which do not call WsCreateServiceProxy but WsCreateServiceProxyFromTemplate.
Is there any difference between these two methods?
For the new error I m getting, is there any advice?
Thanks - Hey,
You are correct, the error occurs in XML deserialization. For that particular issue, whether you call WsCreateServiceProxy or WsCreateServiceProxyFromTemplate should not matter.
The error means that the structures used to describe the XML do not match the actual XML. Assuming you use tool-generated structures, some potential reasons are using the wrong serialization structures or the server having updated its WSDL after you downloaded it.
Axel - Hi Axel,
Thanks for the reply.
I don't think that the server has updated its WSDL because i re-checked it and it's still the same one.
But it's probably because I am missing some serialization structures when calling the webservices.
Actually, I was wondering about how I can check the use of these structures automatically generated by wsutil
for example, in the generated .c file, I find :
WS_XML_STRING_DICTIONARY_VALUE("nodeTypes",&MetaData_xmlLocalDefinitions.dictionary.dict, 33),
and my error is related to
An error occurred at row 1, column 321 (0x141).
An end element was expected.
A start element with the name 'nodeTypes'
Is there any clue on how I can check the call and the intialization of WS_DICTIONARY ?
Thanks a lot
- To isolate issues, can you switch to use *_CreateServiceProxy function generated by wsutil and only set the channel property WS_CHANNEL_PROPERTY_MAX_BUFFERED_MESSAGE_SIZE in the binding template? This would eliminate issues caused by setting mismatching envelope version and addressing version.
If you still see the same problem and you are sure that the client stub code is from the latest server WSDL and XSD files, can you please share out the XSD files (ipecifically the portion that defines and references nodeTypes)?
Thanks,
Hao - Hi
Thanks for the answer.
I already did a trial by changing the code generated by wsutil.
Basically, in the existing C file I have the following structure that defines the binding template :
struct // SoapBinding
{
WS_ENCODING encoding;
WS_ADDRESSING_VERSION addressingVersion;
WS_ENVELOPE_VERSION envelopeVersion;
WS_CHANNEL_PROPERTY channelPropertiesArray[3];
} SoapBinding;
and later on we define the contents of this structure as follow:
{
WS_ENCODING_XML_UTF8,
WS_ADDRESSING_VERSION_TRANSPORT,
WS_ENVELOPE_VERSION_SOAP_1_1,
{ // channelPropertiesArray
{
WS_CHANNEL_PROPERTY_ENCODING,
(void*)&LocalDefinitions.SoapBinding.encoding,
sizeof(LocalDefinitions.SoapBinding.encoding),
},
{
WS_CHANNEL_PROPERTY_ADDRESSING_VERSION,
(void*)&LocalDefinitions.SoapBinding.addressingVersion,
sizeof(LocalDefinitions.SoapBinding.addressingVersion),
},
{
WS_CHANNEL_PROPERTY_ENVELOPE_VERSION,
(void*)&LocalDefinitions.SoapBinding.envelopeVersion,
sizeof(LocalDefinitions.SoapBinding.envelopeVersion),
},
},
}
So I change it to :
struct // SoapBinding
{
WS_ENCODING encoding;
WS_ADDRESSING_VERSION addressingVersion;
WS_ENVELOPE_VERSION envelopeVersion;
ULONG maxChannelSize;
WS_CHANNEL_PROPERTY channelPropertiesArray[4];
} SoapBinding;
and alter on we define the contents of this structure as follow:
{
WS_ENCODING_XML_UTF8,
WS_ADDRESSING_VERSION_TRANSPORT,
WS_ENVELOPE_VERSION_SOAP_1_1,
20000000,
{ // channelPropertiesArray
{
WS_CHANNEL_PROPERTY_ENCODING,
(void*)&LocalDefinitions.SoapBinding.encoding,
sizeof(LocalDefinitions.SoapBinding.encoding),
},
{
WS_CHANNEL_PROPERTY_ADDRESSING_VERSION,
(void*)&LocalDefinitions.SoapBinding.addressingVersion,
sizeof(LocalDefinitions.SoapBinding.addressingVersion),
},
{
WS_CHANNEL_PROPERTY_ENVELOPE_VERSION,
(void*)&LocalDefinitions.SoapBinding.envelopeVersion,
sizeof(LocalDefinitions.SoapBinding.envelopeVersion),
},
{
WS_CHANNEL_PROPERTY_MAX_BUFFERED_MESSAGE_SIZE,
(void*)LocalDefinitions.SoapBinding.maxChannelSize,
sizeof(LocalDefinitions.SoapBinding.maxChannelSize),
},
},
}
After these modifications, the problem of the heap size appears again.
I realized that when calling this structure as a parameter of CreateServiceProxyFromTemplate (generated by wsutil), channelProperties has a propertyCount equal to 3. But it should be 4 since we add the new binding parameter WS_CHANNEL_PROPERTY_MAX_BUFFERED_MESSAGE_SIZE.
By debugging, I can impose the value of propertyCount to 4 but then I still have the same error when calling the webservice:
An error occurred at row 1, column 321 (0x141).
An end element was expected.
A start element with the name 'nodeTypes'
Here are my questions :
- What can be wrong in my modifications?
- How is the propertyCount calculated ?
Thanks a lot
Thanks for the explanation. We do not recommend users to change the code generated by wsutil.exe. The generated C code is not layed out for readability and therefore it is very error prone to change it. In most cases you can change the settings by specifying properties to the generated functions or WWSAPI functions. In your case, you can specify WS_CHANNEL_PROPERTIES in your binding template (e.g. WS_HTTP_BINDING_TEMPLATE), which is the first parameter in the generated *_CreateServiceProxy function.
To troubleshoot your problem, can you please tell us the version of the WWSAPI runtime (WebServices.dll) and the version of WsUtil.exe you use?
Regarding your two questions above, the channel property count 3 is hardcoded in the generated C code. In addition to the code you added above, you also need to update that count. Then again, it's not a good idea to change the generated code.- Hello
Thanks for the answer.
I am using the version(webservices.dll and wsutil) of the 4/17/2009.
I succeed to pass the argument in the binding template (WS_HTTP_BINDING_TEMPLATE) but I m still facing the same issue when calling the webservice:
same error :
An error occurred at row 1, column 321 (0x141).
An end element was expected.
A start element with the name 'nodeTypes'
- One more information:
The output message contains two imbricated nodeTypes structures in the xml:
Basically in the reponse, the structure is as follow:
<nodeTypes>
<nodeTypes> <--- Problem here (expecting to close the first nodeTypes)
.....
</nodeTypes>
</nodeTypes>
Is there any problem with deserializing these kind of structures?
thanks a lot - Can you please share out the XML schema for the nodeTypes element and its type? WsUtil does support recursive structures.
- Hello
I am not sure to get your answer. Do you mean that WsUtil does not support recursive structures?
should i give you an example of the wsdl ? or of the reponse to the webservice call?
I will give you the XML schema of the webservice reponse :
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getexampleResponse xmlns="http://">
<getexampleReturn>
<nodeTypes>
<nodeTypes> <--- Problem
<attributeDefinitions xsi:nil="true"/>
<thumbnailPath xsi:nil="true"/>
</nodeTypes>
<nodeTypes>
<attributeDefinitions>
<attributeDefinitions>
<basicName>Type</basicName>
<type>string</type>
<values xsi:nil="true"/>
</attributeDefinitions>
</attributeDefinitions>
</nodeTypes>
</nodeTypes>
<relationTypes xsi:nil="true"/>
</getexampleReturn>
</getexampleResponse>
</soapenv:Body>
</soapenv:Envelope>
Moreover in the generated files via wsutil, nodeTypes has a type WS_FIELD_DESCRIPTION.
Thanks a lot - WsUtil supports recursive structures. Can you share WSDL/XSD files you used as an input to the wsutil.exe?
- Hello
Here is a part of the wsdl that I used to generate the C code with wsutil:
<complexType name="NodeType">
<sequence>
<element name="parentName" nillable="true" type="xsd:string"/>
<element name="attributeDefinitions" nillable="true" type="AttributeDefinition"/>
</sequence>
</complexType>
<complexType name="NodeType">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="NodeType"/>
</sequence>
</complexType>
Thanks a lot - I think the Schema you provided is incorrect, as it has two global types with the same name. I would say that it is a bug in wsutil - the tools should not allow such definition.
I would change your definition to something like this:
<complexType name="NodeType">
<sequence>
<element name="parentName" nillable="true" type="xsd:string"/>
<element name="attributeDefinitions" nillable="true" type="AttributeDefinition"/>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="NodeType"/>
</sequence>
</complexType> - Hello
I missed something in the defintion of the wsdl:
<complexType name="com.NodeType ">
<sequence>
<element name="parentName" nillable="true" type="xsd:string"/>
<element name="attributeDefinitions" nillable="true" type="AttributeDefinition"/>
</sequence>
</complexType>
<complexType name="ArrayOfcom.NodeType ">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="impl:com.NodeType "/>
</sequence>
</complexType>
Sorry - Are you sure that both client and server use exactly the same contract? Looking at message dump you provided earlier, I would say that Schema does not match the message. You have defined array which elements are <item>, however in the message dump I see <NoteTypes>. Additionally, <thumbnailPath> is not part of NodeType definition. For the Schema you provided correct XML representations is:
<NodeType>
<item>
<parentName a:nil="true" xmlns:a="http://www.w3.org/2001/XMLSchema-instance"/>
<attributeDefinitions a:nil="true" xmlns:a="http://www.w3.org/2001/XMLSchema-instance"/>
</item>
</NodeType>- Edited byPiotr Kulaga [MSFT] Thursday, November 12, 2009 7:57 PMCleanup
- Hello
Yes I am pretty sure that client and server use exactly the same contract. However, as i gave a small sample of the wsdl, i forgot for example to include the attribute thumbnailPath. The element item is apparently a keyword to say that it is an element that is used in the array...
There is no definition of the node item in the wsdl.
- Sorry for not being clear. Here is what I meant:
<element maxOccurs="unbounded" minOccurs="0" name="item " type="impl:com.NodeType "/> <-- definition of item node - each array element is expect to be in <item> ... </item>
</sequence>
</complexType><nodeTypes>
<nodeTypes > <--- neither <item> or </nodeTypes>
<attributeDefinitions xsi:nil="true"/>
<thumbnailPath xsi:nil="true"/>
</nodeTypes>
<nodeTypes>
<attributeDefinitions>
<attributeDefinitions>
<basicName>Type</basicName>
<type>string</type>
<values xsi:nil="true"/>
</attributeDefinitions>
</attributeDefinitions>
</nodeTypes>
</nodeTypes>
The Sapphire expects here either <item> element or </nodeTypes> element inside <nodeTypes> (so array element or end of the complex type). As you have specified minimal count of an array as 0 and <item> is not found we expect </nodeTypes>. However, we found <nodeTypes> so we return error you encountered. This is all I can tell from the samples of WSDL and message dump you gave us.
- Proposed As Answer byHao Xu - MSFT Wednesday, November 18, 2009 5:49 AM
- Hello
Thanks for the answer. I understand now the issue you are talking about.
But what surprises me is that the following wsdl was used with atlsoap and we generated c++ code using sproxy and it succeed to deserialize the xml message.
Was atlsoap ignoring some errors? Does WWSAPI have a higher level of detecting errors? - I am afraid I do not know why altsoap was ignoring some errors. You should update WSDL that you use to match the data on the wire - this should solve your problems.
- Marked As Answer byBob38 Wednesday, November 18, 2009 10:03 AM

