Shabib is trying to use NULL. 
Dushshantha, did you test with NULL - in my understanding NULL should
work, as compressedText is nillable.

Thanks,
Samisa...

On 6/28/05, Dushshantha Chandradasa <[EMAIL PROTECTED]> wrote:
> Hi Shabib,
> 
> Try the following service implementation approach.
> 
> compressionOutput* TournamentHelper::compress(xsd__string Value0,
> xsd__unsignedInt Value1)
> {
>      compressionOutput* retVal = new compressionOutput();
>      retVal->compressedText =Value0;
>      retVal->compressedLen = Value1;
>      return retVal;
> }
> 
> 
> Regards,
> Dushshantha
> 
> -----Original Message-----
> From: Mustafa Shabib [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 24, 2005 8:34 PM
> To: [email protected]
> Subject: Newbie Memory Confusion!
> 
> Hello,
> 
> I'm having problems trying to return my own user defined types and I
> believe it to be due to confusion on my part regarding how memory is
> maintained between client/service. I'll be glad to send the entire WSDL
> though I only provided the key parts for now, to simplify, since this
> message is already really long.
> 
> This is how I define my type:
> 
> <wsdl:types>
>      <xsd:schema
> targetNamespace="http://localhost/axis/TournamentHelper";
> xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
>          <xsd:complexType name="compressionOutput">
>              <xsd:sequence>
>                  <xsd:element name="compressedLen"
> type="xsd:unsignedInt" nillable="false"/>
>                  <xsd:element name="compressedText" type="xsd:string"
> nillable="true"/>
>              </xsd:sequence>
>          </xsd:complexType>
>      </xsd:schema>
> </wsdl:types>
> 
> And how I use it:
> <wsdl:message name="compressRequest">
>        <wsdl:part name="uncompressedText" type="xsd:string"/>
>        <wsdl:part name="uncompressedSize" type="xsd:unsignedInt"/>
> </wsdl:message>
> <wsdl:message name="compressResponse">
>      <wsdl:part name="compressedObj" type="intf:compressionOutput"/>
> </wsdl:message>
> 
> And my port type operation is defined like so:
> <wsdl:operation name="compress" parameterOrder="uncompressedText
> uncompressedSize">
>        <wsdl:input message="intf:compressRequest"
> name="compressRequest"/>
>        <wsdl:output message="intf:compressResponse"
> name="compressResponse"/>
>      </wsdl:operation>
> 
> and the binding operation like:
> 
> <wsdl:operation name="compress">
>        <wsdlsoap:operation soapAction="TournamentHelper#compress"/>
>        <wsdl:input name="compressRequest">
>          <wsdlsoap:body
>          encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
>          namespace="http://localhost/axis/TournamentHelper";
>          use="encoded"/>
>        </wsdl:input>
>        <wsdl:output name="compressResponse">
>          <wsdlsoap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
>          namespace="http://localhost/axis/TournamentHelper";
>          use="encoded"/>
>        </wsdl:output>
>      </wsdl:operation>
> First, my user type generates the following object via the wsdl2ws.jar
> utility:
> 
> 
> #include <axis/AxisUserAPI.hpp>
> AXIS_CPP_NAMESPACE_USE
> 
> /*Local name and the URI for the type*/
> static const char* Axis_URI_compressionOutput =
> "http://localhost/axis/TournamentHelper";;
> static const char* Axis_TypeName_compressionOutput =
> "compressionOutput";
> 
> class compressionOutput
> {
> public:
>      xsd__unsignedInt compressedLen;
>      xsd__string compressedText;
>      compressionOutput();
>      virtual ~compressionOutput();
> };
> 
> Then, an operation that can be performed by my webservice returns a
> pointer to an object of this type. Once generated, I fill in the
> operation with some simple code:
> 
> compressionOutput* TournamentHelper::compress(xsd__string Value0,
> xsd__unsignedInt Value1)
> {
>      compressionOutput* retVal =
> (compressionOutput*)malloc(sizeof(compressionOutput));
>      retVal->compressedText = NULL;
>      retVal->compressedLen = Value1;
>      return retVal;
> }
> 
> When I try to call this operation from a client, the program crashes
> with the following message (edited for clarity)
> 
> Debug assertion failed!
> ...
> File: dbgheap.c
> Line: 1011
> Expression: _CrtIsValidHeapPointer(pUserData)
> 
> ...
> 
> When I call it from my client, I just do:
> 
> TournamentHelper t;
> t.compress("TEST", 10);
> 
> I'm really confused and would love to hear any pointers or shown some
> examples...
> 
> Thanks again.
> Mustafa
> 
> 
> 
> 
> 
>

Reply via email to