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 cd...@apache.org on 2005/06/23 10:55:25 UTC

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

cdinapala    2005/06/23 01:55:25

  Added:       c/tests/auto_build/testcases/client/cpp
                        MinOccurTestClient.cpp
               c/tests/auto_build/testcases/output MinOccur.expected
               c/tests/auto_build/testcases/tests MinOccur.xml
               c/tests/auto_build/testcases/tests/server MinOccur.xml
               c/tests/auto_build/testcases/wsdls MinOccurTest.wsdl
  Log:
  Add the new test to check MinOccurs="0" works.
  
  Revision  Changes    Path
  1.1                  ws-axis/c/tests/auto_build/testcases/client/cpp/MinOccurTestClient.cpp
  
  Index: MinOccurTestClient.cpp
  ===================================================================
  #include "AllComplexType.hpp"
  #include "AllTestSoap.hpp"
  #include <iostream>
  #include <axis/AxisException.hpp>
  #include <ctype.h>
  
  #define WSDL_DEFAULT_ENDPOINT "http://localhost:80/axis/MinOccur"
  
  void PrintUsage();
  
  static void
  usage (char *programName, char *defaultURL)
  {
      cout << "\nUsage:\n"
  	<< programName << " [-? | service_url] " << endl
  	<< "    -?             Show this help.\n"
  	<< "    service_url    URL of the service.\n"
  	<< "    Default service URL is assumed to be " << defaultURL << endl;
  }
  
  int
  main (int argc, char *argv[])
  {
      char endpoint[256];
      sprintf (endpoint, "%s", WSDL_DEFAULT_ENDPOINT);
  
      int returnValue = 1;	// Assume Failure
  
         if (argc > 1)
      {
  		// Watch for special case help request
  		if (!strncmp (argv[1], "-", 1))	// Check for - only so that it works for
  			//-?, -h or --help; -anything
  		{
  			usage (argv[0], endpoint);
  			return 2;
  		}
  		sprintf (endpoint, argv[1]);
  	}
  
  	bool bSuccess = false;
      int iRetryIterationCount = 3;
  
  	do
      {
  		try
  		{
  			AllTestSoap ws (endpoint, APTHTTP1_1);
  			AllComplexType* inParam = new AllComplexType();
  
  			inParam->Value0 = 8;
  			inParam->Value1 = 3;
  			inParam->Value3 = "HELLO";
  			inParam->Value6 = "TINTIN";
  
  			printf("\nSending.................");
  			printf("\nValue0 = %d",inParam->Value0);
  			printf("\nValue1 = %d",inParam->Value1);
  			printf("\nValue3 = %s",inParam->Value3);
  			printf("\nValue6 = %s",inParam->Value6);
  			
  			ws.setTransportProperty("SOAPAction" , "MinOccur#echoAll");
  			AllComplexType* outParam = ws.echoAll(inParam);
  
  			if (outParam != NULL)
  			{
  				printf("\n\nReceived................");
  				printf("\nValue0 = %d",outParam->Value0);
  				printf("\nValue1 = %d",outParam->Value1);
  				printf("\nValue3 = %s",outParam->Value3);
  				printf("\nValue6 = %s",outParam->Value6);
  				printf("\n\nSuccessfull\n");
  			}
  			else
  				printf("\nFault\n");
  
  			bSuccess = true;
  			delete inParam;
  			delete outParam;
  		}
  		catch (AxisException & e)
  		{
  			bool bSilent = false;
  
  			if (e.getExceptionCode () ==
  			CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
  			{
  			if (iRetryIterationCount > 0)
  			{
  				bSilent = true;
  			}
  			}
  			else
  			{
  			iRetryIterationCount = 0;
  			}
  
  			if (!bSilent)
  			{
  			printf ("%s\n", e.what ());
  			}
  		}
  		catch (exception & e)
  		{
  			printf ("%s\n", e.what ());
  		}	
  		catch (...)
  		{
  			cerr << "Unknown Exception occured." << endl;
  		}
  
  		iRetryIterationCount--;
  
  	}while (iRetryIterationCount > 0 && !bSuccess);
  
      cout <<
  	"---------------------- TEST COMPLETE -----------------------------"
  	<< endl;
      
  	return returnValue;
  
  }
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/output/MinOccur.expected
  
  Index: MinOccur.expected
  ===================================================================
  
  Sending.................
  Value0 = 8
  Value1 = 3
  Value3 = HELLO
  Value6 = TINTIN
  
  Received................
  Value0 = 8
  Value1 = 3
  Value3 = HELLO
  Value6 = TINTIN
  
  Successfull
  ---------------------- TEST COMPLETE -----------------------------
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/tests/MinOccur.xml
  
  Index: MinOccur.xml
  ===================================================================
  <test>
      <name>MinOccur</name>
      <description>MinOccurTest</description>
      <clientLang>cpp</clientLang>
      <clientCode>MinOccurTestClient.cpp</clientCode>
      <wsdl>MinOccurTest.wsdl</wsdl>
      <expected>
          <output>
              MinOccur.expected
          </output>
      </expected>
  	<endpoint>http://localhost:80/axis/MinOccur</endpoint>
  </test>
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/tests/server/MinOccur.xml
  
  Index: MinOccur.xml
  ===================================================================
  <service>
      <name>MinOccur</name>
      <description>MinOccurTest</description>
      <serviceLang>cpp</serviceLang>
      <serviceCode>AllTestSoap.cpp</serviceCode>
      <wsdl>MinOccurTest.wsdl</wsdl>
  	<servicename></servicename>
  </service>
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/wsdls/MinOccurTest.wsdl
  
  Index: MinOccurTest.wsdl
  ===================================================================
  <?xml version="1.0" encoding="utf-8"?>
  <definitions xmlns:s1="http://soapinterop.org/xsd" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://soapinterop.org/" xmlns:s3="http://soapinterop.org/echoheader/" xmlns:soap12enc="http://www.w3.org/2002/06/soap-envelope" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s2="http://soapinterop.org" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://soapinterop.org/" xmlns="http://schemas.xmlsoap.org/wsdl/">
    <types>
      <s:schema elementFormDefault="qualified" targetNamespace="http://soapinterop.org/">
        <s:import namespace="http://soapinterop.org/xsd" />
        <s:import namespace="http://soapinterop.org/echoheader/" />
        
        
        
        <s:element name="echoAll">
          <s:complexType>
            <s:sequence>
              <s:element name="inputAll" type="s1:AllComplexType" />
            </s:sequence>
          </s:complexType>
        </s:element>
        <s:element name="echoAllResponse">
          <s:complexType>
            <s:sequence>
              <s:element name="return" type="s1:AllComplexType" />
            </s:sequence>
          </s:complexType>
        </s:element>
        
      
        
      </s:schema> 
  
      <s:schema elementFormDefault="qualified" targetNamespace="http://soapinterop.org/xsd">
        <s:import namespace="http://soapinterop.org/" />
  
      <s:complexType name="AllComplexType">
  		<s:sequence>
  			<s:element minOccurs="1" maxOccurs="1" name="Value0" type="s:int" />
  			<s:element name="Value1" type="s:int" />
  			<s:element minOccurs="0" name="Value2" type="s:int" />
  			<s:element minOccurs="0" name="Value3" type="s:string" nillable="true" />
  			<s:element minOccurs="0" name="Value4" type="s:int" nillable="true" />
  			<s:element minOccurs="0" name="Value5" type="s:string" />
  			<s:element minOccurs="1" maxOccurs="1" name="Value6" type="s:string" />
  		</s:sequence>
        </s:complexType>
      </s:schema>
   
    </types>
    
    
    
    <message name="echoAllSoapIn">
      <part name="parameters" element="s0:echoAll" />
    </message>
    <message name="echoAllSoapOut">
      <part name="parameters" element="s0:echoAllResponse" />
    </message>
    
    <portType name="AllTestSoap">
      
      
      <operation name="echoAll">
        <input message="s0:echoAllSoapIn" />
        <output message="s0:echoAllSoapOut" />
      </operation>
      
    </portType>
    
  
    <binding name="AllTestSoap" type="s0:AllTestSoap">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
      
      <operation name="echoAll">
        <soap:operation soapAction="SimpleAllTest#echoAll" style="document" />
        <input>
          <soap:body use="literal" />
        </input>
        <output>
          <soap:body use="literal" />
        </output>
      </operation>
      
    </binding>
    
  <binding name="AllTestSoap12" type="s0:AllTestSoap">
      <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
      
      
      <operation name="echoAll">
        <soap12:operation soapAction="All#echoAll" style="document" />
        <input>
          <soap12:body use="literal" />
        </input>
        <output>
          <soap12:body use="literal" />
        </output>
      </operation>
      
    </binding>
    
  <service name="AllTest">
      <documentation>These operations implement DOC/LIT SOAP operations, for interop testing. Please email johnko@microsoft.com with any questions/coments.</documentation>
      <port name="AllTestSoap" binding="s0:AllTestSoap">
        <soap:address location="http://localhost:90/axis/All" />
      </port>
      <port name="AllTestSoap12" binding="s0:AllTestSoap12">
        <soap12:address location="http://localhost:90/axis/All" />
      </port>
    </service>
  </definitions>