Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 41791 invoked from network); 11 Oct 2003 06:14:30 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 11 Oct 2003 06:14:30 -0000 Received: (qmail 3203 invoked by uid 500); 11 Oct 2003 06:14:05 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 3043 invoked by uid 500); 11 Oct 2003 06:14:04 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 3032 invoked by uid 500); 11 Oct 2003 06:14:03 -0000 Delivered-To: apmail-ws-axis-cvs@apache.org Date: 11 Oct 2003 06:14:25 -0000 Message-ID: <20031011061425.41761.qmail@minotaur.apache.org> From: roshan@apache.org To: ws-axis-cvs@apache.org Subject: cvs commit: ws-axis/c/src/client/deployment AdminClient.cpp X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N roshan 2003/10/10 23:14:25 Modified: c/src/client/deployment AdminClient.cpp Log: client code for deployment tool Revision Changes Path 1.2 +158 -7 ws-axis/c/src/client/deployment/AdminClient.cpp Index: AdminClient.cpp =================================================================== RCS file: /home/cvs/ws-axis/c/src/client/deployment/AdminClient.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AdminClient.cpp 2 Oct 2003 10:09:08 -0000 1.1 +++ AdminClient.cpp 11 Oct 2003 06:14:25 -0000 1.2 @@ -1,19 +1,170 @@ -int main() { +/* -*- C++ -*- */ - /* - Admin client code comes here - */ +/* + * 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 + * . + * + * + * + * + * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk) + * + */ - Call* m_pCall; +#include "../Call.h" +#include "../../wsdd/WSDDDeployment.h" + +int processDeployWSDD(char* pchWSDDPath); + +const AxisChar* pAchServiceName; +const AxisChar* pAchLibName; +list lstAllowedMethods; +//string* sArrAllowedMethods; +string sArrAllowedMethods[6]; +int iAllowdMethodsArraySize=0; + +int main(int argc, char *argv[ ]) { + + int nStatus; + int ret = 0; + char* chWSDDPath = "E:/axiscppdev/ws-axis/c/release/win32/deploy.wsdd"; + Call* m_pCall; m_pCall = new Call(); + + /* + *Process the client side deployment WSDD and extract the required details + */ + processDeployWSDD(chWSDDPath); + /* The protocol can be taken from the binding section in the WSDL */ m_pCall->SetProtocol(APTHTTP); /* The value for SOAPAction is specified in the binding section of the WSDL */ m_pCall->SetHeader("SOAPAction", "servicename"); /* End point URI too can be taken from WSDL */ - //m_pCall->SetEndpointURI("http://192.168.101.10:80/axis/Calculator"); - m_pCall->SetEndpointURI("http://192.168.101.4:5555/axis/Calculator"); + //m_pCall->SetEndpointURI("http://192.168.101.15:9999/axis/WebserviceDeployer"); + m_pCall->SetEndpointURI("http://127.0.0.1:9999/axis/WebserviceDeployer"); + + /* Following will establish the connections with the server too */ + if (SUCCESS != m_pCall->Initialize()) + return ret; + m_pCall->SetSOAPVersion(SOAP_VER_1_1); + /* This should be done before adding parameters or return type */ + + m_pCall->SetOperation("deploy", "http://www.opensource.lk/"); + + m_pCall->AddParameter(pAchServiceName, "ServiceName"); + m_pCall->AddParameter(pAchLibName, "LibName"); + + Axis_Array* structAxis_Array= (Axis_Array*) malloc(sizeof(Axis_Array)); + structAxis_Array->m_Array = sArrAllowedMethods; + structAxis_Array->m_Size = iAllowdMethodsArraySize; + m_pCall->AddParameter(structAxis_Array, XSD_STRING, "AllowedMethods"); + + m_pCall->SetReturnType(XSD_INT); + + + nStatus = m_pCall->Invoke(); + + if (SUCCESS == nStatus) + { + ret = m_pCall->GetResult().nValue; +#ifdef _DEBUG + printf("%s%d", "Got The result", ret); +#endif + } + /* Following will close the connection with the server too */ + m_pCall->UnInitialize(); + + delete m_pCall; + return 0; +} + +int processDeployWSDD(char* pchWSDDPath) { + + /* + *WSDD processing code comes here + */ + + WSDDDeployment* pWSDDDeployment= new WSDDDeployment(); + pWSDDDeployment->LoadWSDD(pchWSDDPath); + + const WSDDServiceMap* pWSDDServiceMap= pWSDDDeployment->GetWSDDServiceMap(); + const WSDDServiceMap::const_iterator itCurrService = pWSDDServiceMap->begin(); + + if (itCurrService != pWSDDServiceMap->end()) { + const WSDDService* pWSDDService = (*itCurrService).second; + pAchServiceName = pWSDDService->GetServiceName(); + pAchLibName = pWSDDService->GetLibName(); + lstAllowedMethods = pWSDDService->getAllowedMethods(); + + printf("pAchServiceName = %s\n", pAchServiceName); + printf("pAchLibName = %s\n", pAchLibName); + + list::iterator iteAllowedMethods = lstAllowedMethods.begin(); + int iTmpCount =0; + while (iteAllowedMethods != lstAllowedMethods.end()) { + /*DEBUG line + printf("sAllowedMethod = %s\n", (*iteAllowedMethods).c_str()); + */ + sArrAllowedMethods[iTmpCount] = (*iteAllowedMethods).c_str(); + iTmpCount++; + iteAllowedMethods++; + } + iAllowdMethodsArraySize = iTmpCount; + } + + return SUCCESS; }