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 ha...@apache.org on 2006/07/21 18:34:58 UTC

svn commit: r424378 - /webservices/axis/trunk/c/src/engine/client/Stub.cpp

Author: hawkeye
Date: Fri Jul 21 09:34:57 2006
New Revision: 424378

URL: http://svn.apache.org/viewvc?rev=424378&view=rev
Log:
Moved the http specific password element into the http transport. The username and password now reside in the SOAP Transport where they should be.

Modified:
    webservices/axis/trunk/c/src/engine/client/Stub.cpp

Modified: webservices/axis/trunk/c/src/engine/client/Stub.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/engine/client/Stub.cpp?rev=424378&r1=424377&r2=424378&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/engine/client/Stub.cpp (original)
+++ webservices/axis/trunk/c/src/engine/client/Stub.cpp Fri Jul 21 09:34:57 2006
@@ -24,7 +24,6 @@
 #include <axis/AxisWrapperAPI.hpp>
 #include "../../soap/SoapSerializer.h"
 #include "../../common/AxisUtils.h"
-#include "../../soap/apr_base64.h"
 #include "../../common/AxisConfig.h"
 #include "../../common/AxisGenException.h"
 
@@ -32,8 +31,6 @@
 
 AXIS_CPP_NAMESPACE_USE
     Stub::Stub (const char *pcEndPointUri, AXIS_PROTOCOL_TYPE eProtocol):
-m_pcUsername (NULL),
-m_pcPassword (NULL),
 m_proxyUsername (NULL),
 m_proxyPassword (NULL), 
 m_pExceptionHandler(NULL)
@@ -74,11 +71,6 @@
         delete m_vSOAPHeaderBlocks[j];
         m_vSOAPHeaderBlocks[j] = NULL;
     }
-
-    if (m_pcUsername)
-        delete[]m_pcUsername;
-    if (m_pcPassword)
-        delete[]m_pcPassword;
 }
 
 void
@@ -364,20 +356,8 @@
 void
 Stub::setUsername (const char *pcUsername)
 {
-    if (m_pcUsername)
-    {
-        delete[]m_pcUsername;
-        m_pcUsername = NULL;
-    }
-
-    if (!pcUsername)
-        return;
-
-    m_pcUsername = new char[strlen (pcUsername) + 1];
-    strcpy (m_pcUsername, pcUsername);
-
-    if (m_pcPassword)
-        setAuthorizationHeader ();
+     if (m_pTransport)
+        m_pTransport->setUsername(pcUsername);
 }
 
 void
@@ -402,20 +382,8 @@
 void
 Stub::setPassword (const char *pcPassword)
 {
-    if (m_pcPassword)
-    {
-        delete[]m_pcPassword;
-        m_pcPassword = NULL;
-    }
-
-    if (!pcPassword)
-        return;
-
-    m_pcPassword = new char[strlen (pcPassword) + 1];
-    strcpy (m_pcPassword, pcPassword);
-
-    if (m_pcUsername)
-        setAuthorizationHeader ();
+      if (m_pTransport)
+        m_pTransport->setPassword(pcPassword);
 }
 
 void
@@ -437,11 +405,6 @@
         setProxyAuthorizationHeader ();
 }
 
-const char *
-Stub::getUsername ()
-{
-    return m_pcUsername;
-}
 
 const char *
 Stub::getProxyUsername ()
@@ -449,11 +412,6 @@
     return m_proxyUsername;
 }
 
-const char *
-Stub::getPassword ()
-{
-    return m_pcPassword;
-}
 
 const char *
 Stub::getProxyPassword ()
@@ -461,29 +419,6 @@
     return m_proxyPassword;
 }
 
-void
-Stub::setAuthorizationHeader ()
-{
-    char *cpUsernamePassword = new char[strlen (m_pcUsername) + strlen (m_pcPassword) + 2];
-    strcpy (cpUsernamePassword, m_pcUsername);
-    strcat (cpUsernamePassword, ":");
-    strcat (cpUsernamePassword, m_pcPassword);
-
-    int len = apr_base64_encode_len (strlen (cpUsernamePassword));
-    AxisChar *base64Value = new AxisChar[len + 1];
-    len = apr_base64_encode_binary (base64Value,
-                                    (const unsigned char *) cpUsernamePassword,
-                                    strlen (cpUsernamePassword));
-
-    std::string strValue = "Basic ";
-    strValue += base64Value;
-
-    if (m_pTransport)
-        m_pTransport->setTransportProperty ("Authorization", strValue.c_str ());
-
-    delete[]cpUsernamePassword;
-    delete[]base64Value;
-}
 
 void 
 Stub::setProxyAuthorizationHeader ()



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org