You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by da...@apache.org on 2003/09/12 14:28:43 UTC
cvs commit: xml-axis/c/src/server/samples/simplewebservice/webservicewrapper Makefile.am Service.cpp WebServiceWrapper.cpp WebServiceWrapper.h
damitha 2003/09/12 05:28:43
Added: c/src/server/samples/simplewebservice/webservice Makefile.am
WebService.cpp WebService.h
c/src/server/samples/simplewebservice/webservicewrapper
Makefile.am Service.cpp WebServiceWrapper.cpp
WebServiceWrapper.h
Log:
I created this folder(simplewebservice) so it is easier to build the
sample seperately.
Revision Changes Path
1.1 xml-axis/c/src/server/samples/simplewebservice/webservice/Makefile.am
Index: Makefile.am
===================================================================
noinst_LTLIBRARIES = libweb.la
AM_CPPFLAGS = -Wshadow -Wall -pedantic -ansi
libweb_la_SOURCES = WebService.cpp
libweb_la_LIBADD = -L$(XERCES_HOME)/lib -lxerces-c
INCLUDES = -I$(XERCES_HOME)/include
1.1 xml-axis/c/src/server/samples/simplewebservice/webservice/WebService.cpp
Index: WebService.cpp
===================================================================
/* -*- C++ -*- */
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @author Susantha Kumara (skumara@virtusa.com)
*
*/
// WebService.cpp: implementation of the WebService class.
//
//////////////////////////////////////////////////////////////////////
#include "WebService.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
WebService::WebService()
{
}
WebService::~WebService()
{
}
string WebService::Echo(string msg) // exposed web service method
{
msg += "- This string Appended by the web service &<< >>&&<<\"''\"\"";
return msg;
}
int WebService::Add(int a, int b) // exposed web service method
{
return a+b;
}
int WebService::xxx(int a) // not a web service method.
{
return a*a;
}
int* WebService::EchoIntArray(int size, int array[],int * retsize)
{
int * retarr = new int[size*2];
for(int i=0;i<2;i++)
{
for(int j=0;j<size;j++)
{
retarr[j + i*size] = array[j];
}
}
*retsize = size*2;
return retarr;
}
Point* WebService::AddPoint(Point* p1, Point* p2)
{
Point *pNew = new Point();
pNew->x = p1->x + p2->x;
pNew->y = p1->y + p2->y;
return pNew;
}
Point* WebService::EchoPointArray(int size, Point array[], int*retsize)
{
Point* pNew = new Point[size];
memcpy(pNew, array, sizeof(Point)*size);
*retsize = size;
return pNew;
}
1.1 xml-axis/c/src/server/samples/simplewebservice/webservice/WebService.h
Index: WebService.h
===================================================================
/* -*- C++ -*- */
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @author Susantha Kumara (skumara@virtusa.com)
*
*/
// WebService.h: interface for the WebService class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_WS_H__B3B59E87_9A9C_4DD8_8209_F8EBFCB6A1BA__INCLUDED_)
#define AFX_WS_H__B3B59E87_9A9C_4DD8_8209_F8EBFCB6A1BA__INCLUDED_
#include <string>
using namespace std;
class Point
{
public:
int x;
int y;
};
class WebService
{
public:
WebService();
virtual ~WebService();
public:
int* EchoIntArray(int size, int array[], int* retsize);
string Echo(string msg); // exposed web service method
int Add(int a, int b); // exposed web service method
Point* AddPoint(Point* p1, Point* p2);
Point* EchoPointArray(int size, Point array[], int*retsize);
private:
int xxx(int a); // not a web service method.
};
#endif // !defined(AFX_WS_H__B3B59E87_9A9C_4DD8_8209_F8EBFCB6A1BA__INCLUDED_)
1.1 xml-axis/c/src/server/samples/simplewebservice/webservicewrapper/Makefile.am
Index: Makefile.am
===================================================================
noinst_LTLIBRARIES = libwebwrapper.la
AM_CPPFLAGS = -Wshadow -Wall -pedantic -ansi
libwebwrapper_la_SOURCES = WebServiceWrapper.cpp Service.cpp
libwebwrapper_la_LIBADD = -L$(XERCES_HOME)/lib -lxerces-c
INCLUDES = -I$(XERCES_HOME)/include
1.1 xml-axis/c/src/server/samples/simplewebservice/webservicewrapper/Service.cpp
Index: Service.cpp
===================================================================
/* -*- C++ -*- */
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @author Susantha Kumara (skumara@virtusa.com)
*
*/
// WsService.cpp : Defines the entry point for the DLL application.
//
#ifdef WIN32
#define STORAGE_CLASS_INFO __declspec(dllexport)
#else
#define STORAGE_CLASS_INFO
#endif
#include "WebServiceWrapper.h"
extern "C" {
//the two export functions////////////////////////////////////////////
STORAGE_CLASS_INFO
int GetClassInstance(BasicHandler **inst)
{
WrapperClassHandler* pWCH = new webservicewrapper();
if (pWCH)
{
pWCH->Init();
*inst = pWCH;
return SUCCESS;
}
return FAIL;
}
STORAGE_CLASS_INFO
int DestroyInstance(BasicHandler *inst)
{
if (inst)
{
WrapperClassHandler* pWCH = static_cast<WrapperClassHandler*>(inst);
pWCH->Fini();
delete pWCH;
return SUCCESS;
}
return FAIL;
}
//////////////////////////////////////////////////////////////////////
}
//Following describes how the export function of the handler DLLs (or .so s)
/*
STORAGE_CLASS_INFO
int GetClassInstance(BasicHandler **inst)
{
*inst = new MyHandler();
if (*inst)
{
return SUCCESS;
}
return FAIL;
}
STORAGE_CLASS_INFO
int DestroyInstance(BasicHandler *inst)
{
if (inst)
{
delete inst;
return SUCCESS;
}
return FAIL;
}
*/
1.1 xml-axis/c/src/server/samples/simplewebservice/webservicewrapper/WebServiceWrapper.cpp
Index: WebServiceWrapper.cpp
===================================================================
/* -*- C++ -*- */
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @author Susantha Kumara (skumara@virtusa.com)
*
*/
// webservicewrapper.cpp: implementation of the webservicewrapper class.
//
//////////////////////////////////////////////////////////////////////
#include "WebServiceWrapper.h"
#include "../../../common/IWrapperSoapDeSerializer.h"
#include "../../../common/IWrapperSoapSerializer.h"
#include "../../../common/ISoapMethod.h"
#include "../../../common/IParam.h"
#include "../../../common/IArrayBean.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
static const AxisChar* Axis_URI_Point = "http://www.opensource.lk/Point";
static const AxisChar* Axis_TypeName_Point = "Point";
int Axis_DeSerialize_Point(Point* p, IWrapperSoapDeSerializer *pDZ)
{
p->x = pDZ->GetParam()->GetInt();
p->y = pDZ->GetParam()->GetInt();
return SUCCESS;
}
void Axis_Delete_Point(Point* p, bool bArray = false, int nSize=0)
{
if (bArray)
delete [] p;
else
delete p;
}
int Axis_Serialize_Point(Point* p, IWrapperSoapSerializer& pSZ, bool bArray = false)
{
if (bArray)
{
pSZ << "<" << Axis_TypeName_Point << ">";
}
else
{
AxisString sPrefix = pSZ.getNewNamespacePrefix();
pSZ << "<" << Axis_TypeName_Point << " xsi:type=\"" << sPrefix.c_str() <<":"
<< Axis_TypeName_Point << " xmlns:" << sPrefix.c_str() << "=\""
<< Axis_URI_Point << "\">";
}
pSZ << pSZ.SerializeBasicType("x", p->x);
pSZ << pSZ.SerializeBasicType("y", p->y);
pSZ << "</" << Axis_TypeName_Point << ">";
return SUCCESS;
}
int Axis_GetSize_Point(Point* p)
{
return sizeof(Point);
}
webservicewrapper::webservicewrapper()
{
pWs = new WebService(); //Create actual web service object here
}
webservicewrapper::~webservicewrapper()
{
delete pWs;
}
// Implementation of WrapperClassHandler interfaces.
int webservicewrapper::Invoke(IMessageData* mc)
{
IWrapperSoapDeSerializer* pIWrapperSoapDeSerializer;
mc->getSoapDeSerializer(&pIWrapperSoapDeSerializer);
const AxisChar* method = pIWrapperSoapDeSerializer->GetMethodName();
if (0 == strcmp(method, "Echo"))
return Echo(mc);
else if (0 == strcmp(method, "Add"))
return Add(mc);
else if (0 == strcmp(method, "EchoIntArray"))
return EchoIntArray(mc);
else if (0 == strcmp(method, "AddPoint"))
return AddPoint(mc);
else if (0 == strcmp(method, "EchoPointArray"))
return EchoPointArray(mc);
return FAIL;
}
int webservicewrapper::Init()
{
//Do any Initialization here
return 0;
}
int webservicewrapper::Fini()
{
//Do any finalization here
return 0;
}
int webservicewrapper::SetResponseMethod(IMessageData* mc, const AxisChar* name)
{
IWrapperSoapSerializer* pIWSz = NULL;
mc->getSoapSerializer(&pIWSz);
if (!pIWSz) return FAIL;
ISoapMethod* pMethod= pIWSz->createSoapMethod();
pMethod->setLocalName(name);
pMethod->setPrefix("m");
pMethod->setUri("http://www.opensource.lk");
return SUCCESS;
}
// Methods that wraps actual web methods
int webservicewrapper::Echo(IMessageData* mc)
{
SetResponseMethod(mc, "EchoResponse");
IWrapperSoapDeSerializer* pIWrapperSoapDeSerializer;
mc->getSoapDeSerializer(&pIWrapperSoapDeSerializer);
IParam *param1 = pIWrapperSoapDeSerializer->GetParam();
//We know that parameter 1 should be an string
AxisString str = param1->GetString();
//Call actual web service method with appropriate parameters
AxisString strRet = pWs->Echo(str);
uParamValue value;
value.pStrValue = strRet.c_str();
IWrapperSoapSerializer* pIWSz;
mc->getSoapSerializer(&pIWSz);
IParam* pRetParam = pIWSz->AddOutputParam(XSD_STRING, value);
pRetParam->SetName("EchoReturn");
return SUCCESS;
}
int webservicewrapper::Add(IMessageData* mc)
{
SetResponseMethod(mc, "AddResponse");
IWrapperSoapDeSerializer* pIWrapperSoapDeSerializer;
mc->getSoapDeSerializer(&pIWrapperSoapDeSerializer);
IParam *param1 = pIWrapperSoapDeSerializer->GetParam();
IParam *param2 = pIWrapperSoapDeSerializer->GetParam();
//Convert parameters to actual types
int i1 = param1->GetInt();
int i2 = param2->GetInt();
//Call actual web service method with appropriate parameters
int ret = pWs->Add(i1, i2);
uParamValue value;
value.nValue = ret;
IWrapperSoapSerializer* pIWSz;
mc->getSoapSerializer(&pIWSz);
IParam* pRetParam = pIWSz->AddOutputParam(XSD_INT, value);
pRetParam->SetName("AddReturn");
return SUCCESS;
}
void webservicewrapper::OnFault(IMessageData* mc)
{
}
int webservicewrapper::EchoIntArray(IMessageData *mc)
{
SetResponseMethod(mc, "EchoIntArrayResponse");
IWrapperSoapDeSerializer* pIWrapperSoapDeSerializer;
mc->getSoapDeSerializer(&pIWrapperSoapDeSerializer);
IParam *param1 = pIWrapperSoapDeSerializer->GetParam();
int size = param1->GetArraySize(); //gets full array size
int * arr = new int[size];
param1->SetArrayElements((void*)arr);
pIWrapperSoapDeSerializer->Deserialize(param1,0);
int retarrsize = 0;
int * retarr;
retarr = pWs->EchoIntArray(size,arr,&retarrsize);
IWrapperSoapSerializer* pIWSz;
mc->getSoapSerializer(&pIWSz);
IArrayBean* pAb = pIWSz->makeArrayBean(XSD_INT, (void*)retarr);
pAb->AddDimension(retarrsize);
pAb->SetItemName("item");
uParamValue value;
value.pIArray = pAb;
IParam* pRetParam = pIWSz->AddOutputParam(XSD_ARRAY, value);
pRetParam->SetName("EchoIntArrayReturn");
return SUCCESS;
}
int webservicewrapper::AddPoint(IMessageData *mc)
{
IWrapperSoapSerializer* pIWSSZ = NULL;
mc->getSoapSerializer(&pIWSSZ);
if (!pIWSSZ) return FAIL;
IWrapperSoapDeSerializer* pIWSDZ = NULL;
mc->getSoapDeSerializer(&pIWSDZ);
if (!pIWSDZ) return FAIL;
SetResponseMethod(mc, "AddPointResponse");
IParam *param0 = pIWSDZ->GetParam();
Point* v0 = new Point();
param0->SetUserType(v0, (AXIS_DESERIALIZE_FUNCT)Axis_DeSerialize_Point, (AXIS_OBJECT_DELETE_FUNCT)Axis_Delete_Point);
pIWSDZ->Deserialize(param0,0);
IParam *param1 = pIWSDZ->GetParam();
Point* v1 = new Point();
param1->SetUserType(v1, (AXIS_DESERIALIZE_FUNCT)Axis_DeSerialize_Point, (AXIS_OBJECT_DELETE_FUNCT)Axis_Delete_Point);
pIWSDZ->Deserialize(param1,0);
//Call actual web service method with appropriate parameters
Point* ret = pWs->AddPoint(v0, v1);
IParam* pRetParam = pIWSSZ->AddOutputParam(ret, (void*) Axis_Serialize_Point, (void*) Axis_Delete_Point);
pRetParam->SetName("AddPointReturn");
return SUCCESS;
}
int webservicewrapper::EchoPointArray(IMessageData *mc)
{
SetResponseMethod(mc, "EchoPointArrayResponse");
IWrapperSoapDeSerializer* pIWrapperSoapDeSerializer;
mc->getSoapDeSerializer(&pIWrapperSoapDeSerializer);
IParam *param1 = pIWrapperSoapDeSerializer->GetParam();
int size = param1->GetArraySize(); //gets full array size
Point* arr = new Point[size];
param1->SetArrayElements((void*)arr, (AXIS_DESERIALIZE_FUNCT)Axis_DeSerialize_Point, (AXIS_OBJECT_DELETE_FUNCT)Axis_Delete_Point, (AXIS_OBJECT_SIZE_FUNCT)Axis_GetSize_Point);
pIWrapperSoapDeSerializer->Deserialize(param1,0);
Point* pRet = pWs->EchoPointArray(size, arr,&size);
IWrapperSoapSerializer* pIWSz;
mc->getSoapSerializer(&pIWSz);
IArrayBean* pAb = pIWSz->makeArrayBean((void*)pRet, (void*) Axis_Serialize_Point, (void*) Axis_Delete_Point, (void*) Axis_GetSize_Point);
pAb->AddDimension(size);
pAb->SetItemName("item");
pAb->SetTypeName("Point");
pAb->SetUri("http://www.opensource.lk/Point");
IParam* pRetParam = pIWSz->AddOutputParam(pAb);
pRetParam->SetName("EchoPointArrayReturn");
return SUCCESS;
}
1.1 xml-axis/c/src/server/samples/simplewebservice/webservicewrapper/WebServiceWrapper.h
Index: WebServiceWrapper.h
===================================================================
/* -*- C++ -*- */
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @author Susantha Kumara (skumara@virtusa.com)
*
*/
// webservicewrapper.h: interface for the webservicewrapper class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_WSSERVICE1_H__03F0FC70_6AA9_4D69_A387_6BDEAE1C9459__INCLUDED_)
#define AFX_WSSERVICE1_H__03F0FC70_6AA9_4D69_A387_6BDEAE1C9459__INCLUDED_
#include "../webservice/WebService.h"
#include "../../../../common/WrapperClassHandler.h"
#include "../../../../common/IMessageData.h"
#include "../../../../common/GDefine.h"
class webservicewrapper : public WrapperClassHandler
{
public:
webservicewrapper();
virtual ~webservicewrapper();
public: //WrapperClassHandler
int EchoIntArray(IMessageData* mc);
int Invoke(IMessageData* mc);
void OnFault(IMessageData* pMsg);
int Init();
int Fini();
private: //Methods corresponding to the web service methods
int SetResponseMethod(IMessageData* mc, const AxisChar* name);
int Echo(IMessageData* mc);
int Add(IMessageData* mc);
int AddPoint(IMessageData *mc);
int EchoPointArray(IMessageData *mc);
private:
WebService *pWs; // Actual web service object.
};
#endif // !defined(AFX_WSSERVICE1_H__03F0FC70_6AA9_4D69_A387_6BDEAE1C9459__INCLUDED_)