axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergej Srepfler <ser...@jware.hr>
Subject Help compiling sample code
Date Wed, 30 Jun 2004 07:20:41 GMT
Can someone help me?
I just installed axis-c-1.1.1 on my Linux box, and I am trying to get
samples/client/simple example to work with Axis Java server running on Windows
machine.
  I did manage to compile demo example, but when I use my wsdl
instead, it breaks on compile.

Here is what I've got:

Since I'm trying to acces existing example, I used Calculator.
So i downloaded & prepared it to my machine with
> wget http://192.168.10.225:8080/axis/Calculator.jws?wsdl -O Calculator.wsdl
> java org.apache.axis.wsdl.wsdl2ws.WSDL2Ws Calculator.wsdl -lc++ -sclient

Since I'm trying to compile it with existing example, I simply
owerwritted existing example with
Calculator.wsdl
-----------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://192.168.10.225:8080/axis/Calculator.jws" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://192.168.10.225:8080/axis/Calculator.jws"
xmlns:intf="http://192.168.10.225:8080/axis/Calculator.jws" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <wsdl:message name="addResponse">
    <wsdl:part name="addReturn" type="xsd:int"/>
  </wsdl:message>
  <wsdl:message name="echoResponse">
    <wsdl:part name="echoReturn" type="xsd:string"/>
  </wsdl:message>
  <wsdl:message name="subtractResponse">
    <wsdl:part name="subtractReturn" type="xsd:int"/>
  </wsdl:message>
  <wsdl:message name="subtractRequest">
    <wsdl:part name="i1" type="xsd:int"/>
    <wsdl:part name="i2" type="xsd:int"/>
  </wsdl:message>
  <wsdl:message name="echoRequest">
  </wsdl:message>
  <wsdl:message name="addRequest">
    <wsdl:part name="i1" type="xsd:int"/>
    <wsdl:part name="i2" type="xsd:int"/>
  </wsdl:message>
  <wsdl:portType name="Calculator">
    <wsdl:operation name="add" parameterOrder="i1 i2">
      <wsdl:input message="impl:addRequest" name="addRequest"/>
      <wsdl:output message="impl:addResponse" name="addResponse"/>
    </wsdl:operation>
    <wsdl:operation name="subtract" parameterOrder="i1 i2">
      <wsdl:input message="impl:subtractRequest" name="subtractRequest"/>
      <wsdl:output message="impl:subtractResponse" name="subtractResponse"/>
    </wsdl:operation>
    <wsdl:operation name="echo">
      <wsdl:input message="impl:echoRequest" name="echoRequest"/>
      <wsdl:output message="impl:echoResponse" name="echoResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="CalculatorSoapBinding" type="impl:Calculator">
    <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="add">
      <wsdlsoap:operation soapAction=""/>
      <wsdl:input name="addRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace"
use="encoded"/>
      </wsdl:input>
      <wsdl:output name="addResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://192.168.10.225:8080/axis/Calculator.jws"
use="encoded"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="subtract">
      <wsdlsoap:operation soapAction=""/>
      <wsdl:input name="subtractRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace"
use="encoded"/>
      </wsdl:input>
      <wsdl:output name="subtractResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://192.168.10.225:8080/axis/Calculator.jws"
use="encoded"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="echo">
      <wsdlsoap:operation soapAction=""/>
      <wsdl:input name="echoRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace"
use="encoded"/>
      </wsdl:input>
      <wsdl:output name="echoResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://192.168.10.225:8080/axis/Calculator.jws"
use="encoded"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="CalculatorService">
    <wsdl:port binding="impl:CalculatorSoapBinding" name="Calculator">
      <wsdlsoap:address location="http://192.168.10.225:8080/axis/Calculator.jws"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
-------------------------------------------------------------------------------

Calculator.h
-------------------------------------------------------------------------------
/*
 * This is the Client Stub Class genarated by the tool WSDL2Ws
 * Calculator.h: interface for the Calculatorclass.
 *
 */
#if !defined(__CALCULATOR_CLIENTSTUB_H__INCLUDED_)
#define __CALCULATOR_CLIENTSTUB_H__INCLUDED_

#include <axis/client/Call.h>

class Calculator 
{
private:
        Call* m_pCall;
public:
        Calculator();
public:
        virtual ~Calculator();
public: 
        void add(int Value0,int Value1,int Value2);
        void subtract(int Value0,int Value1,int Value2);
        xsd__string echo();
};

#endif /* !defined(__CALCULATOR_CLIENTSTUB_H__INCLUDED_)*/
------------------------------------------------------------------------------

Calculator.cpp
------------------------------------------------------------------------------
/*
 * This is the Client Stub implementation file genarated by WSDL2Ws tool.
 * Calculator.cpp: implemtation for the Calculator.
 *
 */

#include "Calculator.h"

#include <axis/server/AxisWrapperAPI.h>

bool CallBase::bInitialized;
CallFunctions CallBase::ms_VFtable;
Calculator::Calculator()
{
        m_pCall = new Call();
        m_pCall->SetProtocol(APTHTTP);
        m_pCall->SetEndpointURI("http://192.168.10.225:8080/axis/Calculator.jws");
}

Calculator::~Calculator()
{
        delete m_pCall;
}


/*Methods corresponding to the web service methods*/

/*
 * This method wrap the service methodadd
 */
