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 pe...@apache.org on 2005/03/08 17:45:58 UTC

cvs commit: ws-axis/c/tests/auto_build/testcases/wsdls SimpleArrays.wsdl

perryan     2005/03/08 08:45:58

  Added:       c/tests/auto_build/testcases/client/cpp
                        SimpleArraysClient.cpp
               c/tests/auto_build/testcases/tests SimpleArrays.xml
               c/tests/auto_build/testcases/wsdls SimpleArrays.wsdl
  Log:
  New test framework files to test the serialization and deserialization of simple data types in an array of that data type
  
  Revision  Changes    Path
  1.1                  ws-axis/c/tests/auto_build/testcases/client/cpp/SimpleArraysClient.cpp
  
  Index: SimpleArraysClient.cpp
  ===================================================================
  
  using namespace std;
  
  #include "SimpleArrays.hpp"
  #include <axis/AxisException.hpp>
  #include <iostream>
  
  #define ARRAYSIZE 2
  
  int main(int argc, char* argv[])
  {
  	const char* url="http://localhost:80/axis/SimpleArrays";
  	char endpoint[256];
  
  	if(argc>1)
  		url = argv[1];
  
  	try
  	{
  		sprintf(endpoint, "%s", url);
  		SimpleArrays ws(endpoint);
  
  		xsd__boolean_Array boolean_in;
  		xsd__boolean_Array boolean_out;
  		xsd__byte_Array byte_in;
  		xsd__byte_Array byte_out;
  		xsd__short_Array short_in;
  		xsd__short_Array short_out;
  		xsd__int_Array int_in;
  		xsd__int_Array int_out;
  		xsd__long_Array long_in;
  		xsd__long_Array long_out;
  		xsd__float_Array float_in;
  		xsd__float_Array float_out;
  		xsd__double_Array double_in;
  		xsd__double_Array double_out;
  		xsd__string_Array string_in;
  		xsd__string_Array string_out;
  
  
  		/* Test a boolean array */
  		boolean_in.m_Array = new xsd__boolean[ARRAYSIZE];
  		boolean_in.m_Size = ARRAYSIZE;
  		for (int x=0; x<ARRAYSIZE; x++)
  		{
  			boolean_in.m_Array[x] = (xsd__boolean)x;
  		}
  		cout << "invoking echoBooleanArray..."<<endl;
  		boolean_out = ws.echoBooleanArray(boolean_in);
  		if(boolean_out.m_Size > 0)
  			if(boolean_out.m_Array[0] == (xsd__boolean)0)
  				cout << "successful "<<endl;
  			else
  				cout << "failed "<<endl;		
  		else
  			cout << "failed "<<endl;		
  
  		/* Test a byte array - that is directly rather than as base64Binary */
  		byte_in.m_Array = new xsd__byte[ARRAYSIZE];
  		byte_in.m_Size = ARRAYSIZE;
  		for (int x=0; x<ARRAYSIZE; x++)
  		{
  			byte_in.m_Array[x] = (xsd__byte)x+31;
  		}
  		cout << "invoking echoByteArray..."<<endl;
  		byte_out = ws.echoByteArray(byte_in);
  		if(byte_out.m_Size > 0)
  			if(byte_out.m_Array[0] == (xsd__byte)31)
  				cout << "successful "<<endl;
  			else
  				cout << "failed "<<endl;		
  		else
  			cout << "failed "<<endl;		
  
  		/* Test an short array */
  		short_in.m_Array = new xsd__short[ARRAYSIZE];
  		short_in.m_Size = ARRAYSIZE;
  		for (int x=0; x<ARRAYSIZE; x++)
  		{
  			short_in.m_Array[x] = x+250;
  		}
  		cout << "invoking echoIntArray..."<<endl;
  		short_out = ws.echoIntArray(short_in);
  		if(short_out.m_Size > 0)
  			if(short_out.m_Array[0] == 250)
  				cout << "successful "<<endl;
  			else
  				cout << "failed "<<endl;		
  		else
  			cout << "failed "<<endl;		
  
  		/* Test an int array */
  		int_in.m_Array = new xsd__int[ARRAYSIZE];
  		int_in.m_Size = ARRAYSIZE;
  		for (int x=0; x<ARRAYSIZE; x++)
  		{
  			int_in.m_Array[x] = x+1;
  		}
  		cout << "invoking echoIntArray..."<<endl;
  		int_out = ws.echoIntArray(int_in);
  		if(int_out.m_Size > 0)
  			if(int_out.m_Array[0] == 1)
  				cout << "successful "<<endl;
  			else
  				cout << "failed "<<endl;		
  		else
  			cout << "failed "<<endl;
  
  		/* Test a long array */
  		long_in.m_Array = new xsd__long[ARRAYSIZE];
  		long_in.m_Size = ARRAYSIZE;
  		for (int x=0; x<ARRAYSIZE; x++)
  		{
  			long_in.m_Array[x] = (xsd__long)x+200001;
  		}
  		cout << "invoking echoLongArray..."<<endl;
  		long_out = ws.echoLongArray(long_in);
  		if(long_out.m_Size > 0)
  			if(long_out.m_Array[0] == (xsd__long)200001)
  				cout << "successful "<<endl;
  			else
  				cout << "failed "<<endl;		
  		else
  			cout << "failed "<<endl;		
  
  
  		/* Test a float array */
  		float_in.m_Array = new xsd__float[ARRAYSIZE];
  		float_in.m_Size = ARRAYSIZE;
  		for (int x=0; x<ARRAYSIZE; x++)
  		{
  			float_in.m_Array[x] = (xsd__float)x+11.111;
  		}
  		cout << "invoking echoFloatArray..."<<endl;
  		float_out = ws.echoFloatArray(float_in);
  		if(float_out.m_Size > 0)
  			if(float_out.m_Array[0] == (xsd__float)11.111)
  				cout << "successful "<<endl;
  			else
  				cout << "failed "<<endl;		
  		else
  			cout << "failed "<<endl;		
  
  		/* Test a double array */
  		double_in.m_Array = new xsd__double[ARRAYSIZE];
  		double_in.m_Size = ARRAYSIZE;
  		for (int x=0; x<ARRAYSIZE; x++)
  		{
  			double_in.m_Array[x] = (xsd__double)x+71.15656;
  		}
  		cout << "invoking echoDoubleArray..."<<endl;
  		double_out = ws.echoDoubleArray(double_in);
  		if(double_out.m_Size > 0)
  			if(double_out.m_Array[0] == (xsd__double)71.15656)
  				cout << "successful "<<endl;
  			else
  				cout << "failed "<<endl;		
  		else
  			cout << "failed "<<endl;		
  
  		/* Test a string array */
  		static char* str1 = "Apache";
  		static char* str2 = "Axis C++";
  		string_in.m_Array = new xsd__string[ARRAYSIZE];
  		string_in.m_Size = ARRAYSIZE;
  		string_in.m_Array[0] = str1;
  		string_in.m_Array[1] = str2;
  		cout << "invoking echoStringArray..."<<endl;
  		string_out = ws.echoStringArray(string_in);
  		if(string_out.m_Size > 0)
  			if(strcmp(string_out.m_Array[0], str1) == 0)
  				cout << "successful "<<endl;
  			else
  				cout << "failed "<<endl;		
  		else
  			cout << "failed "<<endl;		
  
  	}
  	catch(AxisException& e)
  	{
  	    cout << "Exception : "<< e.what()<<endl;
  	}
  	catch(exception& e)
  	{
  	    cout << "Unknown exception has occured"<<endl;
  	}
  	catch(...)
  	{
  	    cout << "Unknown exception has occured"<<endl;
  	}
  	cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
  	return 0;
  }
  
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/tests/SimpleArrays.xml
  
  Index: SimpleArrays.xml
  ===================================================================
  <test>
      <name>SimpleArrays</name>
      <description>SimpleArrays</description>
      <clientLang>cpp</clientLang>
      <clientCode>SimpleArraysClient.cpp</clientCode>
      <wsdl>SimpleArrays.wsdl</wsdl>
      <expected>
          <output>
              SimpleArrayDoc.cpp.out
          </output>
      </expected>
  	<endpoint>http://localhost:80/SimpleArrays/services/SimpleArrays</endpoint>
  </test>
  
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/wsdls/SimpleArrays.wsdl
  
  Index: SimpleArrays.wsdl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <wsdl:definitions targetNamespace="http://arrays.test.apache.org" xmlns:impl="http://arrays.test.apache.org" xmlns:intf="http://arrays.test.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <wsdl:types>
    <schema elementFormDefault="qualified" targetNamespace="http://arrays.test.apache.org" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:impl="http://arrays.test.apache.org" xmlns:intf="http://arrays.test.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <element name="echoBooleanArray">
      <complexType>
       <sequence>
        <element maxOccurs="unbounded" minOccurs="0" name="arg_0_0" type="xsd:boolean"/>
       </sequence>
      </complexType>
     </element>
     <element name="echoBooleanArrayResponse">
      <complexType>
       <sequence>
        <element maxOccurs="unbounded" minOccurs="0" name="echoBooleanArrayReturn" type="xsd:boolean"/>
       </sequence>
      </complexType>
     </element>
     <element name="echoByteArray">
      <complexType>
       <sequence>
        <element name="arg_0_1" type="xsd:base64Binary"/>
       </sequence>
      </complexType>
     </element>
     <element name="echoByteArrayResponse">
      <complexType>
       <sequence>
        <element name="echoByteArrayReturn" type="xsd:base64Binary"/>
       </sequence>
      </complexType>
     </element>
     <element name="echoShortArray">
      <complexType>
       <sequence>
        <element maxOccurs="unbounded" minOccurs="0" name="arg_0_2" type="xsd:short"/>
       </sequence>
      </complexType>
     </element>
     <element name="echoShortArrayResponse">
      <complexType>
       <sequence>
        <element maxOccurs="unbounded" minOccurs="0" name="echoShortArrayReturn" type="xsd:short"/>
       </sequence>
      </complexType>
     </element>
     <element name="echoIntArray">
      <complexType>
       <sequence>
        <element maxOccurs="unbounded" minOccurs="0" name="arg_0_3" type="xsd:int"/>
       </sequence>
      </complexType>
     </element>
     <element name="echoIntArrayResponse">
      <complexType>
       <sequence>
        <element maxOccurs="unbounded" minOccurs="0" name="echoIntArrayReturn" type="xsd:int"/>
       </sequence>
      </complexType>
     </element>
     <element name="echoLongArray">
      <complexType>
       <sequence>
        <element maxOccurs="unbounded" minOccurs="0" name="arg_0_4" type="xsd:long"/>
       </sequence>
      </complexType>
     </element>
     <element name="echoLongArrayResponse">
      <complexType>
       <sequence>
        <element maxOccurs="unbounded" minOccurs="0" name="echoLongArrayReturn" type="xsd:long"/>
       </sequence>
      </complexType>
     </element>
     <element name="echoFloatArray">
      <complexType>
       <sequence>
        <element maxOccurs="unbounded" minOccurs="0" name="arg_0_5" type="xsd:float"/>
       </sequence>
      </complexType>
     </element>
     <element name="echoFloatArrayResponse">
      <complexType>
       <sequence>
        <element maxOccurs="unbounded" minOccurs="0" name="echoFloatArrayReturn" type="xsd:float"/>
       </sequence>
      </complexType>
     </element>
     <element name="echoDoubleArray">
      <complexType>
       <sequence>
        <element maxOccurs="unbounded" minOccurs="0" name="arg_0_6" type="xsd:double"/>
       </sequence>
      </complexType>
     </element>
     <element name="echoDoubleArrayResponse">
      <complexType>
       <sequence>
        <element maxOccurs="unbounded" minOccurs="0" name="echoDoubleArrayReturn" type="xsd:double"/>
       </sequence>
      </complexType>
     </element>
     <element name="echoStringArray">
      <complexType>
       <sequence>
        <element maxOccurs="unbounded" minOccurs="0" name="arg_0_7" type="xsd:string"/>
       </sequence>
      </complexType>
     </element>
     <element name="echoStringArrayResponse">
      <complexType>
       <sequence>
        <element maxOccurs="unbounded" minOccurs="0" name="echoStringArrayReturn" type="xsd:string"/>
       </sequence>
      </complexType>
     </element>
    </schema>
   </wsdl:types>
     <wsdl:message name="echoDoubleArrayRequest">
        <wsdl:part element="impl:echoDoubleArray" name="parameters"/>
     </wsdl:message>
     <wsdl:message name="echoIntArrayResponse">
        <wsdl:part element="impl:echoIntArrayResponse" name="parameters"/>
     </wsdl:message>
     <wsdl:message name="echoByteArrayRequest">
        <wsdl:part element="impl:echoByteArray" name="parameters"/>
     </wsdl:message>
     <wsdl:message name="echoShortArrayRequest">
        <wsdl:part element="impl:echoShortArray" name="parameters"/>
     </wsdl:message>
     <wsdl:message name="echoShortArrayResponse">
        <wsdl:part element="impl:echoShortArrayResponse" name="parameters"/>
     </wsdl:message>
     <wsdl:message name="echoIntArrayRequest">
        <wsdl:part element="impl:echoIntArray" name="parameters"/>
     </wsdl:message>
     <wsdl:message name="echoDoubleArrayResponse">
        <wsdl:part element="impl:echoDoubleArrayResponse" name="parameters"/>
     </wsdl:message>
     <wsdl:message name="echoBooleanArrayResponse">
        <wsdl:part element="impl:echoBooleanArrayResponse" name="parameters"/>
     </wsdl:message>
     <wsdl:message name="echoBooleanArrayRequest">
        <wsdl:part element="impl:echoBooleanArray" name="parameters"/>
     </wsdl:message>
     <wsdl:message name="echoLongArrayRequest">
        <wsdl:part element="impl:echoLongArray" name="parameters"/>
     </wsdl:message>
     <wsdl:message name="echoFloatArrayRequest">
        <wsdl:part element="impl:echoFloatArray" name="parameters"/>
     </wsdl:message>
     <wsdl:message name="echoByteArrayResponse">
        <wsdl:part element="impl:echoByteArrayResponse" name="parameters"/>
     </wsdl:message>
     <wsdl:message name="echoStringArrayRequest">
        <wsdl:part element="impl:echoStringArray" name="parameters"/>
     </wsdl:message>
     <wsdl:message name="echoLongArrayResponse">
        <wsdl:part element="impl:echoLongArrayResponse" name="parameters"/>
     </wsdl:message>
     <wsdl:message name="echoStringArrayResponse">
        <wsdl:part element="impl:echoStringArrayResponse" name="parameters"/>
     </wsdl:message>
     <wsdl:message name="echoFloatArrayResponse">
        <wsdl:part element="impl:echoFloatArrayResponse" name="parameters"/>
     </wsdl:message>
  
     <wsdl:portType name="SimpleArrays">
        <wsdl:operation name="echoBooleanArray">
           <wsdl:input message="impl:echoBooleanArrayRequest" name="echoBooleanArrayRequest"/>
           <wsdl:output message="impl:echoBooleanArrayResponse" name="echoBooleanArrayResponse"/>
        </wsdl:operation>
        <wsdl:operation name="echoByteArray">
           <wsdl:input message="impl:echoByteArrayRequest" name="echoByteArrayRequest"/>
           <wsdl:output message="impl:echoByteArrayResponse" name="echoByteArrayResponse"/>
        </wsdl:operation>
        <wsdl:operation name="echoShortArray">
           <wsdl:input message="impl:echoShortArrayRequest" name="echoShortArrayRequest"/>
           <wsdl:output message="impl:echoShortArrayResponse" name="echoShortArrayResponse"/>
        </wsdl:operation>
        <wsdl:operation name="echoIntArray">
           <wsdl:input message="impl:echoIntArrayRequest" name="echoIntArrayRequest"/>
           <wsdl:output message="impl:echoIntArrayResponse" name="echoIntArrayResponse"/>
        </wsdl:operation>
        <wsdl:operation name="echoLongArray">
           <wsdl:input message="impl:echoLongArrayRequest" name="echoLongArrayRequest"/>
           <wsdl:output message="impl:echoLongArrayResponse" name="echoLongArrayResponse"/>
        </wsdl:operation>
        <wsdl:operation name="echoFloatArray">
           <wsdl:input message="impl:echoFloatArrayRequest" name="echoFloatArrayRequest"/>
           <wsdl:output message="impl:echoFloatArrayResponse" name="echoFloatArrayResponse"/>
        </wsdl:operation>
        <wsdl:operation name="echoDoubleArray">
           <wsdl:input message="impl:echoDoubleArrayRequest" name="echoDoubleArrayRequest"/>
           <wsdl:output message="impl:echoDoubleArrayResponse" name="echoDoubleArrayResponse"/>
        </wsdl:operation>
        <wsdl:operation name="echoStringArray">
           <wsdl:input message="impl:echoStringArrayRequest" name="echoStringArrayRequest"/>
           <wsdl:output message="impl:echoStringArrayResponse" name="echoStringArrayResponse"/>
        </wsdl:operation>
     </wsdl:portType>
  
     <wsdl:binding name="SimpleArraysSoapBinding" type="impl:SimpleArrays">
        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="echoBooleanArray">
           <wsdlsoap:operation soapAction=""/>
           <wsdl:input name="echoBooleanArrayRequest">
              <wsdlsoap:body use="literal"/>
           </wsdl:input>
           <wsdl:output name="echoBooleanArrayResponse">
              <wsdlsoap:body use="literal"/>
           </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="echoByteArray">
           <wsdlsoap:operation soapAction=""/>
           <wsdl:input name="echoByteArrayRequest">
              <wsdlsoap:body use="literal"/>
           </wsdl:input>
           <wsdl:output name="echoByteArrayResponse">
              <wsdlsoap:body use="literal"/>
           </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="echoShortArray">
           <wsdlsoap:operation soapAction=""/>
           <wsdl:input name="echoShortArrayRequest">
              <wsdlsoap:body use="literal"/>
           </wsdl:input>
           <wsdl:output name="echoShortArrayResponse">
              <wsdlsoap:body use="literal"/>
           </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="echoIntArray">
           <wsdlsoap:operation soapAction=""/>
           <wsdl:input name="echoIntArrayRequest">
              <wsdlsoap:body use="literal"/>
           </wsdl:input>
           <wsdl:output name="echoIntArrayResponse">
              <wsdlsoap:body use="literal"/>
           </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="echoLongArray">
           <wsdlsoap:operation soapAction=""/>
           <wsdl:input name="echoLongArrayRequest">
              <wsdlsoap:body use="literal"/>
           </wsdl:input>
           <wsdl:output name="echoLongArrayResponse">
              <wsdlsoap:body use="literal"/>
           </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="echoFloatArray">
           <wsdlsoap:operation soapAction=""/>
           <wsdl:input name="echoFloatArrayRequest">
              <wsdlsoap:body use="literal"/>
           </wsdl:input>
           <wsdl:output name="echoFloatArrayResponse">
              <wsdlsoap:body use="literal"/>
           </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="echoDoubleArray">
           <wsdlsoap:operation soapAction=""/>
           <wsdl:input name="echoDoubleArrayRequest">
              <wsdlsoap:body use="literal"/>
           </wsdl:input>
           <wsdl:output name="echoDoubleArrayResponse">
              <wsdlsoap:body use="literal"/>
           </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="echoStringArray">
           <wsdlsoap:operation soapAction=""/>
           <wsdl:input name="echoStringArrayRequest">
              <wsdlsoap:body use="literal"/>
           </wsdl:input>
           <wsdl:output name="echoStringArrayResponse">
              <wsdlsoap:body use="literal"/>
           </wsdl:output>
        </wsdl:operation>
     </wsdl:binding>
  
     <wsdl:service name="SimpleArraysService">
        <wsdl:port binding="impl:SimpleArraysSoapBinding" name="SimpleArraysPort">
           <wsdlsoap:address location="http://lion:9080/SimpleArrays/services/SimpleArraysPort"/>
        </wsdl:port>
     </wsdl:service>
  </wsdl:definitions>