[
https://issues.apache.org/jira/browse/AXISCPP-1048?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
nadir amra closed AXISCPP-1048.
-------------------------------
Resolution: Fixed
Fix Version/s: current (nightly)
Actually the problem was in the generated TestServicePortTypeWrapper.cpp code.
The original code generated invalid code as follows:
xsd__int ret = pWs->add(v0,v1);
return pIWSSZ->addOutputParam("return", (void*)&ret, XSD_INT);
The corrected code looks like the following:
xsd__int * ret = pWs->add(v0,v1);
return pIWSSZ->addOutputParam("return", (void*)ret, XSD_INT);
The reason pointers are used is because you have minOccurs="0" in element
definitions.
> WSDL2Ws code - deleted primitive return type pointers
> -----------------------------------------------------
>
> Key: AXISCPP-1048
> URL: https://issues.apache.org/jira/browse/AXISCPP-1048
> Project: Axis-C++
> Issue Type: Bug
> Components: Server - General
> Environment: Windows XP Prof. SP2 (german), Pentium 2,8 Ghz, 2 GB RAM
> Reporter: Manuel Freiholz
> Fix For: current (nightly)
>
>
> Hi guys,
> i wrote my problem to the mailing list some month ago. i never got an answer
> until i accidental found a reply on google :)
> so here is the mail.
> -------
> Hi guys,
> its the first time that i am using the axis framework with c++ (usually
> i do not develop with c/c++).
> I wrote a simple calculation web service with java and deployed it to
> the app-server.
> The following wsdl has been generated:
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
> xmlns:ns0="http://test.cadenas.de"
> xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
> xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
> xmlns:ns1="http://org.apache.axis2/xsd"
> xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> targetNamespace="http://test.cadenas.de">
> <wsdl:documentation>TestService</wsdl:documentation>
> <wsdl:types>
> <xs:schema xmlns:ns="http://test.cadenas.de"
> attributeFormDefault="qualified" elementFormDefault="qualified"
> targetNamespace="http://test.cadenas.de">
> <xs:element name="add">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" name="num1"
> type="xs:int"/>
> <xs:element minOccurs="0" name="num2"
> type="xs:int"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="addResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" name="return"
> type="xs:int"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> </wsdl:types>
> <wsdl:message name="addRequest">
> <wsdl:part name="parameters" element="ns0:add"/>
> </wsdl:message>
> <wsdl:message name="addResponse">
> <wsdl:part name="parameters" element="ns0:addResponse"/>
> </wsdl:message>
> <wsdl:portType name="TestServicePortType">
> <wsdl:operation name="add">
> <wsdl:input message="ns0:addRequest" wsaw:Action="urn:add"/>
> <wsdl:output message="ns0:addResponse"
> wsaw:Action="urn:addResponse"/>
> </wsdl:operation>
> </wsdl:portType>
> <wsdl:binding name="TestServiceSOAP11Binding"
> type="ns0:TestServicePortType">
> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
> style="document"/>
> <wsdl:operation name="add">
> <soap:operation soapAction="urn:add" style="document"/>
> <wsdl:input>
> <soap:body use="literal"/>
> </wsdl:input>
> <wsdl:output>
> <soap:body use="literal"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:binding name="TestServiceSOAP12Binding"
> type="ns0:TestServicePortType">
> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
> style="document"/>
> <wsdl:operation name="add">
> <soap12:operation soapAction="urn:add" style="document"/>
> <wsdl:input>
> <soap12:body use="literal"/>
> </wsdl:input>
> <wsdl:output>
> <soap12:body use="literal"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:binding name="TestServiceHttpBinding"
> type="ns0:TestServicePortType">
> <http:binding verb="POST"/>
> <wsdl:operation name="add">
> <http:operation location="TestService/add"/>
> <wsdl:input>
> <mime:content type="text/xml" part="add"/>
> </wsdl:input>
> <wsdl:output>
> <mime:content type="text/xml" part="add"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:service name="TestService">
> <wsdl:port name="TestServiceSOAP11port_http"
> binding="ns0:TestServiceSOAP11Binding">
> <soap:address
> location="http://localhost:8080/cadenas/services/TestService"/>
> </wsdl:port>
> <wsdl:port name="TestServiceSOAP12port_http"
> binding="ns0:TestServiceSOAP12Binding">
> <soap12:address
> location="http://localhost:8080/cadenas/services/TestService"/>
> </wsdl:port>
> <wsdl:port name="TestServiceHttpport"
> binding="ns0:TestServiceHttpBinding">
> <http:address
> location="http://localhost:8080/cadenas/services/TestService"/>
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
> You can see that it is a very simple service, which provides a "int
> add(int,int)" method.
> I used the wsdl2ws tool to get this declaration for the "add" method:
> STORAGE_CLASS_INFO xsd__int * add(xsd__int * Value0, xsd__int * Value1);
> Generally i do not have a problem with pointers (tho i don't like
> primitive type pointers),
> but when i get an xsd__int* back from method which is always empty
> (NULL) im worried :P
> I found the reason in the generated class "TestServicePortType" in
> method "add":
> (read comments please)
> ...
> xsd__int * pReturn = m_pCall->getElementAsInt("return", 0);
> if(pReturn)
> {
> Ret = *pReturn; // byVal (copy) would be better.
> Axis::AxisDelete( (void *) pReturn, XSD_INT); // Deletes
> the memory to which "Ret" points.
> }
> ...
> I changed the datatype of variable "Ret" and the return type of the
> method from "xsd__int*" to "xsd__int" and now everything works fine.
> Is this a generally known bug or is there a way to tell the wsdl2ws
> tool, that i dont like primitive datatype
> pointers as return value?
> It's also possible that i am completely wrong... so please help me :-)
> Regards,
> Manuel
> Sorry for my bad english.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]