void Calculator::add(int Value0, int Value1, int Value2)
{
        if (AXIS_SUCCESS != m_pCall->Initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL)) return
;
        m_pCall->SetTransportProperty(SOAPACTION_HEADER , "");
        m_pCall->SetSOAPVersion(SOAP_VER_1_1);
        m_pCall->SetOperation("add", "http://192.168.10.225:8080/axis/Calculator.jws");
        m_pCall->AddParameter((void*)&Value0, "i1", XSD_INT);
        m_pCall->AddParameter((void*)&Value1, "i2", XSD_INT);
        m_pCall->AddParameter((void*)&Value2, "addReturn", XSD_INT);
        if (AXIS_SUCCESS == m_pCall->Invoke())
        {
                if(AXIS_SUCCESS == m_pCall->CheckMessage("addResponse", "http://192.168.10.225:8080/axis/Calculator.jws"))
                {
                        /*not successful*/
                }
        }
        m_pCall->UnInitialize();
}


/*
 * This method wrap the service methodsubtract
 */
void Calculator::subtract(int Value0, int Value1, int Value2)
{
        if (AXIS_SUCCESS != m_pCall->Initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL)) return
;
        m_pCall->SetTransportProperty(SOAPACTION_HEADER , "");
        m_pCall->SetSOAPVersion(SOAP_VER_1_1);
        m_pCall->SetOperation("subtract", "http://192.168.10.225:8080/axis/Calculator.jws");
        m_pCall->AddParameter((void*)&Value0, "i1", XSD_INT);
        m_pCall->AddParameter((void*)&Value1, "i2", XSD_INT);
        m_pCall->AddParameter((void*)&Value2, "subtractReturn", XSD_INT);
        if (AXIS_SUCCESS == m_pCall->Invoke())
        {
                if(AXIS_SUCCESS == m_pCall->CheckMessage("subtractResponse", "http://192.168.10.225:8080/axis/Calculator.jws"))
                {
                        /*not successful*/
                }
        }
        m_pCall->UnInitialize();
}


/*
 * This method wrap the service methodecho
 */
xsd__string Calculator::echo()
{
        xsd__string Ret;
        if (AXIS_SUCCESS != m_pCall->Initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL)) return
Ret;
        m_pCall->SetTransportProperty(SOAPACTION_HEADER , "");
        m_pCall->SetSOAPVersion(SOAP_VER_1_1);
        m_pCall->SetOperation("echo", "http://192.168.10.225:8080/axis/Calculator.jws");
        if (AXIS_SUCCESS == m_pCall->Invoke())
        {
                if(AXIS_SUCCESS == m_pCall->CheckMessage("echoResponse", "http://192.168.10.225:8080/axis/Calculator.jws"))
                {
                        Ret = m_pCall->GetElementAsString("echoReturn", 0);
                }
        }
        m_pCall->UnInitialize();
        return Ret;
}
---------------------------------------------------------------------------------------

And the compiler breaks with these messages:

sergej@aleksandra:/home/axisuser/projects/axis_c/samples/client/simple> make
make[1]: Entering directory `/home/axisuser/projects/axis_c/samples/client/simple'
source='Calculator.cpp' object='Calculator.o' libtool=no \
depfile='.deps/Calculator.Po' tmpdepfile='.deps/Calculator.TPo' \
depmode=gcc3 /bin/sh ../depcomp \
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/home/axisuser/projects/axis_c/include -Wshadow -Wall -pedantic
-ansi -Wshadow -Wall -pedantic -ansi  -g -O2 -c -o Calculator.o `test -f 'Calculator.cpp'
|| echo './'`Calculator.cpp
In file included from /home/axisuser/projects/axis_c/include/axis/server/IMessageData.h:67,
                 from /home/axisuser/projects/axis_c/include/axis/server/BasicHandler.h:63,
                 from /home/axisuser/projects/axis_c/include/axis/server/AxisWrapperAPI.h:70,
                 from /home/axisuser/projects/axis_c/include/axis/client/Call.h:68,
                 from Calculator.h:9,
                 from Calculator.cpp:7:
/home/axisuser/projects/axis_c/include/axis/server/IAdminUtils.h:77:39: warning: no newline
at end of file
In file included from /home/axisuser/projects/axis_c/include/axis/server/AxisWrapperAPI.h:70,
                 from /home/axisuser/projects/axis_c/include/axis/client/Call.h:68,
                 from Calculator.h:9,
                 from Calculator.cpp:7:
/home/axisuser/projects/axis_c/include/axis/server/BasicHandler.h:87: warning: `
   class HandlerBase' has virtual functions but non-virtual destructor
Calculator.cpp: In member function `char* Calculator::echo()':
Calculator.cpp:79: warning: `char*Ret' might be used uninitialized in this 
   function
/home/axisuser/projects/axis_c/include/axis/server/HandlerChain.h: At top 
   level:
/home/axisuser/projects/axis_c/include/axis/server/SoapEnvVersions.h:120: warning: `
   SoapEnvVersionsStruct gs_SoapEnvVersionsStruct[2]' defined but not used
.deps/Calculator.TPo: Permission denied
make[1]: *** [Calculator.o] Error 1
make[1]: Leaving directory `/home/axisuser/projects/axis_c/samples/client/simple'
make: *** [all-recursive] Error 1



Mime
View raw message