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/09/09 10:12:47 UTC
svn commit: r441758 - in /incubator/tuscany/cpp/sca: runtime/core/src/
runtime/core/src/tuscany/sca/model/
runtime/extensions/cpp/src/tuscany/sca/cpp/
runtime/extensions/cpp/src/tuscany/sca/cpp/model/
runtime/extensions/cpp/xsd/ runtime/extensions/ws/r...
Author: jsdelfino
Date: Sat Sep 9 01:12:45 2006
New Revision: 441758
URL: http://svn.apache.org/viewvc?view=rev&rev=441758
Log:
Adding loading of WSDL interfaces, and now using them to determine input/output types on WS services and references
Added:
incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.cpp (with props)
incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.h (with props)
Modified:
incubator/tuscany/cpp/sca/runtime/core/src/Makefile.am
incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Interface.h
incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp
incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp
incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.h
incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.cpp
incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.h
incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.cpp
incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.h
incubator/tuscany/cpp/sca/runtime/extensions/cpp/xsd/sca-interface-cpp.xsd
incubator/tuscany/cpp/sca/runtime/extensions/ws/reference/axis2c/src/tuscany/sca/ws/Axis2Client.cpp
incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service_skeleton.cpp
incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp
incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.h
incubator/tuscany/cpp/sca/samples/BigBank/bigbank.account/bigbank.account.composite
Modified: incubator/tuscany/cpp/sca/runtime/core/src/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/Makefile.am?view=diff&rev=441758&r1=441757&r2=441758
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/Makefile.am (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/Makefile.am Sat Sep 9 01:12:45 2006
@@ -37,6 +37,7 @@
tuscany/sca/model/ServiceType.cpp \
tuscany/sca/model/Wire.cpp \
tuscany/sca/model/WSDLDefinition.cpp \
+tuscany/sca/model/WSDLInterface.cpp \
tuscany/sca/model/WSDLOperation.cpp \
tuscany/sca/util/DefaultLogWriter.cpp \
tuscany/sca/util/Exceptions.cpp \
Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Interface.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Interface.h?view=diff&rev=441758&r1=441757&r2=441758
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Interface.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Interface.h Sat Sep 9 01:12:45 2006
@@ -20,6 +20,10 @@
#ifndef tuscany_sca_model_interface_h
#define tuscany_sca_model_interface_h
+#include <string>
+
+using namespace std;
+
namespace tuscany
{
namespace sca
@@ -57,6 +61,12 @@
*/
SCA_API bool isConversational() const { return conversational; };
+ /**
+ * return the QName of schema type for this interface type
+ * (e.g. "http://www.osoa.org/xmlns/sca/1.0#WSDLInterface")
+ */
+ SCA_API virtual const string& getInterfaceTypeQName() = 0;
+
private:
/**
Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp?view=diff&rev=441758&r1=441757&r2=441758
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp Sat Sep 9 01:12:45 2006
@@ -30,6 +30,7 @@
#include "tuscany/sca/model/CompositeReference.h"
#include "tuscany/sca/model/ServiceType.h"
#include "tuscany/sca/model/ReferenceType.h"
+#include "tuscany/sca/model/WSDLInterface.h"
#include "tuscany/sca/core/SCARuntime.h"
#include "commonj/sdo/TypeDefinitions.h"
#include "tuscany/sca/util/File.h"
@@ -489,20 +490,30 @@
string typeQname = iface->getType().getURI();
typeQname += "#";
typeQname += iface->getType().getName();
-
- // Locate extension that handles this implementation type
- InterfaceExtension* ifaceExtension = runtime->getInterfaceExtension(typeQname);
- if (ifaceExtension)
+
+ if (typeQname == WSDLInterface::typeQName)
{
- return ifaceExtension->getInterface(composite, iface);
+ // Load a WSDL interface
+ string qname = iface->getCString("interface");
+
+ return new WSDLInterface(qname, true, false);
}
else
{
- // log this for now.
- // We currently do not handle <interface.wsdl>
- LOGERROR_1(1, "ModelLoader::getInterface: Unsupported interface type: %s", typeQname.c_str());
- return 0;
+ // Locate extension that handles this interface type
+ InterfaceExtension* ifaceExtension = runtime->getInterfaceExtension(typeQname);
+ if (ifaceExtension)
+ {
+ return ifaceExtension->getInterface(composite, iface);
+ }
+ else
+ {
+ // log this for now.
+ LOGERROR_1(1, "ModelLoader::getInterface: Unsupported interface type: %s", typeQname.c_str());
+ return 0;
+ }
}
+
}
// ==============================================
@@ -543,18 +554,26 @@
//Utils::printDO(compositeServiceDO);
string compositeServiceName = compositeServiceDO->getCString("name");
- Interface* iface = getInterface(composite, compositeServiceDO);
+ Interface* iface;
+ if (compositeServiceDO->getDataObject("interface"))
+ {
+ iface = getInterface(composite, compositeServiceDO);
+ }
+ else
+ {
+ iface = NULL;
+ }
- ReferenceType::Multiplicity multiplicity;
- if (compositeServiceDO->isSet("multiplicity"))
- {
- string s = compositeServiceDO->getCString("multiplicity");
- multiplicity = ReferenceType::getMultiplicityFromString(s);
- }
- else
- {
- multiplicity = ReferenceType::ONE_ONE;
- }
+ ReferenceType::Multiplicity multiplicity;
+ if (compositeServiceDO->isSet("multiplicity"))
+ {
+ string s = compositeServiceDO->getCString("multiplicity");
+ multiplicity = ReferenceType::getMultiplicityFromString(s);
+ }
+ else
+ {
+ multiplicity = ReferenceType::ONE_ONE;
+ }
CompositeService* compositeService = new CompositeService(
composite, compositeServiceName, iface, NULL, false, multiplicity);
@@ -615,13 +634,21 @@
{
string compositeReferenceName = compositeReferenceDO->getCString("name");
- Interface* iface = getInterface(composite, compositeReferenceDO);
+ Interface* iface;
+ if (compositeReferenceDO->getDataObject("interface"))
+ {
+ iface = getInterface(composite, compositeReferenceDO);
+ }
+ else
+ {
+ iface = NULL;
+ }
CompositeReference* compositeReference = new CompositeReference(
composite, compositeReferenceName, iface, NULL, false, ReferenceType::ONE_ONE);
composite->addComponent(compositeReference);
-
+
// Get binding, it will be the first and only binding
DataObjectList& bindings = compositeReferenceDO->getList("binding");
if (bindings.size()==0)
Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp?view=diff&rev=441758&r1=441757&r2=441758
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLDefinition.cpp Sat Sep 9 01:12:45 2006
@@ -115,6 +115,7 @@
string soapAction = "";
bool documentStyle = true;
+ bool wrappedStyle = true;
bool useEncoded = false;
WSDLOperation::soapVersion soapVer = WSDLOperation::SOAP11;
@@ -145,6 +146,7 @@
if (style != "document")
{
documentStyle = false;
+ wrappedStyle = false;
}
// get the use
@@ -215,6 +217,7 @@
wsdlOp.setEndpoint(targetAddress);
wsdlOp.setSoapVersion(soapVer);
wsdlOp.setDocumentStyle(documentStyle);
+ wsdlOp.setWrappedStyle(wrappedStyle);
wsdlOp.setEncoded(useEncoded);
wsdlOp.setInputType(requestType);
wsdlOp.setOutputType(responseType);
@@ -251,8 +254,9 @@
return iter->second;
}
- string soapAction = "";
+ string soapAction = getNamespace() + "#" + operationName;
bool documentStyle = true;
+ bool wrappedStyle = true;
bool useEncoded = false;
WSDLOperation::soapVersion soapVer = WSDLOperation::SOAP11;
@@ -311,6 +315,7 @@
wsdlOp.setEndpoint("");
wsdlOp.setSoapVersion(soapVer);
wsdlOp.setDocumentStyle(documentStyle);
+ wsdlOp.setWrappedStyle(wrappedStyle);
wsdlOp.setEncoded(useEncoded);
wsdlOp.setInputType(requestType);
wsdlOp.setOutputType(responseType);
Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.cpp?view=auto&rev=441758
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.cpp Sat Sep 9 01:12:45 2006
@@ -0,0 +1,100 @@
+/*
+ * 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.
+ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Utils.h"
+#include "tuscany/sca/model/WSDLInterface.h"
+
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace model
+ {
+
+ const string WSDLInterface::typeQName("http://www.osoa.org/xmlns/sca/1.0#WSDLPortType");
+
+ // Constructor
+ WSDLInterface::WSDLInterface(
+ const string& qname, bool remotable, bool conversational)
+ : Interface(remotable, conversational)
+ {
+ parse(qname);
+ }
+
+ void WSDLInterface::parse(const string& qname)
+ {
+ // PortType is of the form: <wsdl-namepace-uri>#wsdl.interface(<portType-name>)
+ string::size_type hash = qname.find("#");
+ if (hash != string::npos)
+ {
+ // Found a hash
+
+ // Namepace is the part before the #
+ namespaceURI = qname.substr(0, hash);
+
+ if ( (hash+1) < qname.length())
+ {
+ // Check the next part is wsdl.interface(
+ int ending = hash+16;
+ string check = qname.substr(hash+1, 15);
+ if (check.compare("wsdl.interface(") == 0)
+ {
+ // Find the matching )
+ int endBracket = qname.find(")",ending);
+ if (endBracket-1 > ending+1)
+ {
+ name = qname.substr(ending, endBracket-ending);
+ }
+ else
+ {
+ // Nothing between the ()
+ name = "";
+ }
+ }
+ else
+ {
+ // not the correct characters after the #, ignore the rest
+ name = "";
+ }
+
+ }
+ else
+ {
+ // Nothing after the hash
+ name = "";
+ }
+ }
+ else
+ {
+ // No hash at all
+ namespaceURI = qname;
+ name = "";
+ }
+ }
+
+
+ WSDLInterface::~WSDLInterface()
+ {
+ }
+
+ } // End namespace model
+ } // End namespace sca
+} // End namespace tuscany
Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.h?view=auto&rev=441758
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.h (added)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.h Sat Sep 9 01:12:45 2006
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ */
+
+#ifndef tuscany_sca_model_wsdlinterface_h
+#define tuscany_sca_model_wsdlinterface_h
+
+#include "tuscany/sca/model/Interface.h"
+
+#include <string>
+using std::string;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace model
+ {
+ /**
+ * Holds information about an interface described using a WSDL
+ * port type.
+ */
+ class WSDLInterface : public Interface
+ {
+
+ public:
+ /**
+ * Constuctor.
+ * @param interfaceName Name of the WSDL interface.
+ */
+ WSDLInterface(const string& qname, bool remotable, bool conversational);
+
+ /**
+ * Destructor.
+ */
+ virtual ~WSDLInterface();
+
+ /**
+ * Returns the WSDL namespace
+ */
+ string getNamespaceURI() const { return namespaceURI; }
+
+ /**
+ * Returns the interface name
+ */
+ string getName() const { return name; }
+
+ /**
+ * return the QName of the schema type for this interface type
+ * (e.g. "http://www.osoa.org/xmlns/sca/1.0#interface.cpp")
+ */
+ virtual const string& getInterfaceTypeQName() { return typeQName; };
+
+ /**
+ * The QName of the schema type for this interface type.
+ */
+ static const string typeQName;
+
+ private:
+
+ /**
+ * Parse the WSDL qname
+ */
+ void parse(const string& qname);
+
+ /**
+ * WSDL namespace.
+ */
+ string namespaceURI;
+
+ /**
+ * Name of the WSDL interface.
+ */
+ string name;
+
+ };
+
+ } // End namespace model
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_cpp_wsdlinterface_h
+
Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WSDLInterface.h
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.h?view=diff&rev=441758&r1=441757&r2=441758
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.h (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPImplementationExtension.h Sat Sep 9 01:12:45 2006
@@ -48,7 +48,7 @@
virtual const string& getExtensionName() {return extensionName;}
/**
- * return the QName of schema elemant for this implementation extension
+ * return the QName of schema type for this implementation extension
* (e.g. "http://www.osoa.org/xmlns/sca/1.0#implementation.cpp")
*/
virtual const string& getExtensionTypeQName() {return typeQName;}
Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.cpp?view=diff&rev=441758&r1=441757&r2=441758
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.cpp Sat Sep 9 01:12:45 2006
@@ -61,9 +61,8 @@
string header = scdlInterface->getCString("header");
string className = scdlInterface->getCString("class");
bool remotable = scdlInterface->getBoolean("remotable");
- bool conversational = scdlInterface->getBoolean("conversational");
- return new CPPInterface(header, className, remotable, conversational);
+ return new CPPInterface(header, className, remotable, false);
}
return 0;
}
Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.h?view=diff&rev=441758&r1=441757&r2=441758
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.h (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/CPPInterfaceExtension.h Sat Sep 9 01:12:45 2006
@@ -48,8 +48,8 @@
virtual const string& getExtensionName() {return extensionName;}
/**
- * return the QName of schema elemant for this implementation extension
- * (e.g. "http://www.osoa.org/xmlns/sca/1.0#implementation.cpp")
+ * return the QName of schema type for this interface extension
+ * (e.g. "http://www.osoa.org/xmlns/sca/1.0#interface.cpp")
*/
virtual const string& getExtensionTypeQName() {return typeQName;}
Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.cpp?view=diff&rev=441758&r1=441757&r2=441758
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.cpp Sat Sep 9 01:12:45 2006
@@ -29,8 +29,10 @@
namespace cpp
{
+ const string CPPInterface::typeQName("http://www.osoa.org/xmlns/sca/1.0#CPPInterface");
+
// Constructor
- CPPInterface::CPPInterface(
+ CPPInterface::CPPInterface(
const string& header,
const string& className,
bool remotable,
Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.h?view=diff&rev=441758&r1=441757&r2=441758
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.h (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/src/tuscany/sca/cpp/model/CPPInterface.h Sat Sep 9 01:12:45 2006
@@ -82,6 +82,12 @@
*/
const string& getClass() { return className; }
+ /**
+ * return the QName of the schema type for this interface type
+ * (e.g. "http://www.osoa.org/xmlns/sca/1.0#interface.cpp")
+ */
+ virtual const string& getInterfaceTypeQName() { return typeQName; };
+
private:
/**
@@ -99,6 +105,10 @@
*/
string className;
+ /**
+ * The QName of the schema type for this interface type.
+ */
+ static const string typeQName;
};
} // End namespace cpp
Modified: incubator/tuscany/cpp/sca/runtime/extensions/cpp/xsd/sca-interface-cpp.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/xsd/sca-interface-cpp.xsd?view=diff&rev=441758&r1=441757&r2=441758
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/xsd/sca-interface-cpp.xsd (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/xsd/sca-interface-cpp.xsd Sat Sep 9 01:12:45 2006
@@ -31,7 +31,6 @@
<attribute name="callbackHeader" type="NCName" use="optional" />
<attribute name="callbackClass" type="Name" use="optional" />
<attribute name="remotable" type="boolean" use="optional" />
- <attribute name="conversational" type="boolean" use="optional" />
<anyAttribute namespace="##any" processContents="lax" />
</extension>
</complexContent>
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=441758&r1=441757&r2=441758
==============================================================================
--- 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 Sep 9 01:12:45 2006
@@ -37,8 +37,10 @@
#include "tuscany/sca/util/Utils.h"
#include "tuscany/sca/util/Exceptions.h"
#include "tuscany/sca/model/Service.h"
+#include "tuscany/sca/model/ServiceType.h"
#include "tuscany/sca/model/Composite.h"
#include "tuscany/sca/model/WSDLDefinition.h"
+#include "tuscany/sca/model/WSDLInterface.h"
#include "tuscany/sca/model/WSDLOperation.h"
using namespace tuscany::sca::ws;
@@ -66,31 +68,7 @@
void Axis2Client::invoke(tuscany::sca::Operation& operation)
{
LOGENTRY(1, "Axis2Client::invoke");
-
- // From the service ws-binding, get the namespace of the wsdl endpoint
- Service* service = compositeReference->getService();
- WSServiceBinding* binding = (WSServiceBinding *)service->getBinding();
-
- string portNamespace = binding->getWSDLNamespaceURL();
-
- // Lookup the wsdl model from the composite, keyed on the namespace
- // (the wsdl will have been loaded at startup)
- Composite* composite=compositeReference->getComposite();
- WSDLDefinition* wsdlDefinition = composite->findWSDLDefinition(portNamespace);
- if (wsdlDefinition == 0)
- {
- string msg = "WSDL not found for " + portNamespace;
- throw SystemConfigurationException(msg.c_str());
- }
-
- const string& operationName = operation.getName();
-
- // Match the operation in Operation to the operation in the wsdl port type.
- const WSDLOperation& wsdlOperation = wsdlDefinition->findOperation(
- binding->getServiceName(),
- binding->getPortName(),
- operationName);
-
+
// Initialize Axis2 stuff
axis2_allocator_t *allocator = axis2_allocator_init (NULL);
axis2_log_t *log = axis2_log_create(allocator, NULL, "tuscany_client.log");
@@ -99,6 +77,93 @@
env->log->level = AXIS2_LOG_LEVEL_TRACE;
axis2_error_init();
+ // Get the WS service binding and WSDLOperation
+ Composite* composite=compositeReference->getComposite();
+ Service* service = compositeReference->getService();
+ WSServiceBinding* binding = (WSServiceBinding *)service->getBinding();
+ const string& operationName = operation.getName();
+ WSDLOperation wsdlOperation;
+
+ // Get the WSDL namespace
+ string wsdlNamespace = binding->getWSDLNamespaceURL();
+ if (wsdlNamespace != "")
+ {
+
+ // Lookup the wsdl model from the composite, keyed on the namespace
+ // (the wsdl will have been loaded at startup)
+ WSDLDefinition* wsdlDefinition = composite->findWSDLDefinition(wsdlNamespace);
+ if (wsdlDefinition == 0)
+ {
+ 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());
+ }
+
+ // Match the operation in Operation to the operation in the wsdl port type.
+ try
+ {
+ wsdlOperation = wsdlDefinition->findOperation(
+ binding->getServiceName(),
+ binding->getPortName(),
+ operationName);
+ }
+ catch(SystemConfigurationException &ex)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "SystemConfigurationException has been caught: %s\n", ex.getMessageText());
+ throw;
+ }
+
+ }
+ else
+ {
+ Interface* iface = service->getType()->getInterface();
+ if (iface != NULL &&
+ iface->getInterfaceTypeQName() == WSDLInterface::typeQName)
+ {
+ WSDLInterface* wsdlInterface = (WSDLInterface*)iface;
+ wsdlNamespace = wsdlInterface->getNamespaceURI();
+
+ if (wsdlNamespace != "")
+ {
+
+ WSDLDefinition* wsdl = composite->findWSDLDefinition(wsdlNamespace);
+ if (wsdl == 0)
+ {
+ 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());
+ }
+
+ try
+ {
+ wsdlOperation = wsdl->findOperation(wsdlInterface->getName(), operationName);
+ }
+ catch(SystemConfigurationException &ex)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "SystemConfigurationException has been caught: %s\n", ex.getMessageText());
+ throw;
+ }
+ }
+ }
+ }
+
+ if (wsdlNamespace == "")
+ {
+
+ // Create a default document literal wrapped WSDL operation
+ wsdlNamespace = compositeReference->getName();
+ wsdlOperation = WSDLOperation();
+ wsdlOperation.setOperationName(operationName);
+ wsdlOperation.setSoapAction(wsdlNamespace+ "#" +operationName);
+ wsdlOperation.setEndpoint("");
+ wsdlOperation.setSoapVersion(WSDLOperation::SOAP11);
+ wsdlOperation.setDocumentStyle(true);
+ wsdlOperation.setWrappedStyle(true);
+ wsdlOperation.setEncoded(false);
+ wsdlOperation.setInputType(wsdlNamespace + "#" + operationName);
+ wsdlOperation.setOutputType(wsdlNamespace + "#" + operationName + "Response");
+ }
+
// Get the target endpoint address
// The URI specified in the binding overrides the address specified in
// the WSDL
Modified: incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service_skeleton.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service_skeleton.cpp?view=diff&rev=441758&r1=441757&r2=441758
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service_skeleton.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service_skeleton.cpp Sat Sep 9 01:12:45 2006
@@ -36,8 +36,12 @@
#include "tuscany/sca/model/Composite.h"
#include "tuscany/sca/model/CompositeService.h"
#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Reference.h"
+#include "tuscany/sca/model/ReferenceType.h"
#include "tuscany/sca/model/WSDLDefinition.h"
#include "tuscany/sca/model/WSDLOperation.h"
+#include "tuscany/sca/model/WSDLInterface.h"
+#include "tuscany/sca/model/Interface.h"
#include "tuscany/sca/core/TuscanyRuntime.h"
#include "tuscany/sca/core/SCARuntime.h"
#include "tuscany/sca/util/Utils.h"
@@ -244,31 +248,93 @@
AXIS2_LOG_INFO((env)->log, "Axis2Service invoke has request OM: %s\n", om_str);
}
- // Get the WS binding
- WSReferenceBinding* binding = (WSReferenceBinding*)compositeService->getReference()->getBinding();
- string portNamespace = binding->getWSDLNamespaceURL();
-
- // Lookup the WSDL model from the composite, keyed on the namespace
- // (the wsdl will have been loaded at startup)
+ // Get the WS binding and the WSDL operation
Composite* composite = compositeService->getComposite();
- WSDLDefinition* wsdlDefinition = composite->findWSDLDefinition(portNamespace);
- if (wsdlDefinition == 0)
+ Reference* reference = compositeService->getReference();
+ WSReferenceBinding* binding = (WSReferenceBinding*)reference->getBinding();
+ WSDLOperation wsdlOperation;
+
+ string wsdlNamespace = binding->getWSDLNamespaceURL();
+ if (wsdlNamespace != "")
{
- string msg = "WSDL not found for " + portNamespace;
- throw SystemConfigurationException(msg.c_str());
+
+ // Lookup the WSDL model from the composite, keyed on the namespace
+ // (the wsdl will have been loaded at startup)
+ WSDLDefinition* wsdlDefinition = composite->findWSDLDefinition(wsdlNamespace);
+ if (wsdlDefinition == 0)
+ {
+ 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());
+ }
+
+ // Find the target operation in the wsdl port type.
+ try {
+ wsdlOperation = wsdlDefinition->findOperation(
+ binding->getServiceName(),
+ binding->getPortName(),
+ op_name);
+ }
+ catch(SystemConfigurationException &ex)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "SystemConfigurationException has been caught: %s\n", ex.getMessageText());
+ throw;
+ }
+
+ }
+ else
+ {
+ Interface* iface = reference->getType()->getInterface();
+ if (iface != NULL &&
+ iface->getInterfaceTypeQName() == WSDLInterface::typeQName)
+ {
+ WSDLInterface* wsdlInterface = (WSDLInterface*)iface;
+ wsdlNamespace = wsdlInterface->getNamespaceURI();
+
+ if (wsdlNamespace != "")
+ {
+
+ WSDLDefinition* wsdl = composite->findWSDLDefinition(wsdlNamespace);
+ if (wsdl == 0)
+ {
+ 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());
+ }
+
+ try
+ {
+ wsdlOperation = wsdl->findOperation(wsdlInterface->getName(), op_name);
+ }
+ catch(SystemConfigurationException &ex)
+ {
+ AXIS2_LOG_ERROR((env)->log, AXIS2_LOG_SI, "SystemConfigurationException has been caught: %s\n", ex.getMessageText());
+ throw;
+ }
+ }
+ }
}
- // Find the target operation in the wsdl port type.
- const WSDLOperation& wsdlOperation = wsdlDefinition->findOperation(
- binding->getServiceName(),
- binding->getPortName(),
- op_name);
-
- // Get the input namespace
- const char* inputNamespace = wsdlOperation.getInputTypeUri().c_str();
+ if (wsdlNamespace == "")
+ {
+
+ // Create a default document literal wrapped WSDL operation
+ wsdlNamespace = compositeService->getName();
+ wsdlOperation = WSDLOperation();
+ wsdlOperation.setOperationName(op_name);
+ wsdlOperation.setSoapAction(wsdlNamespace+ "#" +op_name);
+ wsdlOperation.setEndpoint("");
+ wsdlOperation.setSoapVersion(WSDLOperation::SOAP11);
+ wsdlOperation.setDocumentStyle(true);
+ wsdlOperation.setWrappedStyle(true);
+ wsdlOperation.setEncoded(false);
+ wsdlOperation.setInputType(wsdlNamespace + "#" + op_name);
+ wsdlOperation.setOutputType(wsdlNamespace + "#" + op_name + "Response");
+ }
// Convert the input AXIOM node to an SDO DataObject
- DataObjectPtr inputDataObject = axiomHelper->toSdo(node, dataFactory, inputNamespace);
+ DataObjectPtr inputDataObject = axiomHelper->toSdo(
+ node, dataFactory, wsdlOperation.getInputTypeUri().c_str());
//printf("Axis2ServiceType inputDataObject: (%d)\n", inputDataObject);
@@ -288,7 +354,7 @@
//
WSServiceProxy* proxy = (WSServiceProxy*)binding->getServiceProxy();
- DataObjectPtr outputDataObject = proxy->invoke(op_name, inputDataObject);
+ DataObjectPtr outputDataObject = proxy->invoke(wsdlOperation, inputDataObject);
//std::cout << "Axis2ServiceType outputDataObject:" << outputDataObject;
//Utils::printDO(outputDataObject);
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=441758&r1=441757&r2=441758
==============================================================================
--- 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 Sep 9 01:12:45 2006
@@ -31,6 +31,7 @@
#include "tuscany/sca/model/Composite.h"
#include "tuscany/sca/model/ServiceBinding.h"
#include "tuscany/sca/model/WSDLDefinition.h"
+#include "tuscany/sca/model/WSDLInterface.h"
#include "tuscany/sca/model/WSDLOperation.h"
#include "model/WSReferenceBinding.h"
@@ -73,7 +74,7 @@
///
/// This method will be called to process an operation invocation.
///
- DataObjectPtr WSServiceProxy::invoke(const char* operationName, DataObjectPtr inputDataObject)
+ DataObjectPtr WSServiceProxy::invoke(const WSDLOperation& wsdlOperation, DataObjectPtr inputDataObject)
{
LOGENTRY(1,"WSServiceProxy::invoke");
@@ -84,355 +85,347 @@
WSReferenceBinding* referenceBinding = (WSReferenceBinding*)reference->getBinding();
DataFactoryPtr dataFactoryPtr = reference->getComponent()->getComposite()->getDataFactory();
- DataObjectPtr outputDataObject = NULL;
-
- string wsdlNamespace = referenceBinding->getWSDLNamespaceURL();
- string wsdlPort = referenceBinding->getPortName();
- string wsdlService = referenceBinding->getServiceName();
-
- WSDLDefinition* wsdl = composite->findWSDLDefinition(wsdlNamespace);
- if (wsdl == 0)
- {
- LOGINFO_1(0, "WSDL description %s not found\n", wsdlNamespace.c_str());
- return NULL;
- }
-
- WSDLOperation wsdlOperation;
- try
- {
- wsdlOperation = wsdl->findOperation(wsdlService, wsdlPort, operationName);
- }
- catch(SystemConfigurationException &ex)
- {
- LOGERROR_1(0, "SystemConfigurationException has been caught: %s\n", ex.getMessageText());
- return NULL;
- }
-
- LOGINFO_2(4, "WSServiceSkeleton has got WSDLOperation with inputType: %s#%s",
+ bool documentStyle = wsdlOperation.isDocumentStyle();
+ bool wrappedStyle = wsdlOperation.isWrappedStyle();
+
+ 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",
wsdlOperation.getInputTypeUri().c_str(),
wsdlOperation.getInputTypeName().c_str());
- LOGINFO_2(4, "WSServiceSkeleton has got WSDLOperation with outputType: %s#%s",
- wsdlOperation.getOutputTypeUri().c_str(),
- wsdlOperation.getOutputTypeName().c_str());
- LOGINFO_2(4, "WSServiceSkeleton has got WSDLOperation with documentStyle=%d and encoded=%d",
- wsdlOperation.isDocumentStyle(),
- wsdlOperation.isEncoded());
+ LOGINFO_2(4, "WSServiceProxy has got WSDLOperation with outputType: %s#%s",
+ outputTypeURI,
+ outputTypeName);
+ LOGINFO_2(4, "WSServiceProxy has got WSDLOperation with documentStyle=%d and wrapped=%d",
+ documentStyle,
+ wrappedStyle);
- if(wsdlOperation.isDocumentStyle())
- {
- // Document style
- outputDataObject = dataFactoryPtr->create(wsdlOperation.getOutputTypeUri().c_str(), wsdlOperation.getOutputTypeName().c_str());
-
- //printf("outputDataObject %s#%s\n", outputDataObject->getType().getURI(), outputDataObject->getType().getName());
- //Utils::printDO(outputDataObject);
- }
- else
- {
- // RPC style
- LOGERROR(0, "CompositeServices with RPC style WSDL Operations are not yet supported");
- return NULL;
- }
-
- // Create new Operation object and set parameters and return value
- Operation operation(operationName);
-
- // Go through input data object to set the operation parameters
- PropertyList pl = inputDataObject->getInstanceProperties();
-
- for(int i=0; i<pl.size(); i++)
+ DataObjectPtr outputDataObject;
+
+ if (documentStyle)
{
- const char* name = pl[i].getName();
-
- switch (pl[i].getTypeEnum())
+ if (wrappedStyle)
{
- case Type::BooleanType:
+ outputDataObject = dataFactoryPtr->create(outputTypeURI, outputTypeName);
+
+ // Create new Operation object and set parameters and return value
+ Operation operation(wsdlOperation.getOperationName().c_str());
+
+ // Go through input data object to set the operation parameters
+ PropertyList pl = inputDataObject->getInstanceProperties();
+
+ for(int i=0; i<pl.size(); i++)
{
- bool* boolData = new bool;
- *boolData = inputDataObject->getBoolean(pl[i]);
- //printf("inputDataObject has BooleanType named %s with value %d\n", name, boolData);
- operation.addParameter(boolData);
- }
- break;
- case Type::ByteType:
+ const char* name = pl[i].getName();
+
+ switch (pl[i].getTypeEnum())
+ {
+ case Type::BooleanType:
+ {
+ bool* boolData = new bool;
+ *boolData = inputDataObject->getBoolean(pl[i]);
+ //printf("inputDataObject has BooleanType named %s with value %d\n", name, boolData);
+ operation.addParameter(boolData);
+ }
+ break;
+ case Type::ByteType:
+ {
+ char* byteData = new char;
+ //printf("inputDataObject has ByteType named %s\n", name);
+ *byteData = inputDataObject->getByte(pl[i]);
+ operation.addParameter(byteData);
+ }
+ break;
+ case Type::BytesType:
+ {
+ int len = inputDataObject->getLength(pl[i]);
+ char* bytesData = new char[len+1];
+ int bytesWritten = inputDataObject->getBytes(pl[i], 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("inputDataObject has BytesType named %s with length %d\n", name, bytesWritten);
+ operation.addParameter(&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;
+ //printf("inputDataObject has CharacterType named %s\n", name);
+ *charData = inputDataObject->getCharacter(pl[i]);
+ operation.addParameter(charData);
+ }
+ break;
+ case Type::DoubleType:
+ {
+ long double* doubleData = new long double;
+ *doubleData = inputDataObject->getDouble(pl[i]);
+ //printf("inputDataObject has DoubleType named %s\n", name);
+ operation.addParameter(doubleData);
+ }
+ break;
+ case Type::FloatType:
+ {
+ float* floatData = new float;
+ *floatData = inputDataObject->getFloat(pl[i]);
+ //printf("inputDataObject has FloatType named %s with value %f\n", name, *floatData);
+ operation.addParameter(floatData);
+ }
+ break;
+ case Type::IntegerType:
+ {
+ long* intData = new long;
+ //printf("inputDataObject has IntegerType named %s\n", name);
+ *intData = inputDataObject->getInteger(pl[i]);
+ operation.addParameter(intData);
+ }
+ break;
+ case Type::ShortType:
+ {
+ short* shortData = new short;
+ //printf("inputDataObject has ShortType named %s\n", name);
+ *shortData = inputDataObject->getShort(pl[i]);
+ operation.addParameter(shortData);
+ }
+ break;
+ case Type::StringType:
+ {
+ const char** stringData = new const char*;
+ *stringData = inputDataObject->getCString(pl[i]);
+ //printf("inputDataObject has StringType named %s with value %s\n", name, stringData);
+ operation.addParameter(stringData);
+ }
+ break;
+ case Type::DataObjectType:
+ {
+ DataObjectPtr dataObjectData = inputDataObject->getDataObject(pl[i]);
+ //printf("inputDataObject has DataObjectType named %s (#%d)\n", name, dataObjectData);
+
+ if(!dataObjectData)
+ {
+ LOGINFO_1(4, "SDO DataObject parameter named %s was null", name);
+ }
+ operation.addParameter(&dataObjectData);
+ }
+ break;
+ case Type::OpenDataObjectType:
+ {
+ /*
+ * This code deals with xsd:any element parameters
+ * Get each element as a DataObject and add in to the parameter list
+ */
+
+ //printf("inputDataObject has OpenDataObjectType named %s\n", name);
+ DataObjectList& dataObjectList = inputDataObject->getList(pl[i]);
+
+ for(int j=0; j<dataObjectList.size(); j++)
+ {
+ DataObjectPtr dataObjectData = dataObjectList[j];
+ if(!dataObjectData)
+ {
+ LOGINFO_2(4, "SDO OpenDataObject parameter named %s[%d] was null", name, j);
+ }
+ operation.addParameter(&dataObjectData);
+ //Utils::printDO(dataObjectData);
+ }
+ }
+ break;
+ case Type::DateType:
+ LOGERROR_1(0, "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);
+ return NULL;
+ break;
+ case Type::UriType:
+ LOGERROR_1(0, "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);
+ return NULL;
+ break;
+ case Type::BigIntegerType:
+ LOGERROR_1(0, "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);
+ return NULL;
+ }
+ }
+
+ // Now go through outputDataObject to set the return value
+ pl = outputDataObject->getInstanceProperties();
+
+ // Set up the possible return value pointers
+ bool boolData = 0;
+ char byteData = 0;
+ wchar_t charData = 0;
+ long double doubleData = 0;
+ float floatData = 0;
+ long intData = 0;
+ short shortData = 0;
+ const char* stringData;
+ DataObjectPtr dataObjectData;
+
+
+ // There should only be one return value, but go through any list anyway?
+ if(pl.size() > 1)
{
- char* byteData = new char;
- //printf("inputDataObject has ByteType named %s\n", name);
- *byteData = inputDataObject->getByte(pl[i]);
- operation.addParameter(byteData);
+ LOGINFO(4, "More than one return value is defined in the WSDL, just defining the first");
}
- break;
- case Type::BytesType:
+ else if(pl.size() == 0)
{
- int len = inputDataObject->getLength(pl[i]);
- char* bytesData = new char[len+1];
- int bytesWritten = inputDataObject->getBytes(pl[i], bytesData, len);
- // Ensure the bytes end with the null char. Not sure if this is neccessary
- if(bytesWritten <= len)
+ if(outputDataObject->getType().isOpenType() && outputDataObject->getType().isDataObjectType())
{
- bytesData[bytesWritten] = 0;
+ /*
+ * This code deals with returning xsd:any elements
+ * Return as a DataObject set within the outputDataObject
+ */
+
+ // An OpenDataObject for the data to return in
+ operation.setReturnValue(&dataObjectData);
}
else
{
- bytesData[len] = 0;
+ LOGINFO(4, "No return values are defined in the WSDL");
}
- //printf("inputDataObject has BytesType named %s with length %d\n", name, bytesWritten);
- operation.addParameter(&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;
- //printf("inputDataObject has CharacterType named %s\n", name);
- *charData = inputDataObject->getCharacter(pl[i]);
- operation.addParameter(charData);
- }
- break;
- case Type::DoubleType:
- {
- long double* doubleData = new long double;
- *doubleData = inputDataObject->getDouble(pl[i]);
- //printf("inputDataObject has DoubleType named %s\n", name);
- operation.addParameter(doubleData);
- }
- break;
- case Type::FloatType:
- {
- float* floatData = new float;
- *floatData = inputDataObject->getFloat(pl[i]);
- //printf("inputDataObject has FloatType named %s with value %f\n", name, *floatData);
- operation.addParameter(floatData);
- }
- break;
- case Type::IntegerType:
- {
- long* intData = new long;
- //printf("inputDataObject has IntegerType named %s\n", name);
- *intData = inputDataObject->getInteger(pl[i]);
- operation.addParameter(intData);
- }
- break;
- case Type::ShortType:
- {
- short* shortData = new short;
- //printf("inputDataObject has ShortType named %s\n", name);
- *shortData = inputDataObject->getShort(pl[i]);
- operation.addParameter(shortData);
- }
- break;
- case Type::StringType:
- {
- const char** stringData = new const char*;
- *stringData = inputDataObject->getCString(pl[i]);
- //printf("inputDataObject has StringType named %s with value %s\n", name, stringData);
- operation.addParameter(stringData);
+
}
- break;
- case Type::DataObjectType:
+
+ if(pl.size() > 0)
{
- DataObjectPtr dataObjectData = inputDataObject->getDataObject(pl[i]);
- //printf("inputDataObject has DataObjectType named %s (#%d)\n", name, dataObjectData);
-
- if(!dataObjectData)
- {
- LOGINFO_1(4, "SDO DataObject parameter named %s was null", name);
- }
- operation.addParameter(&dataObjectData);
- }
- break;
- case Type::OpenDataObjectType:
- {
- /*
- * This code deals with xsd:any element parameters
- * Get each element as a DataObject and add in to the parameter list
- */
-
- //printf("inputDataObject has OpenDataObjectType named %s\n", name);
- DataObjectList& dataObjectList = inputDataObject->getList(pl[i]);
+ const char* name = pl[0].getName();
- for(int j=0; j<dataObjectList.size(); j++)
+ switch (pl[0].getTypeEnum())
{
- DataObjectPtr dataObjectData = dataObjectList[j];
- if(!dataObjectData)
+ case Type::BooleanType:
{
- LOGINFO_2(4, "SDO OpenDataObject parameter named %s[%d] was null", name, j);
+ //printf("outputDataObject has BooleanType named %s\n", name);
+ operation.setReturnValue(&boolData);
}
- operation.addParameter(&dataObjectData);
- //Utils::printDO(dataObjectData);
- }
+ break;
+ case Type::ByteType:
+ {
+ //printf("outputDataObject has ByteType named %s\n", name);
+ operation.setReturnValue(&byteData);
+ }
+ break;
+ case Type::CharacterType:
+ {
+ //printf("outputDataObject has CharacterType named %s\n", name);
+ operation.setReturnValue(&charData);
+ }
+ break;
+ case Type::DoubleType:
+ {
+ //printf("outputDataObject has DoubleType named %s\n", name);
+ operation.setReturnValue((long double*) &doubleData);
+ }
+ break;
+ case Type::FloatType:
+ {
+ //printf("outputDataObject has FloatType named %s\n", name);
+ operation.setReturnValue(&floatData);
+ }
+ break;
+ case Type::IntegerType:
+ {
+ //printf("outputDataObject has IntegerType named %s\n", name);
+ operation.setReturnValue(&intData);
+ }
+ break;
+ case Type::ShortType:
+ {
+ //printf("outputDataObject has ShortType named %s\n", name);
+ operation.setReturnValue(&shortData);
+ }
+ break;
+ case Type::StringType:
+ case Type::BytesType:
+ {
+ //printf("outputDataObject has StringType or BytesType named %s\n", name);
+ operation.setReturnValue((const char**) &stringData);
+ }
+ break;
+ case Type::DataObjectType:
+ {
+ // printf("outputDataObject has DataObjectType named %s with type %s # %s\n", name, pl[0].getType().getURI(), pl[0].getType().getName());
+ operation.setReturnValue(&dataObjectData);
+ }
+ break;
+ case Type::DateType:
+ LOGERROR_1(0, "SDO DateType return values are not yet supported (%s)", name);
+ return NULL;
+ case Type::LongType:
+ LOGERROR_1(0, "SDO LongType (int64_t) return values are not yet supported (%s)", name);
+ return NULL;
+ case Type::UriType:
+ LOGERROR_1(0, "SDO UriType return values are not yet supported (%s)", name);
+ return NULL;
+ case Type::BigDecimalType:
+ LOGERROR_1(0, "SDO BigDecimalType return values are not yet supported (%s)", name);
+ return NULL;
+ case Type::BigIntegerType:
+ LOGERROR_1(0, "SDO BigIntegerType return values are not yet supported (%s)", name);
+ return NULL;
+ default:
+ LOGERROR_1(0, "Unknown SDO type return value named %s has been found. Unknown types are not yet supported", name);
+ return NULL;
+ }
}
- break;
- case Type::DateType:
- LOGERROR_1(0, "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);
- return NULL;
- break;
- case Type::UriType:
- LOGERROR_1(0, "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);
- return NULL;
- break;
- case Type::BigIntegerType:
- LOGERROR_1(0, "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);
- return NULL;
- }
- }
-
- // Now go through outputDataObject to set the return value
- pl = outputDataObject->getInstanceProperties();
-
- // Set up the possible return value pointers
- bool boolData = 0;
- char byteData = 0;
- wchar_t charData = 0;
- long double doubleData = 0;
- float floatData = 0;
- long intData = 0;
- short shortData = 0;
- const char* stringData;
- DataObjectPtr dataObjectData;
-
+
+ try
+ {
+ // Call into the target service wrapper
+ serviceWrapper->invoke(operation);
+
+ // Set the data in the outputDataObject to be returned
+ setOutputData(operation, outputDataObject);
- // There should only be one return value, but go through any list anyway?
- if(pl.size() > 1)
- {
- LOGINFO(4, "More than one return value is defined in the WSDL, just defining the first");
- }
- else if(pl.size() == 0)
- {
- if(outputDataObject->getType().isOpenType() && outputDataObject->getType().isDataObjectType())
- {
- /*
- * This code deals with returning xsd:any elements
- * Return as a DataObject set within the outputDataObject
- */
-
- // An OpenDataObject for the data to return in
- operation.setReturnValue(&dataObjectData);
+ //printf("outputDataObject %s#%s\n", outputDataObject->getType().getURI(), outputDataObject->getType().getName());
+ //Utils::printDO(outputDataObject);
+
+ LOGEXIT(1,"WSServiceProxy::invoke");
+
+ return outputDataObject;
+
+ }
+ 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());
+ return NULL;
+ }
+ 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());
+ return NULL;
+ }
}
else
{
- LOGINFO(4, "No return values are defined in the WSDL");
- }
-
- }
-
- if(pl.size() > 0)
- {
- const char* name = pl[0].getName();
-
- switch (pl[0].getTypeEnum())
- {
- case Type::BooleanType:
- {
- //printf("outputDataObject has BooleanType named %s\n", name);
- operation.setReturnValue(&boolData);
- }
- break;
- case Type::ByteType:
- {
- //printf("outputDataObject has ByteType named %s\n", name);
- operation.setReturnValue(&byteData);
- }
- break;
- case Type::CharacterType:
- {
- //printf("outputDataObject has CharacterType named %s\n", name);
- operation.setReturnValue(&charData);
- }
- break;
- case Type::DoubleType:
- {
- //printf("outputDataObject has DoubleType named %s\n", name);
- operation.setReturnValue((long double*) &doubleData);
- }
- break;
- case Type::FloatType:
- {
- //printf("outputDataObject has FloatType named %s\n", name);
- operation.setReturnValue(&floatData);
- }
- break;
- case Type::IntegerType:
- {
- //printf("outputDataObject has IntegerType named %s\n", name);
- operation.setReturnValue(&intData);
- }
- break;
- case Type::ShortType:
- {
- //printf("outputDataObject has ShortType named %s\n", name);
- operation.setReturnValue(&shortData);
- }
- break;
- case Type::StringType:
- case Type::BytesType:
- {
- //printf("outputDataObject has StringType or BytesType named %s\n", name);
- operation.setReturnValue((const char**) &stringData);
- }
- break;
- case Type::DataObjectType:
- {
- // printf("outputDataObject has DataObjectType named %s with type %s # %s\n", name, pl[0].getType().getURI(), pl[0].getType().getName());
- operation.setReturnValue(&dataObjectData);
- }
- break;
- case Type::DateType:
- LOGERROR_1(0, "SDO DateType return values are not yet supported (%s)", name);
- return NULL;
- case Type::LongType:
- LOGERROR_1(0, "SDO LongType (int64_t) return values are not yet supported (%s)", name);
- return NULL;
- case Type::UriType:
- LOGERROR_1(0, "SDO UriType return values are not yet supported (%s)", name);
- return NULL;
- case Type::BigDecimalType:
- LOGERROR_1(0, "SDO BigDecimalType return values are not yet supported (%s)", name);
+ LOGERROR(0, "CompositeServices with non-wrapped document style WSDL Operations are not yet supported");
+ LOGEXIT(1,"WSServiceProxy::invoke");
return NULL;
- case Type::BigIntegerType:
- LOGERROR_1(0, "SDO BigIntegerType return values are not yet supported (%s)", name);
- return NULL;
- default:
- LOGERROR_1(0, "Unknown SDO type return value named %s has been found. Unknown types are not yet supported", name);
- return NULL;
- }
+ }
}
-
- try
+ else
{
- // Call into the target service wrapper
- serviceWrapper->invoke(operation);
-
- // Set the data in the outputDataObject to be returned
- setOutputData(operation, outputDataObject);
- }
- 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());
- return NULL;
- }
- 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());
+ // RPC style
+ LOGERROR(0, "CompositeServices with RPC style WSDL Operations are not yet supported");
return NULL;
- }
-
- LOGEXIT(1,"WSServiceSkeleton::invoke");
-
- return outputDataObject;
-
+ }
}
Modified: incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.h?view=diff&rev=441758&r1=441757&r2=441758
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.h (original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.h Sat Sep 9 01:12:45 2006
@@ -25,6 +25,7 @@
#include "tuscany/sca/model/Component.h"
#include "tuscany/sca/model/Reference.h"
#include "tuscany/sca/model/Service.h"
+#include "tuscany/sca/model/WSDLOperation.h"
#include "model/WSReferenceBinding.h"
#include "commonj/sdo/SDO.h"
@@ -72,7 +73,7 @@
/**
* Invoke the specified operation
*/
- DataObjectPtr invoke(const char* operationName, DataObjectPtr inputDataObject);
+ DataObjectPtr invoke(const WSDLOperation& wsdlOperation, DataObjectPtr inputDataObject);
private:
Modified: incubator/tuscany/cpp/sca/samples/BigBank/bigbank.account/bigbank.account.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/BigBank/bigbank.account/bigbank.account.composite?view=diff&rev=441758&r1=441757&r2=441758
==============================================================================
--- incubator/tuscany/cpp/sca/samples/BigBank/bigbank.account/bigbank.account.composite (original)
+++ incubator/tuscany/cpp/sca/samples/BigBank/bigbank.account/bigbank.account.composite Sat Sep 9 01:12:45 2006
@@ -18,8 +18,10 @@
name="bigbank.account">
<service name="AccountService">
- <interface.wsdl interface="http://www.bigbank.com/AccountService#wsdl.interface(AccountService)"/>
- <binding.ws port="http://www.bigbank.com/AccountService#wsdl.endpoint(AccountService/AccountServiceSOAP)"/>
+ <interface.wsdl interface="http://www.bigbank.com/AccountService#wsdl.interface(AccountService)"/>
+ <!-- The port is optional -->
+ <!-- <binding.ws port="http://www.bigbank.com/AccountService#wsdl.endpoint(AccountService/AccountServiceSOAP)"/> -->
+ <binding.ws/>
<reference>AccountServiceComponent</reference>
</service>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org