axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject cvs commit: ws-axis/c/tests/auto_build/testcases/tests CalculatorDocSSLConfigFile.xml
Date Tue, 26 Jul 2005 16:23:44 GMT
dicka       2005/07/26 09:23:44

  Modified:    c/build  executeTest.xml
               c/include/axis/client Stub.hpp
               c/src/engine/client Call.cpp Stub.cpp
               c/src/transport/axis3 HTTPTransport.cpp
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal
                        ClientStubHeaderWriter.java ClientStubWriter.java
               c/tests/auto_build/testcases/client/cpp
                        CalculatorDocSSLClient.cpp
  Added:       c/tests/auto_build/testcases/client/cpp
                        CalculatorDocSSLConfigFileClient.cpp
               c/tests/auto_build/testcases/tests
                        CalculatorDocSSLConfigFile.xml
  Log:
  Resolve problems being seen with setting SSL properties via API and configuration file.
  
  Submitted by: Adrian Dick
  
  Revision  Changes    Path
  1.39      +1 -0      ws-axis/c/build/executeTest.xml
  
  Index: executeTest.xml
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/build/executeTest.xml,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- executeTest.xml	12 Jul 2005 11:46:00 -0000	1.38
  +++ executeTest.xml	26 Jul 2005 16:23:43 -0000	1.39
  @@ -301,6 +301,7 @@
   			<then>
   				<echo file="${axiscpp.conf}" append="true">
   ClientLogPath:${test.directory}/ClientLog.taw
  +SecureInfo:${env.SSL_KEYS_HOME}/myKeyRing.kdb,axis4all,AXIS,NONE,05,NONE,false
   </echo>
   			</then>
   		</if>
  
  
  
  1.26      +15 -0     ws-axis/c/include/axis/client/Stub.hpp
  
  Index: Stub.hpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/client/Stub.hpp,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- Stub.hpp	22 Jul 2005 05:32:56 -0000	1.25
  +++ Stub.hpp	26 Jul 2005 16:23:43 -0000	1.26
  @@ -636,6 +636,11 @@
   	 * automatically deleted by Axis C++ if it is passed as a parameter to a web service.
   	 */
   	ISoapAttachment* createSoapAttachment();
  + 
  +    /**
  +     * Set SSL configuration properties.
  +     */
  +    void AXISCALL SetSecure( char *, ...);
   
     protected:
     /**
  @@ -646,6 +651,10 @@
       */
       void applyUserPreferences();
   
  +    /**
  +     * Apply SSL configuration properties.
  +     */
  +    void includeSecure();
       
     /**
       * Set SOAP Headers stored in m_vSOAPHeaderBlock vector.
  @@ -706,6 +715,12 @@
       * proxy Password
       */
      char* m_proxyPassword;
  +   
  +private:
  +    /**
  +     * SSL configuration parameters
  +     */
  +    std::string m_sArguments[8];
   };
   
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.122     +0 -27     ws-axis/c/src/engine/client/Call.cpp
  
  Index: Call.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/engine/client/Call.cpp,v
  retrieving revision 1.121
  retrieving revision 1.122
  diff -u -r1.121 -r1.122
  --- Call.cpp	7 Jul 2005 16:29:01 -0000	1.121
  +++ Call.cpp	26 Jul 2005 16:23:43 -0000	1.122
  @@ -72,33 +72,6 @@
   			}
   		}
   
  -        // SSL channel related initilizations
  -        char * pcSSLChannelInfo = g_pConfig->getAxisConfProperty( AXCONF_SECUREINFO);
  -		if( pcSSLChannelInfo && strlen( pcSSLChannelInfo) > 0)
  -		{
  -			char *	pszArgPtr = NULL;
  -			int		iArgIndex = 0;
  -			string	sArguments[8];
  -
  -			pszArgPtr = strtok( pcSSLChannelInfo, ",");
  -
  -			while( pszArgPtr != NULL && iArgIndex < 8)
  -			{
  -				sArguments[iArgIndex] = pszArgPtr;
  -
  -				iArgIndex++;
  -
  -				pszArgPtr = strtok( NULL, ",");
  -
  -				while( pszArgPtr != NULL && *pszArgPtr == ' ' && *pszArgPtr != '\0')
  -				{
  -					pszArgPtr++;
  -				}
  -			}
  -
  -			m_nStatus = m_pTransport->setTransportProperty( SECURE_PROPERTIES, (const char *)
&sArguments);
  -		}
  -
           // Engine initialization
           m_pAxisEngine = new ClientAxisEngine ();
           if (!m_pAxisEngine) 
  
  
  
  1.50      +65 -0     ws-axis/c/src/engine/client/Stub.cpp
  
  Index: Stub.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/engine/client/Stub.cpp,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- Stub.cpp	22 Jul 2005 05:32:56 -0000	1.49
  +++ Stub.cpp	26 Jul 2005 16:23:43 -0000	1.50
  @@ -25,6 +25,10 @@
   #include "../../soap/SoapSerializer.h"
   #include "../../common/AxisUtils.h"
   #include "../../soap/apr_base64.h"
  +#include "../../common/AxisConfig.h"
  +#include "../../common/AxisGenException.h"
  +
  +extern AXIS_CPP_NAMESPACE_PREFIX AxisConfig* g_pConfig;
   
   AXIS_CPP_NAMESPACE_USE
       Stub::Stub (const char *pcEndPointUri, AXIS_PROTOCOL_TYPE eProtocol):
  @@ -37,6 +41,30 @@
       m_pCall->setProtocol (eProtocol);
       m_pTransport = m_pCall->getTransport ();
       m_pTransport->setEndpointUri( pcEndPointUri);
  +    
  +    // SSL channel related initilizations
  +    char * pcSSLChannelInfo = g_pConfig->getAxisConfProperty( AXCONF_SECUREINFO);
  +    if( pcSSLChannelInfo && strlen( pcSSLChannelInfo) > 0)
  +    {
  +        char * pszArgPtr = NULL;
  +        int iArgIndex = 0;
  +
  +        pszArgPtr = strtok( pcSSLChannelInfo, ",");
  +
  +        while( pszArgPtr != NULL && iArgIndex < 8)
  +        {
  +            m_sArguments[iArgIndex] = pszArgPtr;
  +
  +            iArgIndex++;
  +
  +            pszArgPtr = strtok( NULL, ",");
  +
  +            while( pszArgPtr != NULL && *pszArgPtr == ' ' && *pszArgPtr
!= '\0')
  +            {
  +                pszArgPtr++;
  +            }
  +        }
  +    }
   }
   
   Stub::~Stub ()
  @@ -527,4 +555,41 @@
   	return m_pCall->createSoapAttachment();
   }
   
  +/*Methods for supporting SecureChannel*/
  +void Stub::SetSecure( char * pszArguments, ...)
  +{
  +    int iArgIndex = 0;
  +    va_list args;
  +    char *  pszArg = NULL;
  +    
  +    va_start( args, pszArguments);
  +    
  +    if( (pszArg = pszArguments) != NULL)
  +    {
  +        do
  +        {
  +            if( pszArg == (char *) 1)
  +            {
  +                m_sArguments[iArgIndex] = "true";
  +            }
  +            else
  +            {
  +                m_sArguments[iArgIndex] = pszArg;
  +            }
  +
  +            iArgIndex++;
  +        } while( (pszArg = va_arg( args, char *)) != NULL && iArgIndex < 8);
  +
  +        if( iArgIndex == 6)
  +        {
  +            m_sArguments[iArgIndex] = "false";
  +        }
  +    }
   
  +    va_end( args);
  +}
  +
  +void Stub::includeSecure()
  +{
  +    m_pCall->setTransportProperty( SECURE_PROPERTIES, (const char *) &m_sArguments);
  +}
  
  
  
  1.37      +1 -1      ws-axis/c/src/transport/axis3/HTTPTransport.cpp
  
  Index: HTTPTransport.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/axis3/HTTPTransport.cpp,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- HTTPTransport.cpp	11 Jul 2005 05:43:52 -0000	1.36
  +++ HTTPTransport.cpp	26 Jul 2005 16:23:43 -0000	1.37
  @@ -104,7 +104,7 @@
   }
   
   /*
  - * HTTPTransport destuctor
  + * HTTPTransport destructor
    */
   HTTPTransport::~HTTPTransport()
   {
  
  
  
  1.37      +0 -7      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java
  
  Index: ClientStubHeaderWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- ClientStubHeaderWriter.java	21 Jun 2005 14:14:13 -0000	1.36
  +++ ClientStubHeaderWriter.java	26 Jul 2005 16:23:43 -0000	1.37
  @@ -58,8 +58,6 @@
           try
           {
               writer.write("public: \n");
  -            writer.write("\tSTORAGE_CLASS_INFO void SetSecure( char *, ...);\n");
  -            // FJP Secure Channel
   
               for (int i = 0; i < methods.size(); i++)
               {
  @@ -151,11 +149,6 @@
                   }
                   writer.write(");\n");
               }
  -
  -            writer.write("\nprivate:\n"); // FJP - SecureChannel
  -            writer.write("\tvoid includeSecure();\n\n"); // FJP - SecureChannel
  -            writer.write("protected:\n"); // FJP - SecureChannel
  -            writer.write("\tstd::string sArguments[8];\n"); // FJP - SecureChannel
           }
           catch (Exception e)
           {
  
  
  
  1.94      +0 -38     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java
  
  Index: ClientStubWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java,v
  retrieving revision 1.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- ClientStubWriter.java	21 Jun 2005 15:45:26 -0000	1.93
  +++ ClientStubWriter.java	26 Jul 2005 16:23:43 -0000	1.94
  @@ -97,44 +97,6 @@
                   this.writeMethodInWrapper(minfo);
                   writer.write("\n");
               }
  -
  -            writer.write("/*Methods for supporting SecureChannel*/\n\n");
  -            writer.write( "void " + classname + "::SetSecure( char * pszArguments, ...)\n");
  -            writer.write("{\n");
  -			writer.write("\tint\t\tiArgIndex = 0;\n");
  -			writer.write("\tva_list\targs;\n");
  -			writer.write("\tchar *\tpszArg = NULL;\n");
  -			writer.write("\t\n");
  -			writer.write("\tva_start( args, pszArguments);\n");
  -			writer.write("\t\n");
  -			writer.write("\tif( (pszArg = pszArguments) != NULL)\n");
  -			writer.write("\t{\n");
  -			writer.write("\t\tdo\n");
  -			writer.write("\t\t{\n");
  -			writer.write("\t\t\tif( pszArg == (char *) 1)\n");
  -			writer.write("\t\t\t{\n");
  -			writer.write("\t\t\t\tsArguments[iArgIndex] = \"true\";\n");
  -			writer.write("\t\t\t}\n");
  -			writer.write("\t\t\telse\n");
  -			writer.write("\t\t\t{\n");
  -			writer.write("\t\t\t\tsArguments[iArgIndex] = pszArg;\n");
  -			writer.write("\t\t\t}\n");
  -			writer.write("\n");
  -			writer.write("\t\tiArgIndex++;\n");
  -			writer.write("\t\t} while( (pszArg = va_arg( args, char *)) != NULL && iArgIndex
< 8);\n");
  -			writer.write("\n");
  -			writer.write("\t\tif( iArgIndex == 6)\n");
  -			writer.write("\t\t{\n");
  -			writer.write("\t\t\tsArguments[iArgIndex] = \"false\";\n");
  -			writer.write("\t\t}\n");
  -			writer.write("\t}\n");
  -			writer.write("\n");
  -			writer.write("\tva_end( args);\n");
  -            writer.write("}\n\n");
  -            writer.write("void " + classname + "::includeSecure()\n");
  -            writer.write("{\n");
  -            writer.write("\tm_pCall->setTransportProperty( SECURE_PROPERTIES, (const
char *) &sArguments);\n");
  -            writer.write("}\n");
           }
   	catch (IOException e)
   	{
  
  
  
  1.7       +24 -23    ws-axis/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSLClient.cpp
  
  Index: CalculatorDocSSLClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSLClient.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CalculatorDocSSLClient.cpp	1 Apr 2005 09:28:48 -0000	1.6
  +++ CalculatorDocSSLClient.cpp	26 Jul 2005 16:23:44 -0000	1.7
  @@ -28,11 +28,11 @@
   
   int main(int argc, char* argv[])
   {
  -        char endpoint[256];
  +    char endpoint[256];
   	const char* sslkeyhome = 0;
  -    	char keylocation[255];
  +    char keylocation[255];
    
  -        const char* url="https://localhost:80/axis/Calculator";
  +    const char* url="https://localhost:80/axis/Calculator";
   
   	signal(SIGILL, sig_handler);
   	signal(SIGABRT, sig_handler);
  @@ -40,33 +40,34 @@
   	//signal(SIGQUIT, sig_handler);
   	//signal(SIGBUS, sig_handler);
   	signal(SIGFPE, sig_handler);
  -        int iResult;
  +    int iResult;
   
  -        url = argv[1];
  +    url = argv[1];
   
  -		bool bSuccess = false;
  -		int	iRetryIterationCount = 3;
  +	bool bSuccess = false;
  +	int	iRetryIterationCount = 3;
   
  -		do
  -		{
  +	do
  +	{
           try
           {
  -                sprintf(endpoint, "%s", url);
  -                Calculator ws(endpoint);
  +            sprintf(endpoint, "%s", url);
  +            Calculator ws(endpoint);
                   //ws.SetSecure("/home/axistest/ssl/myKeyRing.kdb", "axis4all", "AXIS",
"NONE", "05", "NONE", false);
  -		 sslkeyhome=getenv("SSL_KEYS_HOME");
  +            sslkeyhome=getenv("SSL_KEYS_HOME");
   
  -		if (!sslkeyhome)
  -		{ 	cout << "SSL_KEYS_HOME not set" << endl;	
  -			return 1;
  -		}
  -
  -		sprintf(keylocation,"%s/%s",sslkeyhome,"myKeyRing.kdb");
  -                ws.SetSecure(keylocation, "axis4all", "AXIS", "NONE", "05", "NONE", false);
  -
  -                iResult = ws.add(2,3);
  -                cout << iResult << endl;
  -				bSuccess = true;
  +            if (!sslkeyhome)
  +            {
  +                cout << "SSL_KEYS_HOME not set" << endl;	
  +                return 1;
  +            }
  +
  +            sprintf(keylocation,"%s/%s",sslkeyhome,"myKeyRing.kdb");
  +            ws.SetSecure(keylocation, "axis4all", "AXIS", "NONE", "05", "NONE", false);
  +
  +            iResult = ws.add(2,3);
  +            cout << iResult << endl;
  +			bSuccess = true;
           }
           catch(AxisException& e)
           {
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/client/cpp/CalculatorDocSSLConfigFileClient.cpp
  
  Index: CalculatorDocSSLConfigFileClient.cpp
  ===================================================================
  // Copyright 2003-2004 The Apache Software Foundation.
  // (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved
  // 
  // 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 test is written to test the functionality of SetSecure() API 
  ******************************************************************************
  */
  
  #include "Calculator.hpp"
  #include <iostream>
  #include <stdlib.h>
  
  #include <signal.h>
  
  void sig_handler(int);
  
  int main(int argc, char* argv[])
  {
      char endpoint[256];
  	const char* sslkeyhome = 0;
      char keylocation[255];
   
      const char* url="https://localhost:80/axis/Calculator";
  
  	signal(SIGILL, sig_handler);
  	signal(SIGABRT, sig_handler);
  	signal(SIGSEGV, sig_handler);
  	//signal(SIGQUIT, sig_handler);
  	//signal(SIGBUS, sig_handler);
  	signal(SIGFPE, sig_handler);
      
      int iResult;
  
      url = argv[1];
  
  	bool bSuccess = false;
  	int	iRetryIterationCount = 3;
  
  	do
  	{
          try
          {
              sprintf(endpoint, "%s", url);
              
              Calculator ws(endpoint);
              iResult = ws.add(2,3);
              cout << iResult << endl;
              
  			bSuccess = true;
          }
          catch(AxisException& e)
          {
  			bool bSilent = false;
  
  			if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
  			{
  				if( iRetryIterationCount > 0)
  				{
  					bSilent = true;
  				}
  			}
  			else
  			{
  				iRetryIterationCount = 0;
  			}
  
              if( !bSilent)
  			{
  				cout << "Exception : " << e.what() << endl;
  			}
          }
          catch(exception& e)
          {
              cout << "Unknown exception has occured" << endl;
          }
          catch(...)
          {
              cout << "Unknown exception has occured" << endl;
          }
  		iRetryIterationCount--;
  		} while( iRetryIterationCount > 0 && !bSuccess);
          cout<< "---------------------- TEST COMPLETE -----------------------------"<<
endl;
          return 0;
  }
  
  void sig_handler(int sig) {
  	signal(sig, sig_handler);
      cout << "SIGNAL RECEIVED " << sig << endl;
  	exit(1);
  }
  
  
  
  
  1.1                  ws-axis/c/tests/auto_build/testcases/tests/CalculatorDocSSLConfigFile.xml
  
  Index: CalculatorDocSSLConfigFile.xml
  ===================================================================
  <test>
      <name>CalculatorDocSSLConfigFile</name>
      <description>CalculatorDocSSL test using SSL properties in config file</description>
      <clientLang>cpp</clientLang>
      <clientCode>CalculatorDocSSLConfigFileClient.cpp</clientCode>
      <wsdl>CalculatorDoc.wsdl</wsdl>
      <expected>
          <output>
             CalculatorDocSSL.expected
          </output>
      </expected>
          <endpoint>https://localhost:80/axis/CalculatorDoc</endpoint>
          <nomonitor>true</nomonitor>
          <port>9443</port>
  	    <ssl>true</ssl>
  </test>
  
  
  
  

Mime
View raw message