axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject svn commit: r397156 - in /webservices/axis/trunk/c/src/client/adminclient: AxisAdminService.cpp AxisAdminService.h
Date Wed, 26 Apr 2006 09:27:24 GMT
Author: dicka
Date: Wed Apr 26 02:27:21 2006
New Revision: 397156

URL: http://svn.apache.org/viewcvs?rev=397156&view=rev
Log:
Update stubs within AdminClient to handle SOAP Faults.

Modified:
    webservices/axis/trunk/c/src/client/adminclient/AxisAdminService.cpp
    webservices/axis/trunk/c/src/client/adminclient/AxisAdminService.h

Modified: webservices/axis/trunk/c/src/client/adminclient/AxisAdminService.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/client/adminclient/AxisAdminService.cpp?rev=397156&r1=397155&r2=397156&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/client/adminclient/AxisAdminService.cpp (original)
+++ webservices/axis/trunk/c/src/client/adminclient/AxisAdminService.cpp Wed Apr 26 02:27:21
2006
@@ -22,20 +22,24 @@
  */
 
 #include "AxisAdminService.h"
+
 #include <axis/AxisWrapperAPI.hpp>
+#include <axis/Axis.hpp>
 
 AXIS_CPP_NAMESPACE_START
 
-AxisAdminService::AxisAdminService (const char *pchUri)
+AxisAdminService::AxisAdminService(const char* pcEndpointUri, AXIS_PROTOCOL_TYPE eProtocol):Stub(pcEndpointUri,
eProtocol)
+{
+}
+
+AxisAdminService::AxisAdminService()
+:Stub(" ", APTHTTP1_1)
 {
-    m_pCall = new Call ();
-    m_pCall->setProtocol (APTHTTP1_1);
-    m_pCall->setEndpointURI (pchUri);
+	m_pCall->setEndpointURI("http://localhost/axis/AxisAdmin");
 }
 
-AxisAdminService::~AxisAdminService ()
+AxisAdminService::~AxisAdminService()
 {
-    delete m_pCall;
 }
 
 
@@ -44,24 +48,85 @@
 /*
  * This method wrap the service methodupdateWSDD
  */
