You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2006/11/12 05:39:45 UTC
svn commit: r473873 [4/5] - in /incubator/tuscany/cpp/sca:
runtime/core/src/tuscany/sca/core/ runtime/core/src/tuscany/sca/extension/
runtime/core/src/tuscany/sca/model/ runtime/core/src/tuscany/sca/util/
runtime/extensions/cpp/src/osoa/sca/ runtime/ex...
Modified: incubator/tuscany/cpp/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.cpp Sat Nov 11 20:39:42 2006
@@ -67,15 +67,17 @@
Axis2Client::Axis2Client(CompositeReference* compositeReference)
: compositeReference(compositeReference)
{
+ logentry();
}
Axis2Client::~Axis2Client()
{
+ logentry();
}
void Axis2Client::invoke(tuscany::sca::Operation& operation)
{
- LOGENTRY(1, "Axis2Client::invoke");
+ logentry();
// Initialize Axis2 stuff
axis2_allocator_t *allocator = axis2_allocator_init (NULL);
@@ -104,7 +106,7 @@
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "WSDL description %s not found\n", wsdlNamespace.c_str());
string msg = "WSDL not found for " + wsdlNamespace;
- throw SystemConfigurationException(msg.c_str());
+ throwException(SystemConfigurationException, msg.c_str());
}
// Match the operation in Operation to the operation in the wsdl port type.
@@ -115,7 +117,7 @@
binding->getEndpointName(),
operationName);
}
- catch(SystemConfigurationException &ex)
+ catch(SystemConfigurationException& ex)
{
AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "SystemConfigurationException has been caught: %s\n", ex.getMessageText());
throw;
@@ -139,14 +141,14 @@
{
AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "WSDL description %s not found\n", wsdlNamespace.c_str());
string msg = "WSDL not found for " + wsdlNamespace;
- throw SystemConfigurationException(msg.c_str());
+ throwException(SystemConfigurationException, msg.c_str());
}
try
{
wsdlOperation = wsdl->findOperation(wsdlInterface->getName(), operationName);
}
- catch(SystemConfigurationException &ex)
+ catch(SystemConfigurationException& ex)
{
AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "SystemConfigurationException has been caught: %s\n", ex.getMessageText());
throw;
@@ -168,8 +170,8 @@
wsdlOperation.setDocumentStyle(true);
wsdlOperation.setWrappedStyle(true);
wsdlOperation.setEncoded(false);
- wsdlOperation.setInputType(wsdlNamespace + "#" + operationName);
- wsdlOperation.setOutputType(wsdlNamespace + "#" + operationName + "Response");
+ wsdlOperation.setInputType(string("http://tempuri.org") + "#" + operationName);
+ wsdlOperation.setOutputType(string("http://tempuri.org") + "#" + operationName + "Response");
}
// Get the target endpoint address
@@ -178,7 +180,20 @@
axis2_char_t* address;
if (binding->getURI() != "")
{
- address = (axis2_char_t*)binding->getURI().c_str();
+ if (binding->getURI().find("http://")==0)
+ {
+ address = (axis2_char_t*)binding->getURI().c_str();
+ }
+ else
+ {
+ //TODO Hack for now, hardcode the address of the target service
+ // Derive it from the component / service name
+ string componentName;
+ string serviceName;
+ Utils::tokeniseString("/", binding->getURI(), componentName, serviceName);
+ string saddress = "http://" + componentName + ":9090/axis2/services/" + serviceName;
+ address = (axis2_char_t*)saddress.c_str();
+ }
}
else
{
@@ -219,7 +234,7 @@
axis2_char_t* client_home = AXIS2_GETENV("AXIS2C_HOME");
if (!client_home)
{
- throw SystemConfigurationException("Environment error: AXIS2C_HOME not set");
+ throwException(SystemConfigurationException, "AXIS2C_HOME not set");
}
axis2_svc_client_t* svc_client = axis2_svc_client_create(env, client_home);
if (!svc_client)
@@ -228,7 +243,7 @@
" %d :: %s", env->error->error_number,
AXIS2_ERROR_GET_MESSAGE(env->error));
- throw SystemConfigurationException("Axis2Client: axis2_svc_client_create failed");
+ throwException(SystemConfigurationException, "axis2_svc_client_create failed");
}
/* Set service client options */
@@ -245,10 +260,10 @@
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Invoke failed: Error code:"
" %d :: %s", env->error->error_number,
AXIS2_ERROR_GET_MESSAGE(env->error));
- throw SystemConfigurationException("Axis2Client: Invoke failed");
+ throwException(ServiceInvocationException, "Web Service invoke failed");
}
- LOGINFO(2, "Warning: Have not freed Axis2C service client memory due to Jira AXIS2C-209");
+ loginfo("Have not freed Axis2C service client memory due to Jira AXIS2C-209");
// Uncommenting this code causes crash when invoking a composite with both Axis2C ws.binding
// service and reference. See Jiras TUSCANY-536 and AXIS2C-209
//if (svc_client)
@@ -256,15 +271,14 @@
// AXIS2_SVC_CLIENT_FREE(svc_client, env);
// svc_client = NULL;
//}
-
- LOGEXIT(1, "Axis2Client::invoke");
}
axiom_node_t* Axis2Client::createPayload(Operation& operation,
const WSDLOperation& wsdlOperation,
axis2_env_t* env)
{
- LOGENTRY(1, "Axis2Client::createPayload");
+ logentry();
+
axiom_node_t* request_node = NULL;
// map the operation request to the wsdl
@@ -288,7 +302,7 @@
const Type& inputType = prop.getType();
inputDataObject = dataFactory->create(inputType);
}
- catch (SDORuntimeException e)
+ catch (SDORuntimeException&)
{
try
{
@@ -297,7 +311,7 @@
wsdlOperation.getInputTypeName().c_str());
inputDataObject = dataFactory->create(inputType);
}
- catch (SDORuntimeException e2)
+ catch (SDORuntimeException&)
{
// The input wrapper type is not known, create an open DataObject
@@ -389,7 +403,8 @@
l.append(*(DataObjectPtr*)parm.getValue());
break;
}
- default: throw "unsupported parameter type";
+ default:
+ throwException(SystemConfigurationException, "Unsupported parameter type");
}
}
}
@@ -467,7 +482,8 @@
inputDataObject->setDataObject(i, *(DataObjectPtr*)parm.getValue());
break;
}
- default: throw "unsupported parameter type";
+ default:
+ throwException(ServiceDataException, "Unsupported parameter type");
}
}
}
@@ -484,9 +500,8 @@
}
char* str = AXIOM_NODE_TO_STRING(request_node, env);
- LOGINFO_1(3, "Sending this OM node in XML : %s \n", str);
+ loginfo("Sending OM node: %s ", str);
- LOGEXIT(1, "Axis2Client::createPayload");
return request_node;
}
@@ -495,7 +510,7 @@
const WSDLOperation& wsdlOperation,
axis2_env_t* env)
{
- LOGENTRY(1, "Axis2Client::setReturn");
+ logentry();
if (wsdlOperation.isDocumentStyle())
{
@@ -512,18 +527,22 @@
{
AXIS2_LOG_INFO((env)->log, "Axis2Client invoke has response OM: %s\n", str);
}
+
+ //cout << "response body = " << str << endl;
// Convert the SOAP body to an SDO DataObject
AxiomHelper* axiomHelper = AxiomHelper::getHelper();
DataObjectPtr outputBodyDataObject = axiomHelper->toSdo(body, dataFactory);
AxiomHelper::releaseHelper(axiomHelper);
-
+
if(!outputBodyDataObject)
{
AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "Axis2Service invoke: Could not convert received Axiom node to SDO");
/** TODO: return a SOAP fault here */
return;
- }
+ }
+
+ XMLHelperPtr xmlHelper = compositeReference->getComposite()->getXMLHelper();
// Get the first body part representing the doc-lit-wrapped wrapper element
DataObjectPtr outputDataObject = NULL;
@@ -545,171 +564,209 @@
AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "Axis2Client invoke: Could not convert body part to SDO");
return;
}
-
- PropertyList pl = outputDataObject->getInstanceProperties();
- unsigned int i = 0;
-
- switch(pl[i].getTypeEnum())
+
+ PropertyList pl = outputDataObject->getType().getProperties();
+ if (pl.size() == 0)
{
- case Type::BooleanType:
- {
- bool* boolData = new bool;
- *boolData = outputDataObject->getBoolean(pl[i]);
- operation.setReturnValue(boolData);
- }
- break;
- case Type::ByteType:
+ if (outputDataObject->getType().isOpenType() && outputDataObject->getType().isDataObjectType())
{
- char* byteData = new char;
- *byteData = outputDataObject->getByte(pl[i]);
- operation.setReturnValue(byteData);
+ SequencePtr sequence = outputDataObject->getSequence();
+ if (sequence != NULL && sequence->size() != 0)
+ {
+ // Return a text element
+ if (sequence->isText(0))
+ {
+ string* stringData = new string(sequence->getCStringValue(0));
+ operation.setReturnValue(stringData);
+ }
+ else
+ {
+ // Return a DataObject representing a complex element
+ DataObjectPtr *dataObjectData = new DataObjectPtr;
+ *dataObjectData = sequence->getDataObjectValue(0);
+ if(!*dataObjectData)
+ {
+ loginfo("Null DataObject return value");
+ }
+
+ cout << "ReturnValue " << *dataObjectData << endl;
+
+ operation.setReturnValue(dataObjectData);
+ }
+ }
}
- break;
- case Type::BytesType:
+ }
+ else
+ {
+ const Property* p = &pl[0];
+
+ switch(pl[0].getTypeEnum())
{
- int len = outputDataObject->getLength(pl[i]);
- char* bytesData = new char[len+1];
- int bytesWritten = outputDataObject->getBytes(pl[i], bytesData, len);
- // Ensure the bytes end with the null char. Not sure if this is neccessary
- if(bytesWritten <= len)
+ case Type::BooleanType:
{
- bytesData[bytesWritten] = 0;
+ bool* boolData = new bool;
+ *boolData = outputDataObject->getBoolean(pl[0]);
+ operation.setReturnValue(boolData);
}
- else
+ break;
+ case Type::ByteType:
{
- bytesData[len] = 0;
+ char* byteData = new char;
+ *byteData = outputDataObject->getByte(pl[0]);
+ operation.setReturnValue(byteData);
}
- //printf("outputDataObject has BytesType named %s with length %d\n", name, bytesWritten);
- operation.setReturnValue(&bytesData);
- }
- break;
- case Type::CharacterType:
- {
- // This code should work but won't be used as there is no mapping from an XSD type to the SDO CharacterType
- wchar_t* charData = new wchar_t;
- *charData = outputDataObject->getCharacter(pl[i]);
- operation.setReturnValue(charData);
- }
- break;
- case Type::DoubleType:
- {
- long double* doubleData = new long double;
- *doubleData = outputDataObject->getDouble(pl[i]);
- operation.setReturnValue(doubleData);
- }
- break;
- case Type::FloatType:
- {
- float* floatData = new float;
- *floatData = outputDataObject->getFloat(pl[i]);
- operation.setReturnValue(floatData);
- }
- break;
- case Type::IntegerType:
- {
- long* intData = new long;
- *intData = outputDataObject->getInteger(pl[i]);
- operation.setReturnValue(intData);
- }
- break;
- case Type::ShortType:
- {
- short* shortData = new short;
- *shortData = outputDataObject->getShort(pl[i]);
- operation.setReturnValue(shortData);
- }
- break;
- case Type::StringType:
- {
- string* str = new string(outputDataObject->getCString(pl[i]));
- operation.setReturnValue(str);
- }
- break;
- case Type::DataObjectType:
- {
- DataObjectPtr dataObjectData = outputDataObject->getDataObject(pl[i]);
- if(!dataObjectData)
+ break;
+ case Type::BytesType:
{
- LOGINFO(4, "SDO DataObject return value was null");
+ int len = outputDataObject->getLength(pl[0]);
+ char** bytesData = new char*;
+ *bytesData = new char[len+1];
+ int bytesWritten = outputDataObject->getBytes(pl[0], *bytesData, len);
+ // Ensure the bytes end with the null char. Not sure if this is neccessary
+ if(bytesWritten <= len)
+ {
+ (*bytesData)[bytesWritten] = 0;
+ }
+ else
+ {
+ (*bytesData)[len] = 0;
+ }
+ //printf("outputDataObject has BytesType named %s with length %d\n", name, bytesWritten);
+ operation.setReturnValue(bytesData);
}
- operation.setReturnValue(&dataObjectData);
- }
- break;
- case Type::OpenDataObjectType:
- {
- /*
- * This code deals with xsd:any element parameters
- */
-
- DataObjectList& dataObjectList = outputDataObject->getList(pl[i]);
-
- for(int j=0; j<dataObjectList.size(); j++)
+ break;
+ case Type::CharacterType:
+ {
+ // This code should work but won't be used as there is no mapping from an XSD type to the SDO CharacterType
+ wchar_t* charData = new wchar_t;
+ *charData = outputDataObject->getCharacter(pl[0]);
+ operation.setReturnValue(charData);
+ }
+ break;
+ case Type::DoubleType:
+ {
+ long double* doubleData = new long double;
+ *doubleData = outputDataObject->getDouble(pl[0]);
+ operation.setReturnValue(doubleData);
+ }
+ break;
+ case Type::FloatType:
+ {
+ float* floatData = new float;
+ *floatData = outputDataObject->getFloat(pl[0]);
+ operation.setReturnValue(floatData);
+ }
+ break;
+ case Type::IntegerType:
+ {
+ long* intData = new long;
+ *intData = outputDataObject->getInteger(pl[0]);
+ operation.setReturnValue(intData);
+ }
+ break;
+ case Type::ShortType:
+ {
+ short* shortData = new short;
+ *shortData = outputDataObject->getShort(pl[0]);
+ operation.setReturnValue(shortData);
+ }
+ break;
+ case Type::StringType:
+ {
+ string* stringData = new string(outputDataObject->getCString(pl[0]));
+ operation.setReturnValue(stringData);
+ }
+ break;
+ case Type::DataObjectType:
{
- DataObjectPtr dataObjectData = dataObjectList[j];
- if(!dataObjectData)
+ DataObjectPtr* dataObjectData = new DataObjectPtr;
+ *dataObjectData = outputDataObject->getDataObject(pl[0]);
+ if(!*dataObjectData)
{
- operation.setReturnValue(&dataObjectData);
- LOGINFO(4, "SDO OpenDataObject return value was null");
+ loginfo("Null DataObject return value");
}
- else
+ operation.setReturnValue(dataObjectData);
+ }
+ break;
+ case Type::OpenDataObjectType:
+ {
+ /*
+ * This code deals with xsd:any element parameters
+ */
+
+ DataObjectList& dataObjectList = outputDataObject->getList(pl[0]);
+
+ for(int j=0; j<dataObjectList.size(); j++)
{
-
- SequencePtr sequence = dataObjectData->getSequence();
- if (sequence->size()!=0)
+ DataObjectPtr dob = dataObjectList[j];
+ if(!dob)
{
- // Return a text element
- if (sequence->isText(0))
- {
- string* stringData = new string(sequence->getCStringValue(0));
- operation.setReturnValue(stringData);
- }
- else
+ DataObjectPtr* dataObjectData = new DataObjectPtr;
+ *dataObjectData = NULL;
+ operation.setReturnValue(dataObjectData);
+ loginfo("Null OpenDataObject return value");
+ }
+ else
+ {
+
+ SequencePtr sequence = dob->getSequence();
+ if (sequence->size()!=0)
{
- // Return a DataObject representing a complex element
- DataObjectPtr dob = sequence->getDataObjectValue(0);
- if(!dob)
+ // Return a text element
+ if (sequence->isText(0))
+ {
+ string* stringData = new string(sequence->getCStringValue(0));
+ operation.setReturnValue(stringData);
+ }
+ else
{
- LOGINFO(4, "SDO DataObject return value was null");
+ // Return a DataObject representing a complex element
+ DataObjectPtr *dataObjectData = new DataObjectPtr;
+ *dataObjectData = sequence->getDataObjectValue(0);
+ if(!*dataObjectData)
+ {
+ loginfo("Null DataObject return value");
+ }
+ operation.setReturnValue(dataObjectData);
}
- operation.setReturnValue(&dob);
}
- }
- else
- {
- // Empty content, add an empty string
- LOGINFO(4, "SDO OpenDataObject return value was empy");
- string *stringData = new string("");
- operation.setReturnValue(stringData);
+ else
+ {
+ // Empty content, add an empty string
+ loginfo("Null OpenDataObject return value");
+ string *stringData = new string("");
+ operation.setReturnValue(stringData);
+ }
}
}
}
- }
- break;
- case Type::DateType:
- LOGERROR(0, "SDO DateType return values are not yet supported");
- break;
- case Type::LongType:
- LOGERROR(0, "SDO LongType (int64_t) return values are not yet supported");
- break;
- case Type::UriType:
- LOGERROR(0, "SDO UriType return values are not yet supported");
- break;
- case Type::BigDecimalType:
- LOGERROR(0, "SDO BigDecimalType return values are not yet supported");
- break;
- case Type::BigIntegerType:
- LOGERROR(0, "SDO BigIntegerType return values are not yet supported");
- break;
- default:
- LOGERROR(0, "Unknown SDO type has been found in return value. Unknown types are not yet supported");
- break;
- }
+ break;
+ case Type::DateType:
+ logwarning("SDO DateType return values are not yet supported");
+ break;
+ case Type::LongType:
+ logwarning("SDO LongType (int64_t) return values are not yet supported");
+ break;
+ case Type::UriType:
+ logwarning("SDO UriType return values are not yet supported");
+ break;
+ case Type::BigDecimalType:
+ logwarning("SDO BigDecimalType return values are not yet supported");
+ break;
+ case Type::BigIntegerType:
+ logwarning("SDO BigIntegerType return values are not yet supported");
+ break;
+ default:
+ logwarning("Unknown SDO type has been found in return value. Unknown types are not yet supported");
+ break;
+ }
+ }
+
}
else
{
// RPC
}
- LOGEXIT(1, "Axis2Client::setReturn");
}
} // End namespace ws
Modified: incubator/tuscany/cpp/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceBindingExtension.cpp Sat Nov 11 20:39:42 2006
@@ -48,8 +48,7 @@
// ===================================================================
WSServiceBindingExtension::WSServiceBindingExtension()
{
- LOGENTRY(1, "WSServiceBindingExtension::constructor");
- LOGEXIT(1, "WSServiceBindingExtension::constructor");
+ logentry();
}
// ===================================================================
@@ -57,8 +56,7 @@
// ===================================================================
WSServiceBindingExtension::~WSServiceBindingExtension()
{
- LOGENTRY(1, "WSServiceBindingExtension::destructor");;
- LOGEXIT(1, "WSServiceBindingExtension::destructor");
+ logentry();
}
const string WSServiceBindingExtension::extensionName("ws");
@@ -70,6 +68,8 @@
// ===================================================================
ServiceBinding* WSServiceBindingExtension::getServiceBinding(Composite *composite, Service* service, DataObjectPtr scdlBinding)
{
+ logentry();
+
string bindingType = scdlBinding->getType().getName();
if (bindingType == "WebServiceBinding")
{
@@ -98,9 +98,8 @@
void WSServiceBindingExtension::initialize()
{
- LOGENTRY(1, "WSServiceBindingExtension::initialize");;
+ logentry();
SCARuntime::getInstance()->registerServiceBindingExtension(new WSServiceBindingExtension());
- LOGEXIT(1, "WSServiceBindingExtension::initialize");;
}
} // End namespace ws
Modified: incubator/tuscany/cpp/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/WSServiceWrapper.cpp Sat Nov 11 20:39:42 2006
@@ -47,12 +47,14 @@
WSServiceWrapper::WSServiceWrapper(Service* service) : ServiceWrapper(service)
{
+ logentry();
+
// Define the SOAP Body type and element to allow a SOAP body to
// be loaded in a DataObject
DataFactoryPtr dataFactory = service->getComponent()->getComposite()->getDataFactory();
try {
const Type& bodyType = dataFactory->getType("http://www.w3.org/2003/05/soap-envelope", "Body");
- } catch (SDORuntimeException e)
+ } catch (SDORuntimeException&)
{
dataFactory->addType("http://www.w3.org/2003/05/soap-envelope", "RootType", false, false, false);
dataFactory->addType("http://www.w3.org/2003/05/soap-envelope", "Body", false, true, false);
@@ -70,10 +72,18 @@
"http://schemas.xmlsoap.org/soap/envelope/", "Body",
false, false, true);
}
+
+ try {
+ const Type& tempType = dataFactory->getType("http://tempuri.org", "RootType");
+ } catch (SDORuntimeException&)
+ {
+ dataFactory->addType("http://tempuri.org", "RootType", false, false, false);
+ }
}
WSServiceWrapper::~WSServiceWrapper()
{
+ logentry();
}
///
@@ -81,15 +91,15 @@
///
void WSServiceWrapper::invoke(Operation& operation)
{
- LOGENTRY(1, "WSServiceWrapper::invoke");
+ logentry();
const string& operationName = operation.getName();
- LOGINFO_2(2,"Service: %s, Operation: %s", getService()->getType()->getName().c_str() , operationName.c_str());
+ loginfo("Service: %s, operation: %s", getService()->getType()->getName().c_str() , operationName.c_str());
for (unsigned int i=0; i<operation.getNParms(); i++)
{
- LOGINFO_2(2, "Parameter %p, Type %u", operation.getParameterValue(i),(int) operation.getParameterType(i));
+ loginfo("Parameter: %p, type: %u", operation.getParameterValue(i),(int) operation.getParameterType(i));
}
// Create the Axis2 client that will handle the Web Service invocation
@@ -98,8 +108,6 @@
Axis2Client client(compositeReference);
client.invoke(operation);
-
- LOGEXIT(1, "WSServiceWrapper::invoke");
}
} // End namespace ws
Modified: incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service.cpp Sat Nov 11 20:39:42 2006
@@ -146,33 +146,35 @@
try
{
- bool newInitParams = false;
+ bool restart = false;
+ bool resolve = false;
- if(systemRoot != root)
+ if (systemRoot != root)
{
systemRoot = root;
- newInitParams = true;
+ restart = true;
+ resolve = true;
}
- if(componentName != component)
+ if (componentName != component)
{
componentName = component;
- newInitParams = true;
+ resolve = true;
}
- if(serviceName != service)
+ if (serviceName != service)
{
serviceName = service;
- newInitParams = true;
+ resolve = true;
}
- if(tuscanyRuntime == NULL)
+ if (tuscanyRuntime == NULL)
{
AXIS2_LOG_INFO((env)->log, "Creating new Tuscany runtime\n");
tuscanyRuntime = new TuscanyRuntime(componentName, systemRoot);
tuscanyRuntime->start();
}
- else if(tuscanyRuntime != NULL && newInitParams)
+ else if (tuscanyRuntime != NULL && restart)
{
AXIS2_LOG_INFO((env)->log, "Restarting Tuscany runtime\n");
tuscanyRuntime->stop();
@@ -181,14 +183,14 @@
tuscanyRuntime->start();
}
- if(compositeService == NULL)
+ if (compositeService == NULL)
{
Composite* composite = (Composite*)SCARuntime::getInstance()->getDefaultComponent()->getType();
compositeService = (CompositeService*)composite->findComponent(serviceName);
}
else
{
- if(newInitParams)
+ if (resolve)
{
Composite* composite = SCARuntime::getInstance()->getDefaultComponent()->getComposite();
compositeService = (CompositeService*)composite->findComponent(serviceName);
@@ -220,34 +222,30 @@
if (element)
{
string op_name = "";
+
axis2_bool_t rest = AXIS2_MSG_CTX_GET_DOING_REST(msg_ctx, env);
if (rest)
{
axis2_endpoint_ref_t *endpoint_ref = AXIS2_MSG_CTX_GET_FROM(msg_ctx, env);
if (endpoint_ref)
{
- const axis2_char_t *address = AXIS2_ENDPOINT_REF_GET_ADDRESS(endpoint_ref, env);
- if (address)
+ const axis2_char_t *addr = AXIS2_ENDPOINT_REF_GET_ADDRESS(endpoint_ref, env);
+ if (addr)
{
- axis2_char_t **url_tokens = axis2_parse_request_url_for_svc_and_op(env, address);
- if (url_tokens)
- {
- if (url_tokens[1])
- {
- op_name = url_tokens[1];
- }
- if (NULL != url_tokens[1])
- AXIS2_FREE(env->allocator, url_tokens[1]);
- if (NULL != url_tokens[0])
- AXIS2_FREE(env->allocator, url_tokens[0]);
- AXIS2_FREE(env->allocator, url_tokens);
- }
+ // REST request, the op name is the last segment of the path
+ string raddress = addr;
+ string path;
+ string query;
+ Utils::tokeniseString("?", raddress, path, query);
+ string uri;
+ Utils::rTokeniseString("/", path, uri, op_name);
}
}
}
else
- {
- // This gets the operation name from the root element name - this is correct for DocLit Wrapped style
+ {
+ // SOAP request
+ // Get the operation name from the root element name, this is correct for DocLit Wrapped style
op_name = AXIOM_ELEMENT_GET_LOCALNAME(element, env);
}
@@ -276,15 +274,36 @@
// derived from the target address
axis2_endpoint_ref_t *endpoint_ref = NULL;
endpoint_ref = AXIS2_MSG_CTX_GET_FROM(msg_ctx, env);
- axis2_char_t *address = NULL;
- address = (axis2_char_t*) AXIS2_ENDPOINT_REF_GET_ADDRESS(endpoint_ref, env);
- axis2_char_t **url_tokens = NULL;
- url_tokens = axis2_parse_request_url_for_svc_and_op(env, address);
- string service(url_tokens[0]);
+ string address = AXIS2_ENDPOINT_REF_GET_ADDRESS(endpoint_ref, env);
- AXIS2_LOG_INFO((env)->log, "Axis2Service invoke called with system root: %s, service name: %s, operation name: %s", rootParam, service.c_str(), op_name.c_str());
+ axis2_bool_t isrest = AXIS2_MSG_CTX_GET_DOING_REST(msg_ctx, env);
+ string path;
+ if (isrest)
+ {
+ string op;
+ Utils::rTokeniseString("/", address, path, op);
+ }
+ else
+ {
+ path = address;
+ }
+
+ string path2;
+ string service;
+ Utils::rTokeniseString("/", path, path2, service);
+
+ string path3;
+ string component;
+ Utils::rTokeniseString("/", path2, path3, component);
+ if (component == "services")
+ {
+ component = "";
+ }
+
+ AXIS2_LOG_INFO((env)->log, "Axis2Service invoke called with system root: %s, component name: %s, service name: %s, operation name: %s",
+ rootParam, component.c_str(), service.c_str(), op_name.c_str());
- initTuscanyRuntime(env, rootParam, "", service.c_str());
+ initTuscanyRuntime(env, rootParam, component.c_str(), service.c_str());
}
if(!compositeService)
@@ -317,7 +336,7 @@
{
AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "WSDL description %s not found\n", wsdlNamespace.c_str());
string msg = "WSDL not found for " + wsdlNamespace;
- throw SystemConfigurationException(msg.c_str());
+ throwException(SystemConfigurationException, msg.c_str());
}
// Find the target operation in the wsdl port type.
@@ -327,7 +346,7 @@
binding->getEndpointName(),
op_name.c_str());
}
- catch(SystemConfigurationException &ex)
+ catch(SystemConfigurationException& ex)
{
AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "SystemConfigurationException has been caught: %s\n", ex.getMessageText());
throw;
@@ -351,14 +370,14 @@
{
AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "WSDL description %s not found\n", wsdlNamespace.c_str());
string msg = "WSDL not found for " + wsdlNamespace;
- throw SystemConfigurationException(msg.c_str());
+ throwException(SystemConfigurationException, msg.c_str());
}
try
{
wsdlOperation = wsdl->findOperation(wsdlInterface->getName(), op_name.c_str());
}
- catch(SystemConfigurationException &ex)
+ catch(SystemConfigurationException& ex)
{
AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "SystemConfigurationException has been caught: %s\n", ex.getMessageText());
throw;
@@ -379,8 +398,8 @@
wsdlOperation.setDocumentStyle(true);
wsdlOperation.setWrappedStyle(true);
wsdlOperation.setEncoded(false);
- wsdlOperation.setInputType(wsdlNamespace + "#" + op_name);
- wsdlOperation.setOutputType(wsdlNamespace + "#" + op_name + "Response");
+ wsdlOperation.setInputType(string("http://tempuri.org") + "#" + op_name);
+ wsdlOperation.setOutputType(string("http://tempuri.org") + "#" + op_name + "Response");
}
// Convert the input AXIOM node to an SDO DataObject
@@ -458,8 +477,6 @@
AXIS2_LOG_INFO((env)->log, "Axis2Service invoke has response OM : %s\n", str);
}
-
- //LOGEXIT(1, "Axis2Service_invoke");
return outputNode;
}
}
@@ -467,7 +484,6 @@
}
AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "Axis2Service_invoke: invalid OM parameters in request");
- //LOGERROR(0, "Axis2Service service ERROR: invalid OM parameters in request\n");
/** TODO: return a SOAP fault here */
return 0;
Modified: incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Utils.cpp Sat Nov 11 20:39:42 2006
@@ -40,13 +40,14 @@
*/
char* Axis2Utils::getAxisServiceParameterValue(const axis2_env_t *env, axis2_msg_ctx_t *msg_ctx, char* parameterName)
{
+ logentry();
+
struct axis2_svc *svc = NULL;
struct axis2_op_ctx *op_ctx = NULL;
struct axis2_svc_ctx *svc_ctx = NULL;
axis2_param_t *param = NULL;
char* paramValue = NULL;
- LOGENTRY(1, "Axis2Utils::getAxisServiceParameterValue");
op_ctx = AXIS2_MSG_CTX_GET_OP_CTX(msg_ctx, env);
svc_ctx = AXIS2_OP_CTX_GET_PARENT(op_ctx, env);
@@ -59,14 +60,13 @@
param = AXIS2_SVC_GET_PARAM(svc, env, parameterName);
if(!param)
{
- LOGERROR_1(1,"Axis parameter %s cannot be found", parameterName);
+ logwarning("Axis parameter %s cannot be found", parameterName);
}
else
{
paramValue = (char*) AXIS2_PARAM_GET_VALUE(param, env);
}
- LOGEXIT(1, "Axis2Utils::getAxisServiceParameterValue");
return paramValue;
}
Modified: incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSReferenceBindingExtension.cpp Sat Nov 11 20:39:42 2006
@@ -49,8 +49,7 @@
// ===================================================================
WSReferenceBindingExtension::WSReferenceBindingExtension()
{
- LOGENTRY(1, "WSReferenceBindingExtension::constructor");
- LOGEXIT(1, "WSReferenceBindingExtension::constructor");
+ logentry();
}
// ===================================================================
@@ -58,8 +57,7 @@
// ===================================================================
WSReferenceBindingExtension::~WSReferenceBindingExtension()
{
- LOGENTRY(1, "WSReferenceBindingExtension::destructor");;
- LOGEXIT(1, "WSReferenceBindingExtension::destructor");
+ logentry();
}
const string WSReferenceBindingExtension::extensionName("ws");
@@ -70,6 +68,8 @@
// ===================================================================
ReferenceBinding* WSReferenceBindingExtension::getReferenceBinding(Composite *composite, Reference* reference, DataObjectPtr scdlBinding)
{
+ logentry();
+
string bindingType = scdlBinding->getType().getName();
if (bindingType == "WebServiceBinding")
{
@@ -98,9 +98,8 @@
void WSReferenceBindingExtension::initialize()
{
- LOGENTRY(1, "WSReferenceBindingExtension::initialize");;
+ logentry();
SCARuntime::getInstance()->registerReferenceBindingExtension(new WSReferenceBindingExtension());
- LOGEXIT(1, "WSReferenceBindingExtension::initialize");;
}
} // End namespace ws
Modified: incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp Sat Nov 11 20:39:42 2006
@@ -56,7 +56,7 @@
WSServiceProxy::WSServiceProxy(Reference* reference)
: ServiceProxy(reference)
{
- LOGENTRY(1,"WSServiceProxy::constructor");
+ logentry();
// Get the target service wrapper
WSReferenceBinding* referenceBinding = (WSReferenceBinding*)reference->getBinding();
@@ -67,7 +67,7 @@
DataFactoryPtr dataFactory = reference->getComponent()->getComposite()->getDataFactory();
try {
const Type& bodyType = dataFactory->getType("http://www.w3.org/2003/05/soap-envelope", "Body");
- } catch (SDORuntimeException e)
+ } catch (SDORuntimeException&)
{
// Define the SOAP 1.2 Body type
@@ -88,8 +88,13 @@
"http://schemas.xmlsoap.org/soap/envelope/", "Body",
false, false, true);
}
-
- LOGEXIT(1,"WSServiceProxy::constructor");
+
+ try {
+ const Type& tempType = dataFactory->getType("http://tempuri.org", "RootType");
+ } catch (SDORuntimeException&)
+ {
+ dataFactory->addType("http://tempuri.org", "RootType", false, false, false);
+ }
}
// ==========
@@ -97,8 +102,7 @@
// ==========
WSServiceProxy::~WSServiceProxy()
{
- LOGENTRY(1,"WSServiceProxy::destructor");
- LOGEXIT(1,"WSServiceProxy::destructor");
+ logentry();
}
///
@@ -106,7 +110,7 @@
///
DataObjectPtr WSServiceProxy::invoke(const WSDLOperation& wsdlOperation, DataObjectPtr inputDataObject)
{
- LOGENTRY(1,"WSServiceProxy::invoke");
+ logentry();
Reference* reference = getReference();
Component* component = reference->getComponent();
@@ -121,13 +125,13 @@
const char* outputTypeURI = wsdlOperation.getOutputTypeUri().c_str();
const char* outputTypeName = wsdlOperation.getOutputTypeName().c_str();
- LOGINFO_2(4, "WSServiceProxy has got WSDLOperation with inputType: %s#%s",
+ loginfo("WSDLOperation inputType: %s#%s",
wsdlOperation.getInputTypeUri().c_str(),
wsdlOperation.getInputTypeName().c_str());
- LOGINFO_2(4, "WSServiceProxy has got WSDLOperation with outputType: %s#%s",
+ loginfo("WSDLOperation outputType: %s#%s",
outputTypeURI,
outputTypeName);
- LOGINFO_2(4, "WSServiceProxy has got WSDLOperation with documentStyle=%d and wrapped=%d",
+ loginfo("WSDLOperation documentStyle: %d, wrapped: %d",
documentStyle,
wrappedStyle);
@@ -235,7 +239,7 @@
DataObjectPtr dataObjectData = inputDataObject->getDataObject(pl[i]);
if(!dataObjectData)
{
- LOGINFO_1(4, "SDO DataObject parameter named %s was null", name);
+ loginfo("Null DataObject parameter named %s", name);
}
operation.addParameter(&dataObjectData);
}
@@ -256,7 +260,7 @@
{
// Add a null DataObject ptr
- LOGINFO_2(4, "SDO OpenDataObject parameter named %s[%d] was null", name, j);
+ loginfo("Null OpenDataObject parameter named %s[%d]", name, j);
operation.addParameter(&dataObjectData);
}
else
@@ -277,7 +281,7 @@
DataObjectPtr dob = sequence->getDataObjectValue(0);
if(!dob)
{
- LOGINFO_1(4, "SDO DataObject parameter named %s was null", name);
+ loginfo("Null DataObject parameter named %s", name);
}
operation.addParameter(&dob);
}
@@ -285,7 +289,7 @@
else
{
// Empty content, add an empty string
- LOGINFO_2(4, "SDO OpenDataObject parameter named %s[%d] was empty", name, j);
+ loginfo("Empty OpenDataObject parameter named %s[%d]", name, j);
string* stringData = new string("");
operation.addParameter(stringData);
}
@@ -294,26 +298,26 @@
}
break;
case Type::DateType:
- LOGERROR_1(0, "SDO DateType parameters are not yet supported (%s)", name);
+ logwarning("SDO DateType parameters are not yet supported (%s)", name);
return NULL;
case Type::LongType:
- LOGERROR_1(0, "SDO LongType (int64_t) parameters are not yet supported (%s)", name);
+ logwarning("SDO LongType (int64_t) parameters are not yet supported (%s)", name);
return NULL;
break;
case Type::UriType:
- LOGERROR_1(0, "SDO UriType parameters are not yet supported (%s)", name);
+ logwarning("SDO UriType parameters are not yet supported (%s)", name);
return NULL;
break;
case Type::BigDecimalType:
- LOGERROR_1(0, "SDO BigDecimalType parameters are not yet supported (%s)", name);
+ logwarning("SDO BigDecimalType parameters are not yet supported (%s)", name);
return NULL;
break;
case Type::BigIntegerType:
- LOGERROR_1(0, "SDO BigIntegerType parameters are not yet supported (%s)", name);
+ logwarning("SDO BigIntegerType parameters are not yet supported (%s)", name);
return NULL;
break;
default:
- LOGERROR_1(0, "Unknown SDO type parameter named %s has been found. Unknown types are not yet supported", name);
+ logwarning("Unknown SDO type parameter named %s has been found. Unknown types are not yet supported", name);
return NULL;
}
}
@@ -334,7 +338,7 @@
const Type& outputType = prop.getType();
outputDataObject = dataFactoryPtr->create(outputType);
}
- catch (SDORuntimeException e)
+ catch (SDORuntimeException&)
{
try
{
@@ -343,7 +347,7 @@
const Type& outputType = dataFactoryPtr->getType(outputTypeURI, outputTypeName);
outputDataObject = dataFactoryPtr->create(outputType);
}
- catch (SDORuntimeException e)
+ catch (SDORuntimeException&)
{
// The output wrapper type is not known, create an open DataObject
outputDataObject = dataFactoryPtr->create(Type::SDOTypeNamespaceURI, "OpenDataObject");
@@ -352,35 +356,32 @@
setOutputData(operation, outputDataObject, dataFactoryPtr);
- LOGEXIT(1,"WSServiceProxy::invoke");
-
return outputDataObject;
}
- catch(SDORuntimeException &ex)
+ catch(SDORuntimeException& ex)
{
// TODO: Return more error information than just a null DataObject
- LOGERROR_2(0, "%s has been caught: %s\n", ex.getEClassName(), ex.getMessageText());
+ logwarning("%s has been caught: %s", ex.getEClassName(), ex.getMessageText());
return NULL;
}
- catch(TuscanyRuntimeException &ex)
+ catch(TuscanyRuntimeException& ex)
{
// TODO: Return more error information than just a null DataObject
- LOGERROR_2(0, "%s has been caught: %s\n", ex.getEClassName(), ex.getMessageText());
+ logwarning("%s has been caught: %s", ex.getEClassName(), ex.getMessageText());
return NULL;
}
}
else
{
- LOGERROR(0, "CompositeServices with non-wrapped document style WSDL Operations are not yet supported");
- LOGEXIT(1,"WSServiceProxy::invoke");
+ logwarning("Non-wrapped document style WSDL operations are not yet supported");
return NULL;
}
}
else
{
// RPC style
- LOGERROR(0, "CompositeServices with RPC style WSDL Operations are not yet supported");
+ logwarning("RPC style WSDL Operations are not yet supported");
return NULL;
}
}
@@ -388,6 +389,8 @@
void WSServiceProxy::setOutputData(Operation& operation, DataObjectPtr outputDataObject, DataFactoryPtr dataFactoryPtr)
{
+ logentry();
+
// Go through data object to set the return value
PropertyList pl = outputDataObject->getType().getProperties();
@@ -471,13 +474,13 @@
{
string msg = "Unsupported parameter type";
msg += resultType;
- throw msg.c_str();
+ throwException(SystemConfigurationException, msg.c_str());
}
}
}
else
{
- LOGINFO(4, "No return values are defined");
+ loginfo("No return values defined");
}
}
else {
@@ -548,7 +551,7 @@
}
else
{
- LOGINFO_1(4, "Return value is NULL, so leaving property %s unset", pl[i].getName());
+ loginfo("Null return value, leaving property %s unset", pl[i].getName());
}
break;
}
@@ -566,7 +569,7 @@
}
else
{
- LOGINFO_1(4, "Return value is NULL, so leaving property %s unset", pl[i].getName());
+ loginfo("Null return value, leaving property %s unset", pl[i].getName());
}
break;
@@ -575,7 +578,7 @@
{
string msg = "Unsupported parameter type";
msg += resultType;
- throw msg.c_str();
+ throwException(SystemConfigurationException, msg.c_str());
}
}
}
Modified: incubator/tuscany/cpp/sca/samples/BigBank/bigbank.account/AccountDataServiceImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/BigBank/bigbank.account/AccountDataServiceImpl.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/samples/BigBank/bigbank.account/AccountDataServiceImpl.cpp (original)
+++ incubator/tuscany/cpp/sca/samples/BigBank/bigbank.account/AccountDataServiceImpl.cpp Sat Nov 11 20:39:42 2006
@@ -59,11 +59,11 @@
delete name;
newaccount->setFloat("balance",1500.0f);
-
+
return newaccount;
}
- catch (SDORuntimeException e)
+ catch (SDORuntimeException& e)
{
return 0;
}
@@ -94,7 +94,7 @@
return newaccount;
}
- catch (SDORuntimeException e)
+ catch (SDORuntimeException& e)
{
return 0;
}
@@ -126,7 +126,7 @@
return newaccount;
}
- catch (SDORuntimeException e)
+ catch (SDORuntimeException& e)
{
return 0;
}
Modified: incubator/tuscany/cpp/sca/samples/BigBank/bigbank.account/StockQuoteServiceImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/BigBank/bigbank.account/StockQuoteServiceImpl.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/samples/BigBank/bigbank.account/StockQuoteServiceImpl.cpp (original)
+++ incubator/tuscany/cpp/sca/samples/BigBank/bigbank.account/StockQuoteServiceImpl.cpp Sat Nov 11 20:39:42 2006
@@ -60,7 +60,7 @@
stockPrice=stockDoc->getRootDataObject()->getFloat("Stock.0/Last");
}
}
- catch (SDORuntimeException e)
+ catch (SDORuntimeException& e)
{
std::cout << e << std::endl;
return 0.0f;
Modified: incubator/tuscany/cpp/sca/samples/BigBank/bigbank.client/AccountClient.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/BigBank/bigbank.client/AccountClient.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/samples/BigBank/bigbank.client/AccountClient.cpp (original)
+++ incubator/tuscany/cpp/sca/samples/BigBank/bigbank.client/AccountClient.cpp Sat Nov 11 20:39:42 2006
@@ -113,10 +113,6 @@
{
cout << e << endl;
}
- catch (char* x)
- {
- cout << "account_client: exception caught: " << x << endl;
- }
}
}
Modified: incubator/tuscany/cpp/sca/samples/Calculator/sample.calculator.client/CalculatorClient.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/Calculator/sample.calculator.client/CalculatorClient.cpp?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/samples/Calculator/sample.calculator.client/CalculatorClient.cpp (original)
+++ incubator/tuscany/cpp/sca/samples/Calculator/sample.calculator.client/CalculatorClient.cpp Sat Nov 11 20:39:42 2006
@@ -81,47 +81,39 @@
}
else
{
- try
- {
- float result = 0;
- if (strcmp(operation, "add") == 0)
- {
- result = calcService->add(arg1, arg2);
- cout << "calculator_client: add(" << arg1 << "," << arg2 << ") = " << result << endl;
- }
- else
- if (strcmp(operation, "sub") == 0)
- {
- result = calcService->sub(arg1, arg2);
- cout << "calculator_client: sub(" << arg1 << "," << arg2 << ") = " << result << endl;
- }
- else
- if (strcmp(operation, "mul") == 0)
- {
- result = calcService->mul(arg1, arg2);
- cout << "calculator_client: mul(" << arg1 << "," << arg2 << ") = " << result << endl;
- }
- else
- if (strcmp(operation, "div") == 0)
- {
- result = calcService->div(arg1, arg2);
- cout << "calculator_client: div(" << arg1 << "," << arg2 << ") = " << result << endl;
- }
- else
- {
- cout << "calculator_client: Unrecognized operation: " << operation << endl;
- }
- }
- catch (char* x)
- {
- cout << "calculator_client: exception caught: " << x << endl;
+ float result = 0;
+ if (strcmp(operation, "add") == 0)
+ {
+ result = calcService->add(arg1, arg2);
+ cout << "calculator_client: add(" << arg1 << "," << arg2 << ") = " << result << endl;
+ }
+ else
+ if (strcmp(operation, "sub") == 0)
+ {
+ result = calcService->sub(arg1, arg2);
+ cout << "calculator_client: sub(" << arg1 << "," << arg2 << ") = " << result << endl;
+ }
+ else
+ if (strcmp(operation, "mul") == 0)
+ {
+ result = calcService->mul(arg1, arg2);
+ cout << "calculator_client: mul(" << arg1 << "," << arg2 << ") = " << result << endl;
+ }
+ else
+ if (strcmp(operation, "div") == 0)
+ {
+ result = calcService->div(arg1, arg2);
+ cout << "calculator_client: div(" << arg1 << "," << arg2 << ") = " << result << endl;
+ }
+ else
+ {
+ cout << "calculator_client: Unrecognized operation: " << operation << endl;
}
}
-
}
catch (ServiceRuntimeException& ex)
{
- cout << ex << endl;
+ cout << "calculator_client: exception caught: " << ex << endl;
}
return 0;
}
Modified: incubator/tuscany/cpp/sca/samples/RubyBank/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/RubyBank/Makefile.am?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/samples/RubyBank/Makefile.am (original)
+++ incubator/tuscany/cpp/sca/samples/RubyBank/Makefile.am Sat Nov 11 20:39:42 2006
@@ -16,6 +16,6 @@
# under the License.
deploydir=$(prefix)/samples/RubyBank/deploy
-SUBDIRS = bigbank.account bigbank.client
+SUBDIRS = bigbank.account bigbank.client bigbank.wsclient
EXTRA_DIST = *.composite README.html
deploy_DATA = *.composite
Modified: incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.account/AccountServiceImpl.rb
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.account/AccountServiceImpl.rb?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.account/AccountServiceImpl.rb (original)
+++ incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.account/AccountServiceImpl.rb Sat Nov 11 20:39:42 2006
@@ -24,60 +24,53 @@
attr_writer :accountDataService
attr_writer :stockQuoteService
attr_writer :currency
-
+
def initialize()
print "Ruby - AccountServiceImpl.initialize\n"
end
def getAccountReport(customerID)
+ # Get the checking account info
checking = @accountDataService.getCheckingAccount(customerID)
+ # Get the savings account info
savings = @accountDataService.getSavingsAccount(customerID)
+ # Get the stocks account info
stock = @accountDataService.getStockAccount(customerID);
symbol = stock.root.elements["symbol"].text
quantity = stock.root.elements["quantity"].text
+ # Get the stock price
price = @stockQuoteService.getQuote(symbol);
+
+ # Convert to the configured currency
+ price = price.to_f * 0.80 if @currency == "EUR"
- balance = fromUSDollarToCurrency(price.to_f * quantity.to_f)
+ # Calculate the balance
+ balance = price.to_f * quantity.to_f
+ # Form the AccountReport document
report = Document.new <<-eof
<AccountReport xmlns="http://www.bigbank.com/AccountService"
xsi:type="AccountReport" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<checking>
- <accountNumber>
- #{ checking.root.elements["accountNumber"].text }
- </accountNumber>
- <balance>
- #{ fromUSDollarToCurrency(checking.root.elements["balance"].text) }
- </balance>
+ <accountNumber>#{ checking.root.elements["accountNumber"].text }</accountNumber>
+ <balance>#{ checking.root.elements["balance"].text }</balance>
</checking>
<savings>
- <accountNumber>
- #{ savings.root.elements["accountNumber"].text }
- </accountNumber>
- <balance>
- #{ fromUSDollarToCurrency(savings.root.elements["balance"].text) }
- </balance>
+ <accountNumber>#{ savings.root.elements["accountNumber"].text }</accountNumber>
+ <balance>#{ savings.root.elements["balance"].text }</balance>
</savings>
<stocks>
- <accountNumber>
- #{ stock.root.elements["accountNumber"].text }
- </accountNumber>
- <symbol>
- #{ symbol }
- </symbol>
- <quantity>
- #{ quantity }
- </quantity>
- <balance>
- #{ balance }
- </balance>
+ <accountNumber>#{ stock.root.elements["accountNumber"].text }</accountNumber>
+ <symbol>#{ symbol }</symbol>
+ <quantity>#{ quantity }</quantity>
+ <balance>#{ balance }</balance>
</stocks>
</AccountReport>
@@ -86,9 +79,4 @@
return report
end
- def fromUSDollarToCurrency(value)
- return value.to_f * 0.8 if @currency == "EURO"
- return value.to_f
- end
-
end
Modified: incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.account/StockQuoteServiceImpl.rb
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.account/StockQuoteServiceImpl.rb?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.account/StockQuoteServiceImpl.rb (original)
+++ incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.account/StockQuoteServiceImpl.rb Sat Nov 11 20:39:42 2006
@@ -35,6 +35,8 @@
price = doc.root.elements["Stock"].elements["Last"].text;
+ print "Ruby - stock price = ", price, "\n"
+
return price.to_f
end
Modified: incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.account/bigbank.account.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.account/bigbank.account.composite?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.account/bigbank.account.composite (original)
+++ incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.account/bigbank.account.composite Sat Nov 11 20:39:42 2006
@@ -33,7 +33,7 @@
<implementation.ruby script="AccountServiceImpl.rb" class="AccountServiceImpl"/>
<reference name="accountDataService">AccountDataServiceComponent</reference>
<reference name="stockQuoteService">StockQuoteServiceComponent</reference>
- <property name="currency">EURO</property>
+ <property name="currency">EUR</property>
</component>
<component name="AccountDataServiceComponent">
Modified: incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.accountmanagement.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.accountmanagement.composite?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.accountmanagement.composite (original)
+++ incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.accountmanagement.composite Sat Nov 11 20:39:42 2006
@@ -25,5 +25,9 @@
<implementation.composite name="bigbank.account"/>
</component>
+ <component name="bigbank.AccountWSClientComponent">
+ <implementation.composite name="bigbank.wsclient"/>
+ </component>
+
</composite>
Modified: incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.client/AccountClient.rb
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.client/AccountClient.rb?view=diff&rev=473873&r1=473872&r2=473873
==============================================================================
--- incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.client/AccountClient.rb (original)
+++ incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.client/AccountClient.rb Sat Nov 11 20:39:42 2006
@@ -23,4 +23,18 @@
report = accountService.getAccountReport(1234)
-print report
+checking = report.root.elements["checking"]
+savings = report.root.elements["savings"]
+stocks = report.root.elements["stocks"]
+
+print "\n"
+print "Checking account: ", checking.elements["accountNumber"].text.strip, "\n"
+print "Balance: ", checking.elements["balance"].text.strip, "\n"
+
+print "Savings account: ", savings.elements["accountNumber"].text.strip, "\n"
+print "Balance: ", savings.elements["balance"].text.strip, "\n"
+
+print "Stocks account:", stocks.elements["accountNumber"].text.strip, "\n"
+print "Symbol: ", stocks.elements["symbol"].text.strip, "\n"
+print "Quantity: ", stocks.elements["quantity"].text.strip, "\n"
+print "Balance: ", stocks.elements["balance"].text.strip, "\n"
Added: incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/AccountService.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/AccountService.wsdl?view=auto&rev=473873
==============================================================================
--- incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/AccountService.wsdl (added)
+++ incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/AccountService.wsdl Sat Nov 11 20:39:42 2006
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.bigbank.com/AccountService"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.bigbank.com/AccountService"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema
+ targetNamespace="http://www.bigbank.com/AccountService"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="result"
+ type="tns:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="checking"
+ type="tns:CheckingAccount" maxOccurs="unbounded" />
+ <xsd:element name="savings"
+ type="tns:SavingsAccount" maxOccurs="unbounded" />
+ <xsd:element name="stocks" type="tns:StockAccount"
+ maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="StockAccount">
+ <xsd:sequence>
+ <xsd:element name="accountNumber" type="xsd:string" />
+ <xsd:element name="symbol" type="xsd:string" />
+ <xsd:element name="quantity" type="xsd:integer" />
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="CheckingAccount">
+ <xsd:sequence>
+ <xsd:element name="accountNumber" type="xsd:string" />
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="SavingsAccount">
+ <xsd:sequence>
+ <xsd:element name="accountNumber" type="xsd:string" />
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="tns:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="tns:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="tns:getAccountReportRequest" />
+ <wsdl:output message="tns:getAccountReportResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AccountServiceSOAP" type="tns:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/AccountService/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="tns:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:9090/axis2/services/AccountService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Propchange: incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/AccountService.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/AccountService.wsdl
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/AccountWSClient.rb
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/AccountWSClient.rb?view=auto&rev=473873
==============================================================================
--- incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/AccountWSClient.rb (added)
+++ incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/AccountWSClient.rb Sat Nov 11 20:39:42 2006
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+#
+
+require("tuscany_sca_ruby")
+
+accountService = SCA::locateService("AccountService")
+
+report = accountService.getAccountReport(1234)
+
+checking = report.root.elements["checking"]
+savings = report.root.elements["savings"]
+stocks = report.root.elements["stocks"]
+
+print "\n\n"
+print "Checking account #: ", checking.elements["accountNumber"].text.strip, "\n"
+print "Balance: ", checking.elements["balance"].text.strip, "\n"
+
+print "Savings account #: ", savings.elements["accountNumber"].text.strip, "\n"
+print "Balance: ", savings.elements["balance"].text.strip, "\n"
+
+print "Stocks account #:", stocks.elements["accountNumber"].text.strip, "\n"
+print "Symbol: ", stocks.elements["symbol"].text.strip, "\n"
+print "Quantity: ", stocks.elements["quantity"].text.strip, "\n"
+print "Balance: ", stocks.elements["balance"].text.strip, "\n"
Propchange: incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/AccountWSClient.rb
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/AccountWSClient.rb
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/Makefile.am?view=auto&rev=473873
==============================================================================
--- incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/Makefile.am Sat Nov 11 20:39:42 2006
@@ -0,0 +1,6 @@
+deploydir=$(prefix)/samples/RubyBank/deploy
+clientdir=$(deploydir)/bigbank.wsclient
+
+client_DATA = *.rb *.composite *.wsdl
+client_SCRIPTS = runwsclient.sh
+EXTRA_DIST = runwsclient.sh *.rb *.composite *.wsdl
Propchange: incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/Makefile.am
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/samples/RubyBank/bigbank.wsclient/Makefile.am
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org