axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anne Thomas Manes <atma...@gmail.com>
Subject Re: Newbie Memory Confusion!
Date Sun, 26 Jun 2005 15:44:18 GMT
Mustafa,

You should ask this question on the Axis C++ User list. See
http://ws.apache.org/axis/mail.html for information about the various
Axis mailing lists.

To put it simply, no memory is maintained across client and server.
SOAP is a message passing system, not a distributed object system.
Don't think of it like an RPC. I also suggest that you switch to
document/literal mode. It enables much better interoperability.

Anne

On 6/24/05, Mustafa Shabib <mustafa@rawthrills.com> wrote:
> 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. Thanks, and
> apologies if I've sent this to the wrong person. Is there a newsgroup or
> something I can post to?
> 
> Thanks again.
> Mustafa
> 
>

Mime
View raw message