-xsd__boolean AxisAdminService::updateWSDD (xsd__base64Binary Value0)
+xsd__boolean AxisAdminService::updateWSDD(xsd__base64Binary Value0)
 {
-    xsd__boolean Ret = false_;
-    if (AXIS_SUCCESS != m_pCall->initialize (CPP_DOC_PROVIDER))
-        return Ret;
-    m_pCall->setTransportProperty (SOAPACTION_HEADER, "AxisAdmin#updateWSDD");
-    m_pCall->setSOAPVersion (SOAP_VER_1_1);
-    m_pCall->setOperation ("updateWSDD", "http://www.opensource.lk/xsd");
-    m_pCall->addParameter ((void *) &Value0, "wsdd", XSD_BASE64BINARY);
-    if (AXIS_SUCCESS == m_pCall->invoke ())
-    {
-        if (AXIS_SUCCESS == m_pCall->checkMessage ("updateWSDDResponse",
-            "http://www.opensource.lk/xsd"))
-        {
-            Ret = *m_pCall->getElementAsBoolean ("return", 0);
-        }
-    }
-    m_pCall->unInitialize ();
-    return Ret;
+	xsd__boolean Ret = false_;
+	const char* pcCmplxFaultName = NULL;
+	try
+	{
+	if (AXIS_SUCCESS != m_pCall->initialize(CPP_DOC_PROVIDER)) return Ret;
+
+	if (NULL==m_pCall->getTransportProperty("SOAPAction",false))
+		m_pCall->setTransportProperty(SOAPACTION_HEADER , "AxisAdmin#updateWSDD");
+
+	m_pCall->setSOAPVersion(SOAP_VER_1_1);
+	m_pCall->setOperation("updateWSDD", "http://www.opensource.lk/xsd");
+
+	includeSecure();
+	applyUserPreferences();
+
+	char cPrefixAndParamName0[] = "wsdd";
+	m_pCall->addParameter((void*)&Value0, cPrefixAndParamName0, XSD_BASE64BINARY);
+
+	if (AXIS_SUCCESS == m_pCall->invoke())
+	{
+		if(AXIS_SUCCESS == m_pCall->checkMessage("updateWSDDResponse", "http://www.opensource.lk/xsd"))
+		{
+			xsd__boolean * pReturn = m_pCall->getElementAsBoolean("return", 0);
+			if(pReturn)
+			{
+				Ret = *pReturn;
+				Axis::AxisDelete( (void *) pReturn, XSD_BOOLEAN);
+			}
+		}
+	}
+	m_pCall->unInitialize();
+	return Ret;
+	}
+	catch(AxisException& e)
+	{
+		int iExceptionCode = e.getExceptionCode();
+
+		if(AXISC_NODE_VALUE_MISMATCH_EXCEPTION != iExceptionCode)
+		{
+			m_pCall->unInitialize();
+			throw;
+		}
+
+		ISoapFault* pSoapFault = (ISoapFault*)
+			m_pCall->checkFault("Fault","http://localhost/axis/AxisAdmin" );
+
+		if(pSoapFault)
+		{
+			const char *detail = pSoapFault->getSimpleFaultDetail();
+			bool deleteDetail=false;
+
+			if (NULL==detail || 0==strlen(detail))
+			{
+				detail=m_pCall->getFaultAsXMLString();
+				if (NULL==detail)
+					detail="";
+				else
+					deleteDetail=true;
+			}
+
+			OtherFaultException ofe(pSoapFault->getFaultcode(),
+				pSoapFault->getFaultstring(), pSoapFault->getFaultactor(),
+				detail, iExceptionCode);
+
+			if (deleteDetail && NULL!=detail)
+				Axis::AxisDelete( (void *) const_cast<char*>(detail), XSD_STRING);
+
+			m_pCall->unInitialize();
+			delete pSoapFault;
+			throw ofe;
+		}
+		else
+		{
+			m_pCall->unInitialize();
+			delete pSoapFault;
+			throw;
+		}
+	}
 }
 AXIS_CPP_NAMESPACE_END

Modified: webservices/axis/trunk/c/src/client/adminclient/AxisAdminService.h
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/client/adminclient/AxisAdminService.h?rev=397156&r1=397155&r2=397156&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/client/adminclient/AxisAdminService.h (original)
+++ webservices/axis/trunk/c/src/client/adminclient/AxisAdminService.h Wed Apr 26 02:27:21
2006
@@ -24,20 +24,19 @@
 #if !defined(__AXISADMINSERVICE_CLIENTSTUB_H__OF_AXIS_INCLUDED_)
 #define __AXISADMINSERVICE_CLIENTSTUB_H__OF_AXIS_INCLUDED_
 
-#include <axis/client/Call.hpp>
-#include <axis/AxisUserAPI.hpp>
-
+#include <axis/client/Stub.hpp>
+#include <axis/OtherFaultException.hpp>
+#include <axis/ISoapAttachment.hpp>
+#include <axis/ISoapFault.hpp>
 AXIS_CPP_NAMESPACE_START
 
-class AxisAdminService
+class AxisAdminService :public Stub
 {
     public:
-        AxisAdminService (const char *pchUri);
-        virtual ~ AxisAdminService ();
-        xsd__boolean updateWSDD (xsd__base64Binary Value0);
-
-	private:
-        Call * m_pCall;
+        AxisAdminService(const char* pchEndpointUri, AXIS_PROTOCOL_TYPE eProtocol=APTHTTP1_1);
+        AxisAdminService();
+        virtual ~AxisAdminService();
+        xsd__boolean updateWSDD(xsd__base64Binary Value0);
 };
 
 AXIS_CPP_NAMESPACE_END



Mime
View raw message