Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 24194 invoked from network); 25 Jun 2004 04:25:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 25 Jun 2004 04:25:46 -0000 Received: (qmail 78734 invoked by uid 500); 25 Jun 2004 04:26:11 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 78541 invoked by uid 500); 25 Jun 2004 04:26:06 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 78390 invoked by uid 99); 25 Jun 2004 04:26:03 -0000 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Thu, 24 Jun 2004 21:26:01 -0700 Received: (qmail 24059 invoked by uid 1686); 25 Jun 2004 04:25:30 -0000 Date: 25 Jun 2004 04:25:30 -0000 Message-ID: <20040625042530.24058.qmail@minotaur.apache.org> From: roshan@apache.org To: ws-axis-cvs@apache.org Subject: cvs commit: ws-axis/c/tests/client/soapHeader/test3/rpc Makefile.am TestClient.cpp X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N roshan 2004/06/24 21:25:30 Added: c/tests/client/soapHeader/test3 Makefile.am c/tests/client/soapHeader/test3/rpc Makefile.am TestClient.cpp Log: test case fiels for soap headers Revision Changes Path 1.1 ws-axis/c/tests/client/soapHeader/test3/Makefile.am Index: Makefile.am =================================================================== SUBDIRS = rpc 1.1 ws-axis/c/tests/client/soapHeader/test3/rpc/Makefile.am Index: Makefile.am =================================================================== bin_PROGRAMS = soapHeaderTest3RPC SUBDIRS = AM_CPPFLAGS = $(CPPFLAGS) soapHeaderTest3RPC_SOURCES = TestClient.cpp ../../gen_src/rpc/InteropTestPortType.cpp ../../gen_src/rpc/SOAPStruct.cpp soapHeaderTest3RPC_LDADD = $(LDFLAGS) -laxiscpp_client INCLUDES = -I$(AXISCPP_HOME)/include 1.1 ws-axis/c/tests/client/soapHeader/test3/rpc/TestClient.cpp Index: TestClient.cpp =================================================================== /* * Copyright 2003-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * 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@opensource.lk, roshanw@jkcsworld.com) */ #include using namespace std; #include "../../gen_src/rpc/InteropTestPortType.h" #define ARRAYSIZE 2 int main(int argc, char *argv[]) { int x; char endpoint[256]; const char *server = "localhost"; const char *port = "80"; if (argc == 3) { server = argv[1]; port = argv[2]; } printf("Usage :\n %s \n\n", argv[0]); //endpoint for Axis CPP sample sprintf(endpoint, "http://%s:%s/axis/base", server, port); InteropTestPortType ws(endpoint, APTHTTP); /*create a header of the form: Test User Test Password Test User Test Password */ //set SOAP headers IHeaderBlock *phb = ws.createSOAPHeaderBlock("TestHeader", "http://ws.apache.org/axisCppTest/"); //create parent node BasicNode *parentNode = phb->createChild(ELEMENT_NODE); parentNode->setLocalName("Credentials"); //create child node BasicNode *childNode = phb->createChild(ELEMENT_NODE); childNode->setLocalName("username"); //create char node for value BasicNode *valueNode = phb->createChild(CHARACTER_NODE); valueNode->setValue("Test User"); //buld node tree childNode->addChild(valueNode); parentNode->addChild(childNode); //add another node set childNode = phb->createChild(ELEMENT_NODE); childNode->setLocalName("password"); valueNode = phb->createChild(CHARACTER_NODE); valueNode->setValue("Test Password"); childNode->addChild(valueNode); parentNode->addChild(childNode); phb->addChild(parentNode); //set second SOAP headers phb = ws.createSOAPHeaderBlock("TestHeader", "http://ws.apache.org/axisCppTest/"); //create parent node parentNode = phb->createChild(ELEMENT_NODE); parentNode->setLocalName("Credentials"); childNode = phb->createChild(ELEMENT_NODE); childNode->setLocalName("username"); valueNode = phb->createChild(CHARACTER_NODE); valueNode->setValue("Test User"); childNode->addChild(valueNode); parentNode->addChild(childNode); //add another node set childNode = phb->createChild(ELEMENT_NODE); childNode->setLocalName("password"); valueNode = phb->createChild(CHARACTER_NODE); valueNode->setValue("Test Password"); childNode->addChild(valueNode); parentNode->addChild(childNode); phb->addChild(parentNode); printf("Sending Requests to end point %s \n\n", endpoint); printf("invoking echoString...\n"); //testing echoString if (0 == strcmp(ws.echoString("hello world"), "hello world")) printf("successful\n"); else printf("failed\n"); //test removing SOAP header block using pointer IHeaderBlock *header = NULL; header = ws.getFirstSOAPHeaderBlock(); ws.deleteSOAPHeaderBlock(header); header = NULL; header = ws.getFirstSOAPHeaderBlock(); ws.deleteSOAPHeaderBlock(header); //now the request should have no SOAP headers if (0 == strcmp(ws.echoString("hello world"), "hello world")) printf("successful\n"); else printf("failed\n"); printf("Soap Header test end\n"); return 0; }