You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2004/08/12 13:43:07 UTC

cvs commit: ws-axis/c/tests/auto_build/linux/testcases/client/cpp ExceptionTestClient.cpp FaultMappingClient.cpp InteropTestRound1Client.cpp MathOpsClient.cpp RpcSoapHeaderTest10Client.cpp RpcSoapHeaderTest1Client.cpp RpcSoapHeaderTest2Client.cpp RpcSoapHeaderTest3Client.cpp RpcSoapHeaderTest4Client.cpp RpcSoapHeaderTest5Client.cpp RpcSoapHeaderTest6Client.cpp RpcSoapHeaderTest8Client.cpp RpcSoapHeaderTest9Client.cpp

damitha     2004/08/12 04:43:07

  Added:       c/tests/auto_build/linux/testcases/client/cpp
                        ExceptionTestClient.cpp FaultMappingClient.cpp
                        InteropTestRound1Client.cpp MathOpsClient.cpp
                        RpcSoapHeaderTest10Client.cpp
                        RpcSoapHeaderTest1Client.cpp
                        RpcSoapHeaderTest2Client.cpp
                        RpcSoapHeaderTest3Client.cpp
                        RpcSoapHeaderTest4Client.cpp
                        RpcSoapHeaderTest5Client.cpp
                        RpcSoapHeaderTest6Client.cpp
                        RpcSoapHeaderTest8Client.cpp
                        RpcSoapHeaderTest9Client.cpp
  Log:
  In the process of adding the Axis C++ test suite
  
  Revision  Changes    Path
  1.1                  ws-axis/c/tests/auto_build/linux/testcases/client/cpp/ExceptionTestClient.cpp
  
  Index: ExceptionTestClient.cpp
  ===================================================================
  #include "MathOps.h"
  #include <axis/server/AxisException.h>
  #include <ctype.h>
  
  void PrintUsage();
  bool IsNumber(const char* p);
  
  int main(int argc, char* argv[])
  {
  	char endpoint[256];
  	const char* server="localhost";
  	const char* port="80";
  	const char* op = 0;
  	const char* p1 = 0;
  	const char* p2 = 0;
          int p3 = 0;
  	int i1=0, i2=0;
          int iResult;
          char* pcDetail;
  
  	op = "div";
  	
  	i1 = 10;
  	i2 = 5;
  
  	if (strcmp(op, "div") == 0)
  	{
              for(p3 = 0; p3 < 3; p3++)
              {
                  try
                  {     
  	            printf("Sending Requests to Server http://%s:%s ........\n\n", server, port);
                      switch(p3)
                      {
                          case 0:
                              /* Sends a normal request. the result should be the division of
                               *  two numbers the user has provided
                               */
  	                    sprintf(endpoint, "http://%s:%s/axis/MathOps", server, port);
                              break;
              
                          case 1:
                              /* Service name is missing. The message
                               *  Exception : AxisSoapException:Soap action is empty
                               *  should be returned to the user.
                               */
  	                    sprintf(endpoint, "http://%s:%s/axis", server, port);
                              break;
            
                         case 2: 
                             /* Service name is wrong. The message
                              * Exception : AxisWsddException:Requested service not found
                              * should be returned to the user.
                              */
  	                    sprintf(endpoint, "http://%s:%s/axis/Math", server, port);
                              break;
  
                         case 3:
                               /* Service path is empty. The message  
                                * The corresponding http fail message
                                * should be returned to the user.
                                */
  	                    /*sprintf(endpoint, "http://%s:%s/", server, port);*/
                              printf("This test has been temporarily terminated" \
                              " due to an unresolved bug\n");
                              exit(0); /* This is temporary code*/
                              break;
  
                         case 4:
                              /* Exception : AxisTransportException:Unexpected string
                               * received. Most probably server returned an empty stream
                               */
  	                    sprintf(endpoint, "", server, port);
  	                    //sprintf(endpoint, "http://%s:%s", server, port);
                              break;
                   
                         default:
                              printf("Invalide option for the last parameter\n\n");
                              return 0;
                      }
  	            //sprintf(endpoint, "http://%s:%s/axis/MathOps", server, port);
  	            MathOps ws(endpoint);
  		    iResult = ws.div(i1, i2);		
                      printf("Result is:%d\n", iResult);
                  }
                  catch(AxisException& e)
                  {
                      printf("%s\n", e.what());
                  }
                  catch(exception& e)
                  {
  		    printf("Unknown exception has occured\n");
                  }
                  catch(...)
                  {
  		    printf("Unknown exception has occured\n");
                  }
              }
  	}
  	else 
  	{
  		printf("Invalid operation %s\n\n", op);
  		PrintUsage();
  	}
  	return 0;
  }
  
  void PrintUsage()
  {
  	printf("Usage :\n MathOps <server> <port> <operation> <parameter> <parameter> <parameter>\n\n");
  	exit(1);
  }
  
  bool IsNumber(const char* p)
  {
  	for (int x=1; x < strlen(p); x++)
  	{
  		if (!isdigit(p[x])) return false;
  	}
  	return true;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/linux/testcases/client/cpp/FaultMappingClient.cpp
  
  Index: FaultMappingClient.cpp
  ===================================================================
  #include "MathOps.h"
  #include <axis/server/AxisException.h>
  #include <ctype.h>
  
  void PrintUsage();
  bool IsNumber(const char* p);
  
  int main(int argc, char* argv[])
  {
  	char endpoint[256];
  	const char* server="localhost";
  	const char* port="80";
  	const char* op = 0;
  	const char* p1 = 0;
  	const char* p2 = 0;
  	int i1=0, i2=0;
          int iResult;
          char* pcDetail;
  
  	printf("Sending Requests to Server http://%s:%s ........\n\n", server, port);
  	sprintf(endpoint, "http://%s:%s/axis/MathOps", server, port);
  	MathOps ws(endpoint);
  
  	op = "div";
  
  	if (strcmp(op, "div") == 0)
  	{
              for(int i = 0; i < 4; i++)
              {
                  switch(i)
                  {
                      case 0: i1 = 10; i2 = 5;
                      case 1: i1 = 10; i2 = 0;
                      case 2: i1 = 1000; i2 = 5;
                      case 3: i1 = 10; i2 = -5;
                  }
                  try
                  {
  		    iResult = ws.div(i1, i2);		
                      printf("Result is:%d\n", iResult);
                  }
                  catch(AxisClientException& e)
                  {
                      printf("%s\n", e.what());
                  }
                  catch(AxisException& e)
                  {
                      printf("Exception : %s\n", e.what());
                  }
                  catch(exception& e)
                  {
                  }
                  catch(...)
                  {
                  }
              }
  	}
  	else 
  	{
  		printf("Invalid operation %s\n\n", op);
  		PrintUsage();
  	}
  	return 0;
  }
  
  void PrintUsage()
  {
  	printf("Usage :\n MathOps <server> <port> <operation> <parameter> <parameter>\n\n");
  	exit(1);
  }
  
  bool IsNumber(const char* p)
  {
  	for (int x=1; x < strlen(p); x++)
  	{
  		if (!isdigit(p[x])) return false;
  	}
  	return true;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/linux/testcases/client/cpp/InteropTestRound1Client.cpp
  
  Index: InteropTestRound1Client.cpp
  ===================================================================
  // InteropBaseClient.cpp : Defines the entry point for the console application.
  //
  #include <string>
  using namespace std;
  
  #include "InteropTestPortType.h" 
  
  #define ARRAYSIZE 2
  
  int main(int argc, char* argv[])
  {
  	int x;
  	char buffer1[100];
  	char endpoint[256];
  	const char* server="localhost";
  	const char* port="80";
  	printf("Sending Requests to Server http://%s:%s ........\n\n", server, port);
  	sprintf(endpoint, "http://%s:%s/axis/base", server, port);
  	try
          {
  	   InteropTestPortType ws(endpoint, APTHTTP);
  
  
  	ws.setTransportTimeout(5);
  	
  	printf("invoking echoString...\n");
  	//testing echoString 
  	string bigstring;
  	for (int ii=0;ii<2;ii++)
  	{
  		bigstring += "hello world ";
  	}
  	strcpy(buffer1, bigstring.c_str());
  	printf(ws.echoString(buffer1));
  	if (0 == strcmp(ws.echoString("hello world"), "hello world"))
  		printf("successful\n");
  	else
  		printf("failed\n");
  	// testing echoStringArray 
  	xsd__string_Array arrstr;
  	arrstr.m_Array = new char*[ARRAYSIZE];
  	arrstr.m_Size = ARRAYSIZE;
  	sprintf(buffer1, "%dth element of string array", 0);
  	//sprintf(buffer2, "%dth element of string array", 1);
  	for(int i=0; i< ARRAYSIZE; i++)
  	{
  		arrstr.m_Array[i] = buffer1;
  	}
  	//arrstr.m_Array[1] = buffer2;
  	printf("invoking echoStringArray...\n");
  	if (ws.echoStringArray(arrstr).m_Array != NULL)
  		printf("successful\n");
  	else
  		printf("failed\n");
  	// testing echoInteger 
  	printf("invoking echoInteger...\n");
  	if (ws.echoInteger(56) == 56)
  		printf("successful\n");
  	else
  		printf("failed\n");
  	// testing echoIntegerArray 
  	xsd__int_Array arrint;
  	arrint.m_Array = new int[ARRAYSIZE];
  	arrint.m_Size = ARRAYSIZE;
  	for (x=0;x<ARRAYSIZE;x++)
  	{
  		arrint.m_Array[x] = x;
  	}
  	printf("invoking echoIntegerArray...\n");
  	if (ws.echoIntegerArray(arrint).m_Array != NULL)
  		printf("successful\n");
  	else
  		printf("failed\n");
  	// testing echoFloat 
  	printf("invoking echoFloat...\n");
  	float fvalue = 1.4214;
  	if (ws.echoFloat(fvalue) > 1.42)
  		printf("successful\n");
  	else
  		printf("failed\n");
  	// testing echoFloat 
  	xsd__float_Array arrfloat;
  	arrfloat.m_Array = new float[ARRAYSIZE];
  	arrfloat.m_Size = ARRAYSIZE;
  	for (x=0;x<ARRAYSIZE;x++)
  	{
  		arrfloat.m_Array[x] = 1.1111*x;
  	}
  	printf("invoking echoFloatArray...\n");
  	if (ws.echoFloatArray(arrfloat).m_Array != NULL)
  		printf("successful\n");
  	else
  		printf("failed\n");
  	// testing echo Struct
  	SOAPStruct stct;
  	stct.SOAPStruct_varFloat = 12345.7346345;
  	stct.SOAPStruct_varInt = 5000;
  	stct.SOAPStruct_varString = strdup("This is string in SOAPStruct");
  	printf("invoking echoStruct...\n");
  	if (ws.echoStruct(&stct) != NULL)
  		printf("successful\n");
  	else
  		printf("failed\n");
  	//testing echo Array of Struct
  	SOAPStruct_Array arrstct;
  	arrstct.m_Array = new SOAPStruct[ARRAYSIZE];
  	arrstct.m_Size = ARRAYSIZE;
  	for (x=0;x<ARRAYSIZE;x++)
  	{
  		arrstct.m_Array[x].SOAPStruct_varFloat = 1.1111*x;
  		arrstct.m_Array[x].SOAPStruct_varInt = x;
  		sprintf(buffer1, "varString of %dth element of SOAPStruct array", x);
  		arrstct.m_Array[x].SOAPStruct_varString = buffer1;
  	}
  	//testing echo Struct Array
  	printf("invoking echoStructArray...\n");
  	if (ws.echoStructArray(arrstct).m_Array != NULL)
  		printf("successful\n");
  	else
  		printf("failed\n");
  	//testing echo void
  	printf("invoking echoVoid...\n");
  	ws.echoVoid();
  	printf("successful\n");
  	//testing echo base 64 binary
  
  	const char* bstr = "some string that is sent encoded to either base64Binary or hexBinary";
  
  	printf("invoking echoBase64...\n");
  	xsd__base64Binary bb;
  	bb.__ptr = (unsigned char*)strdup(bstr);
  	bb.__size = strlen(bstr);
  	if (bb.__size == ws.echoBase64(bb).__size)
  	{
  		printf("successful\n");
  		printf("Returned String :\n%s\n", bb.__ptr);
  	}
  	else
  		printf("failed\n");
  
  	time_t tim;
  	time(&tim);
  	tm* lt = gmtime(&tim);
  	printf("invoking echoDate...\n");
  	if (memcmp(&ws.echoDate(*lt), lt, sizeof(tm)) == 0)
  		printf("successful\n");
  	else
  		printf("failed\n");
  	//testing echo hex binary
  
  	printf("invoking echoHexBinary...\n");
  	xsd__hexBinary hb;
  	hb.__ptr = (unsigned char*)strdup(bstr);
  	hb.__size = strlen(bstr);
  	if (hb.__size == ws.echoHexBinary(hb).__size)
  	{
  		printf("successful\n");
  		printf("Returned String :\n%s\n", hb.__ptr);
  	}
  	else
  		printf("failed\n");
  	//testing echo decimal
  	printf("invoking echoDecimal...\n");
  	if (ws.echoDecimal(1234.567890) > 1234.56)
  		printf("successful\n");
  	else
  		printf("failed\n");
  	//testing echo boolean
  	printf("invoking echoBoolean...\n");
  	if (ws.echoBoolean(true_) == true_)
  		printf("successful\n");
  	else
  		printf("failed\n");
  	}
  	catch(AxisException& e)
  	{
  		printf("%s\n", e.what());
  	}
  	catch(exception& e)
  	{
  		printf("%s\n", e.what());
  	}
  	catch(...)
  	{
  		printf("Unknown exception has occured\n");
  	}
  	//getchar();
  	return 0;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/linux/testcases/client/cpp/MathOpsClient.cpp
  
  Index: MathOpsClient.cpp
  ===================================================================
  #include "MathOps.h"
  #include <axis/server/AxisException.h>
  #include <ctype.h>
  
  void PrintUsage();
  bool IsNumber(const char* p);
  
  int main(int argc, char* argv[])
  {
  	char endpoint[256];
  	const char* server="localhost";
  	const char* port="80";
  	const char* op = 0;
  	const char* p1 = 0;
  	const char* p2 = 0;
  	int i1=0, i2=0;
          int iResult;
          char* pcDetail;
          try
          {
  	printf("Sending Requests to Server http://%s:%s ........\n\n", server, port);
  	sprintf(endpoint, "http://%s:%s/axis/MathOps", server, port);
  	MathOps ws(endpoint);
  
  	op = "div";/*Operation name*/
  	i1 = 10;/*First parameter*/
  	i2 = 5;/*Second parameter*/
  
  	if (strcmp(op, "div") == 0)
  	{
  	    iResult = ws.div(i1, i2);		
              printf("Result is:%d\n", iResult);
  	}
  	else 
  	{
  		printf("Invalid operation %s\n\n", op);
  		PrintUsage();
  	}
          }
          catch(AxisException& e)
          {
              printf("%s\n", e.what());
          }
          catch(exception& e)
          {
  	    printf("Unknown exception has occured\n");
          }
          catch(...)
          {
  	    printf("Unknown exception has occured\n");
          }
  	
  	return 0;
  }
  
  void PrintUsage()
  {
  	printf("Usage :\n MathOps <server> <port> <operation> <parameter> <parameter>\n\n");
  	exit(1);
  }
  
  bool IsNumber(const char* p)
  {
  	for (int x=0; x < strlen(p); x++)
  	{
  		if (!isdigit(p[x])) return false;
  	}
  	return true;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/linux/testcases/client/cpp/RpcSoapHeaderTest10Client.cpp
  
  Index: RpcSoapHeaderTest10Client.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
   * <http://www.apache.org/>.
   *
   * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
   */
  
  #include <string>
  using namespace std;
  
  #include "InteropTestPortType.h"
  #include <axis/server/IHeaderBlock.h>
  #include <axis/server/AxisException.h>
  
  #define ARRAYSIZE 2
  
  int
  main(int argc, char *argv[])
  {
      int x;
      char buffer1[100];
      char endpoint[256];
      const char *server = "localhost";
      const char *port = "80";
      if (argc == 3)
      {
  	server = argv[1];
  	port = argv[2];
      }
      printf("Usage :\n %s <server> <port>\n\n", argv[0]);
      //sprintf(endpoint, "http://%s:%s/axis/base", server, port);
      //endpoint for Axis CPP sample
      sprintf(endpoint, "http://%s:%s/axis/base", server, port);
      InteropTestPortType ws(endpoint, APTHTTP);
  
      /*
      <SOAP-ENV:Header>
      	<ns2:TestHeader xmlns:ns2="http://ws.apache.org/axisCppTest/" xmlns:namesp1="http://mynamespace.com">
  	    <Credentials ns2:type="normal">
  		<username ns2:usertype="normal_user">Test User</username>
  		<password>Test Password</password>
  	    </Credentials>
  	</ns2:TestHeader>
      </SOAP-ENV:Header>
      */
  
      //set SOAP headers
      IHeaderBlock *phb = ws.createSOAPHeaderBlock("TestHeader", 
  		"http://ws.apache.org/axisCppTest/");
      phb->createNamespaceDecl("namesp1", "http://mynamespace.com");
  
      //create parent node
      BasicNode *parentNode = phb->createChild(ELEMENT_NODE);
      parentNode->setLocalName("Credentials");
      parentNode->createAttribute("type", "", "http://ws.apache.org/axisCppTest/", "normal");
      parentNode->createAttribute("scale", "", "http://ws.apache.org/axisCppTest/", "normal_scale");
      parentNode->createAttribute("lang1", "", "http://ws.apache.org/axisCppTest/", "normal_lang1");
      parentNode->createAttribute("lang2", "", "http://ws.apache.org/axisCppTest/", "normal_lang2");
      parentNode->createAttribute("lang3", "", "http://ws.apache.org/axisCppTest/", "normal_lang3");
  
      //create child node     
      BasicNode *childNode = phb->createChild(ELEMENT_NODE);
      childNode->setLocalName("username");
      childNode->createAttribute("usertype", "", "http://ws.apache.org/axisCppTest/", "normal_user");
      //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);
  
      /* start testing the getters for SOAP Header Attributes*/
      IAttribute* pIAttribute1 = parentNode->getFirstAttribute();
      if (pIAttribute1)
      	printf("pIAttribute1 details = %s %s \n", pIAttribute1->getLocalName(), pIAttribute1->getUri());
  
      pIAttribute1 = NULL;
      int iTmpX = 0;
      while ((pIAttribute1 = parentNode->getNextAttribute()) != NULL) {
  	printf("pIAttribute1 details = %s %s \n", pIAttribute1->getLocalName(), pIAttribute1->getUri());
  	
  	iTmpX++;
     	if (iTmpX==2) break; /*Just for a simple logic*/
      }
  
      pIAttribute1 = NULL;
      pIAttribute1 = parentNode->getCurrentAttribute();
      if (pIAttribute1)
          printf("pIAttribute1 details = %s %s \n", pIAttribute1->getLocalName(), pIAttribute1->getUri());
  
      pIAttribute1 = NULL;
      pIAttribute1 = parentNode->getLastAttribute();
      if (pIAttribute1)
      	printf("pIAttribute1 details = %s %s \n", pIAttribute1->getLocalName(), pIAttribute1->getUri());
  
      pIAttribute1 = NULL;
      pIAttribute1 = parentNode->getAttribute("", "http://ws.apache.org/axisCppTest/", "scale");
      if (pIAttribute1)
          printf("pIAttribute1 details = %s %s \n", pIAttribute1->getLocalName(), pIAttribute1->getUri());
      /*----end testing the getters for SOAP Header Attributes----- */
  
      printf("Sending Requests to end point %s \n\n", endpoint);
      printf("invoking echoString...\n");
      //testing echoString 
      try 
      {
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
  	printf("successful\n");
      else
  	printf("failed\n");
      }
      catch (AxisException& e)
      {
          printf("%s\n", e.what());
      }
      catch(...)
      {
          printf("Unknown exception\n");
      }
  
      printf("Soap Header test end\n");
      return 0;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/linux/testcases/client/cpp/RpcSoapHeaderTest1Client.cpp
  
  Index: RpcSoapHeaderTest1Client.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
   * <http://www.apache.org/>.
   *
   * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
   */
  
  #include <string>
  using namespace std;
  
  #include "InteropTestPortType.h"
  #include <axis/server/IHeaderBlock.h>
  #include <axis/server/AxisException.h>
  
  #define ARRAYSIZE 2
  
  int
  main(int argc, char *argv[])
  {
      int x;
      char buffer1[100];
      char endpoint[256];
      const char *server = "localhost";
      const char *port = "80";
      if (argc == 3)
      {
  	server = argv[1];
  	port = argv[2];
      }
      printf("Usage :\n %s <server> <port>\n\n", argv[0]);
      //sprintf(endpoint, "http://%s:%s/axis/base", server, port);
      //endpoint for Axis CPP sample
      sprintf(endpoint, "http://%s:%s/axis/base", server, port);
      InteropTestPortType ws(endpoint, APTHTTP);
  
      /*create a header of the form:
         <SOAP-ENV:Header>
         <th:newName xmlns:th="http://ws.apache.org/axisCppTest/">
         <TestAuthHeader>
         <username>Test User</username>
         <password>Test Password</password>
         </TestAuthHeader>
         </th:newName>
         </SOAP-ENV:Header>
       */
  
      //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);
  
      printf("Sending Requests to end point %s \n\n", endpoint);
      printf("invoking echoString...\n");
      //testing echoString 
      try 
      {
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
  	printf("successful\n");
      else
  	printf("failed\n");
      }
      catch (AxisException& e)
      {
          printf("%s\n", e.what());
      }
      catch(...)
      {
          printf("Unknown exception\n");
      }
  
      //test removing SOAP header block using pointer
      IHeaderBlock *header = NULL;
      header = ws.getFirstSOAPHeaderBlock();
      ws.deleteSOAPHeaderBlock(header);
      //now the request should have no SOAP headers
  
      try
      {
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
          printf("successful\n");
      else
          printf("failed\n");
      }
      catch (AxisException& e)
      {
          printf("%s\n", e.what());
      }
      catch(...)
      {
  	printf("Unknown exception\n");
      }
  
  
      printf("Soap Header test end\n");
      return 0;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/linux/testcases/client/cpp/RpcSoapHeaderTest2Client.cpp
  
  Index: RpcSoapHeaderTest2Client.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
   * <http://www.apache.org/>.
   *
   * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
   */
  
  #include <string>
  using namespace std;
  
  #include "InteropTestPortType.h"
  #include <axis/server/IHeaderBlock.h>
  #include <axis/server/AxisException.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 <server> <port>\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:
         <SOAP-ENV:Header>
         <th:newName xmlns:th="http://ws.apache.org/axisCppTest/">
         <TestAuthHeader>
         <username>Test User</username>
         <password>Test Password</password>
         </TestAuthHeader>
         </th:newName>
         </SOAP-ENV:Header>
       */
  
      //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("TestHeader2",
                                     "http://ws.apache.org/axisCppTest/");
                                                                                                                                                                              
      //create parent node
      parentNode = phb->createChild(ELEMENT_NODE);
      parentNode->setLocalName("Credentials2");
      childNode = phb->createChild(ELEMENT_NODE);
      childNode->setLocalName("username");
      valueNode = phb->createChild(CHARACTER_NODE);
      valueNode->setValue("Test User2");
      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 Password2");
      childNode->addChild(valueNode);
      parentNode->addChild(childNode);
  
      //add another node set
      childNode = phb->createChild(ELEMENT_NODE);
      childNode->setLocalName("Key");
      valueNode = phb->createChild(CHARACTER_NODE);
      valueNode->setValue("Test Key");
      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 
      try
      {
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
  	printf("successful\n");
      else
  	printf("failed\n");
      }
      catch(AxisException& e)
      {
  	printf("%s\n", e.what());
      }
      catch(...)
      {
          printf("unknown exception\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
  
      try 
      {
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
          printf("successful\n");
      else
          printf("failed\n");
      }
      catch(AxisException& e)
      {
          printf("%s\n", e.what());
      }
      catch(...)
      {
          printf("unknown exception\n");
      }
  
      printf("Soap Header test end\n");
      return 0;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/linux/testcases/client/cpp/RpcSoapHeaderTest3Client.cpp
  
  Index: RpcSoapHeaderTest3Client.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
   * <http://www.apache.org/>.
   *
   * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
   */
  
  #include <string>
  using namespace std;
  
  #include "InteropTestPortType.h"
  #include <axis/server/IHeaderBlock.h>
  #include <axis/server/AxisException.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 <server> <port>\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:
         <SOAP-ENV:Header>
         <th:newName xmlns:th="http://ws.apache.org/axisCppTest/">
         <TestAuthHeader>
         <username>Test User</username>
         <password>Test Password</password>
         </TestAuthHeader>
         </th:newName>
         <th:newName xmlns:th="http://ws.apache.org/axisCppTest/">
         <TestAuthHeader>
         <username>Test User</username>
         <password>Test Password</password>
         </TestAuthHeader>
         </th:newName>
         </SOAP-ENV:Header>
       */
  
      //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 
      try
      {
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
  	printf("successful\n");
      else
  	printf("failed\n");
      }
      catch(AxisException& e)
      {
          printf("%s\n", e.what());
      }
      catch(...)
      {
          printf("unknown exception\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
      try
      {
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
          printf("successful\n");
      else
          printf("failed\n");
      }
      catch(AxisException& e)
      {
          printf("%s\n", e.what());
      }
      catch(...)
      {
          printf("unknown exception\n");
      }
  
  
  
      printf("Soap Header test end\n");
      return 0;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/linux/testcases/client/cpp/RpcSoapHeaderTest4Client.cpp
  
  Index: RpcSoapHeaderTest4Client.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
   * <http://www.apache.org/>.
   *
   * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
   */
  
  #include <string>
  using namespace std;
  
  #include "InteropTestPortType.h"
  #include <axis/server/IHeaderBlock.h>
  #include <axis/server/AxisException.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 <server> <port>\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:
         <SOAP-ENV:Header>
         <th:newName xmlns:th="http://ws.apache.org/axisCppTest/">
         <TestAuthHeader>
         <username>Test User</username>
         <password>Test Password</password>
         </TestAuthHeader>
         </th:newName>
         </SOAP-ENV:Header>
       */
  
      //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 a element node
      BasicNode *pElementNode = phb->createChild(ELEMENT_NODE);
      pElementNode->setLocalName("ConfidentialStuff");
      //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);
      pElementNode->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);
      pElementNode->addChild(childNode);
      
      parentNode->addChild(pElementNode);
  
      phb->addChild(parentNode);
  
      //set second SOAP headers
      phb = ws.createSOAPHeaderBlock("TestHeader2",
                                     "http://ws.apache.org/axisCppTest/");
                                                                                                                                                                              
      //create parent node
      parentNode = phb->createChild(ELEMENT_NODE);
      parentNode->setLocalName("Credentials2");
       //create a element node
      pElementNode = phb->createChild(ELEMENT_NODE);
      pElementNode->setLocalName("ConfidentialStuff");
  
      childNode = phb->createChild(ELEMENT_NODE);
      childNode->setLocalName("username");
      valueNode = phb->createChild(CHARACTER_NODE);
      valueNode->setValue("Test User");
      childNode->addChild(valueNode);
      pElementNode->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);
      pElementNode->addChild(childNode);
      parentNode->addChild(pElementNode);
      phb->addChild(parentNode);
  
  
      printf("Sending Requests to end point %s \n\n", endpoint);
      printf("invoking echoString...\n");
      //testing echoString 
      try
      {
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
  	printf("successful\n");
      else
  	printf("failed\n");
      }
      catch(AxisException& e)
      {
          printf("%s\n", e.what());
      }
      catch(...)
      {
          printf("unknown exception\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
      try
      {
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
          printf("successful\n");
      else
          printf("failed\n");
      }
      catch(AxisException& e)
      {
          printf("%s\n", e.what());
      }
      catch(...)
      {
          printf("unknown exception\n");
      }
  
      printf("Soap Header test end\n");
      return 0;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/linux/testcases/client/cpp/RpcSoapHeaderTest5Client.cpp
  
  Index: RpcSoapHeaderTest5Client.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
   * <http://www.apache.org/>.
   *
   * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
   */
  
  #include <string>
  using namespace std;
  
  #include "../../gen_src/rpc/InteropTestPortType.h"
  #include <axis/server/IHeaderBlock.h>
  #include <axis/server/AxisException.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 <server> <port>\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:
         <SOAP-ENV:Header>
         <th:newName xmlns:th="http://ws.apache.org/axisCppTest/">
         </th:newName>
         </SOAP-ENV:Header>
       */
  
      //set SOAP headers
      IHeaderBlock *phb = ws.createSOAPHeaderBlock("TestHeader", 
  		"http://ws.apache.org/axisCppTest/");
  
      //buld node tree
      phb->addChild(NULL);
  
      //set second SOAP headers
      phb = ws.createSOAPHeaderBlock("TestHeader2",
                                     "http://ws.apache.org/axisCppTest/");
      phb->addChild(NULL);
  
      printf("Sending Requests to end point %s \n\n", endpoint);
      printf("invoking echoString...\n");
      //testing echoString
      try
      { 
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
  	printf("successful\n");
      else
  	printf("failed\n");
      }
      catch(AxisException& e)
      {
          printf("%s\n", e.what());
      }
      catch(...)
      {
          printf("unknown exception\n");
      }
  
  
      //test removing SOAP header block using pointer
      IHeaderBlock *header = NULL;
      header = ws.getFirstSOAPHeaderBlock();
      ws.deleteSOAPHeaderBlock(header);
      //now the request should have no SOAP headers
      try
      {
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
          printf("successful\n");
      else
          printf("failed\n");
      }
      catch(AxisException& e)
      {
          printf("%s\n", e.what());
      }
      catch(...)
      {
          printf("unknown exception\n");
      }
  
  
      printf("Soap Header test end\n");
      return 0;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/linux/testcases/client/cpp/RpcSoapHeaderTest6Client.cpp
  
  Index: RpcSoapHeaderTest6Client.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
   * <http://www.apache.org/>.
   *
   * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
   */
  
  #include <string>
  using namespace std;
  
  #include "InteropTestPortType.h"
  #include <axis/server/IHeaderBlock.h>
  #include <axis/server/AxisException.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 <server> <port>\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:
         <SOAP-ENV:Header>
         <th:newName xmlns:th="http://ws.apache.org/axisCppTest/">
         </th:newName>
         </SOAP-ENV:Header>
       */
  
      //set SOAP headers
      IHeaderBlock *phb = ws.createSOAPHeaderBlock("TestHeader", 
  		"http://ws.apache.org/axisCppTest/");
  
      //buld node tree
      phb->addChild(NULL);
  
      //set second SOAP headers
      phb = ws.createSOAPHeaderBlock("TestHeader2",
                                     "http://ws.apache.org/axisCppTest/");
      phb->addChild(NULL);
  
      printf("Sending Requests to end point %s \n\n", endpoint);
      printf("invoking echoString...\n");
      //testing echoString
      try
      { 
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
  	printf("successful\n");
      else
  	printf("failed\n");
      }
      catch(AxisException& e)
      {
          printf("%s\n", e.what());
      }
      catch(...)
      {
          printf("unknown exception\n");
      }
  
  
      //test removing SOAP header block using pointer
      IHeaderBlock *header = NULL;
      header = ws.getFirstSOAPHeaderBlock();
      ws.deleteSOAPHeaderBlock(header);
      //now the request should have no SOAP headers
      try
      {
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
          printf("successful\n");
      else
          printf("failed\n");
      }
      catch(AxisException& e)
      {
          printf("%s\n", e.what());
      }
      catch(...)
      {
          printf("unknown exception\n");
      }
  
  
      printf("Soap Header test end\n");
      return 0;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/linux/testcases/client/cpp/RpcSoapHeaderTest8Client.cpp
  
  Index: RpcSoapHeaderTest8Client.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
   * <http://www.apache.org/>.
   *
   * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
   */
  
  #include <string>
  using namespace std;
  
  #include "InteropTestPortType.h"
  #include <axis/server/IHeaderBlock.h>
  #include <axis/server/AxisException.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 <server> <port>\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:
         <SOAP-ENV:Header>
         <th:newName xmlns:th="http://ws.apache.org/axisCppTest/">
         </th:newName>
         </SOAP-ENV:Header>
       */
  
      //set SOAP headers
      IHeaderBlock *phb = ws.createSOAPHeaderBlock("TestHeader", 
  		"http://ws.apache.org/axisCppTest/");
  
      //set second SOAP headers
      phb = ws.createSOAPHeaderBlock("TestHeader2",
                                     "http://ws.apache.org/axisCppTest/");
                                                                                                                                                                             
      printf("Sending Requests to end point %s \n\n", endpoint);
      printf("invoking echoString...\n");
      //testing echoString 
      try
      {
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
  	printf("successful\n");
      else
  	printf("failed\n");
      }
      catch(AxisException& e)
      {
          printf("%s\n", e.what());
      }
      catch(...)
      {
          printf("unknown exception\n");
      }
  
  
      //test removing SOAP header block using pointer
      IHeaderBlock *header = NULL;
      header = ws.getFirstSOAPHeaderBlock();
      ws.deleteSOAPHeaderBlock(header);
      header = ws.getFirstSOAPHeaderBlock();
      ws.deleteSOAPHeaderBlock(header);
      //now the request should have no SOAP headers
      try
      {
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
          printf("successful\n");
      else
          printf("failed\n");
      }
      catch(AxisException& e)
      {
          printf("%s\n", e.what());
      }
      catch(...)
      {
          printf("unknown exception\n");
      }
  
  
  
      printf("Soap Header test end\n");
      return 0;
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/linux/testcases/client/cpp/RpcSoapHeaderTest9Client.cpp
  
  Index: RpcSoapHeaderTest9Client.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
   * <http://www.apache.org/>.
   *
   * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
   */
  
  #include <string>
  using namespace std;
  
  #include "InteropTestPortType.h"
  #include <axis/server/IHeaderBlock.h>
  #include <axis/server/AxisException.h>
  
  #define ARRAYSIZE 2
  
  int
  main(int argc, char *argv[])
  {
      int x;
      char buffer1[100];
      char endpoint[256];
      const char *server = "localhost";
      const char *port = "80";
      if (argc == 3)
      {
  	server = argv[1];
  	port = argv[2];
      }
      printf("Usage :\n %s <server> <port>\n\n", argv[0]);
      //sprintf(endpoint, "http://%s:%s/axis/base", server, port);
      //endpoint for Axis CPP sample
      sprintf(endpoint, "http://%s:%s/axis/base", server, port);
      InteropTestPortType ws(endpoint, APTHTTP);
  
      /*
      <SOAP-ENV:Header>
      	<ns2:TestHeader xmlns:ns2="http://ws.apache.org/axisCppTest/" xmlns:namesp1="http://mynamespace.com">
  	    <Credentials ns2:type="normal">
  		<username ns2:usertype="normal_user">Test User</username>
  		<password>Test Password</password>
  	    </Credentials>
  	</ns2:TestHeader>
      </SOAP-ENV:Header>
      */
  
      //set SOAP headers
      IHeaderBlock *phb = ws.createSOAPHeaderBlock("TestHeader", 
  		"http://ws.apache.org/axisCppTest/");
      phb->createNamespaceDecl("namesp1", "http://mynamespace.com");
  
      //create parent node
      BasicNode *parentNode = phb->createChild(ELEMENT_NODE);
      parentNode->setLocalName("Credentials");
      parentNode->createAttribute("type", "", "http://ws.apache.org/axisCppTest/", "normal");
      //create child node     
      BasicNode *childNode = phb->createChild(ELEMENT_NODE);
      childNode->setLocalName("username");
      childNode->createAttribute("usertype", "", "http://ws.apache.org/axisCppTest/", "normal_user");
      //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);
  
      printf("Sending Requests to end point %s \n\n", endpoint);
      printf("invoking echoString...\n");
      //testing echoString 
      try 
      {
      if (0 == strcmp(ws.echoString("hello world"), "hello world"))
  	printf("successful\n");
      else
  	printf("failed\n");
      }
      catch (AxisException& e)
      {
          printf("%s\n", e.what());
      }
      catch(...)
      {
          printf("Unknown exception\n");
      }
  
      printf("Soap Header test end\n");
      return 0;
  }