You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ro...@apache.org on 2006/05/05 16:04:59 UTC

svn commit: r400081 - in /incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model: ModelLoader.cpp ModelLoader.h Wsdl.cpp WsdlOperation.cpp WsdlOperation.h

Author: robbinspg
Date: Fri May  5 07:04:57 2006
New Revision: 400081

URL: http://svn.apache.org/viewcvs?rev=400081&view=rev
Log:
TUSCANY-89 Add input/ouput messages to wsdl operation

Modified:
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.h
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wsdl.cpp
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.cpp
    incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.h

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.cpp?rev=400081&r1=400080&r2=400081&view=diff
==============================================================================
--- 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 Fri May  5 07:04:57 2006
@@ -26,6 +26,7 @@
 #include "tuscany/sca/model/CPPInterface.h"
 #include "tuscany/sca/core/SCARuntime.h"
 #include "tuscany/sca/model/WSBinding.h"
+#include "commonj/sdo/TypeDefinitions.h"
 
 
 using namespace commonj::sdo;
@@ -669,6 +670,7 @@
 
                     if (doc->getRootDataObject()!=0) 
                     {
+                        Utils::printDO(doc->getRootDataObject());
                         MODULE_LIST moduleList = system->findModules(moduleName);
                         MODULE_LIST::iterator moduleIter;
                         
@@ -722,11 +724,10 @@
                         // Tuscany specific xsd for config files
                         filename = root + "/xsd/tuscany.xsd";
                         myXSDHelper->defineFile(filename.c_str());
+                     
+                        loadWSDLTypes(myXSDHelper);
  
-                        // Load types derived from WSDL schema
-                        loadWSDLTypes(myXSDHelper->getDataFactory());
- 
-                        //Utils::printTypes(myXSDHelper->getDataFactory());
+                        Utils::printTypes(myXSDHelper->getDataFactory());
                         
                     } catch (SDOTypeNotFoundException ex)
                     {
@@ -755,8 +756,10 @@
                 return myXMLHelper;
             }
             
-            void ModelLoader::loadWSDLTypes(DataFactoryPtr dataFactory)
+            void ModelLoader::loadWSDLTypes(XSDHelperPtr xsdHelper)
             {
+                DataFactoryPtr dataFactory = xsdHelper->getDataFactory();
+ 
                 dataFactory->addType(
                     "http://schemas.xmlsoap.org/wsdl/", "RootType",
                     false, false, false);
@@ -805,9 +808,35 @@
                 dataFactory->addType(
                     "http://schemas.xmlsoap.org/wsdl/", "tParam",
                     false, false, false);
-                dataFactory->addType(
+
+
+                TypeDefinition tpart;
+                tpart.setUri("http://schemas.xmlsoap.org/wsdl/");
+                tpart.setName("tPart");
+                tpart.setParentType("http://schemas.xmlsoap.org/wsdl/",
+                                    "tExtensibleAttributesDocumented", false);
+                PropertyDefinition propdef;
+                propdef.setName("name");
+                propdef.setLocalName("name");
+                propdef.setType("commonj.sdo", "String");
+                propdef.setIsContainment(true);
+                tpart.addPropertyDefinition(propdef);
+                propdef.setName("element");
+                propdef.setLocalName("element");
+                propdef.setIsQName(true);
+                tpart.addPropertyDefinition(propdef);
+                propdef.setName("type");
+                propdef.setLocalName("type");
+                tpart.addPropertyDefinition(propdef);
+                TypeDefinitions typedefs;
+                typedefs.addTypeDefinition(tpart);
+                xsdHelper->defineTypes(typedefs);
+
+                //Utils::printTypes(dataFactory);
+                /*dataFactory->addType(
                     "http://schemas.xmlsoap.org/wsdl/", "tPart",
-                    false, false, false);
+                    false, false, false);*/
+
                 dataFactory->addType(
                     "http://schemas.xmlsoap.org/wsdl/", "tPort",
                     false, false, false);
@@ -1091,21 +1120,21 @@
                 dataFactory->setBaseType(
                     "http://schemas.xmlsoap.org/wsdl/", "tPart",
                     "http://schemas.xmlsoap.org/wsdl/", "tExtensibleAttributesDocumented");
-                dataFactory->addPropertyToType(
+                /*dataFactory->addPropertyToType(
                     "http://schemas.xmlsoap.org/wsdl/", "tPart",
                     "name",
                     "commonj.sdo", "String",
                     false, false, true);
-                dataFactory->addPropertyToType(
+                  dataFactory->addPropertyToType(
                     "http://schemas.xmlsoap.org/wsdl/", "tPart",
                     "element",
                     "commonj.sdo", "URI",
-                    false, false, true);
+                    false, false, true); 
                 dataFactory->addPropertyToType(
                     "http://schemas.xmlsoap.org/wsdl/", "tPart",
                     "type",
                     "commonj.sdo", "URI",
-                    false, false, true);
+                    false, false, true);*/
                 dataFactory->setBaseType(
                     "http://schemas.xmlsoap.org/wsdl/", "tPort",
                     "http://schemas.xmlsoap.org/wsdl/", "tExtensibleDocumented");
@@ -1547,6 +1576,7 @@
                     "name",
                     "commonj.sdo", "String",
                     false, false, true);
+                
             }
             
             

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.h?rev=400081&r1=400080&r2=400081&view=diff
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/ModelLoader.h Fri May  5 07:04:57 2006
@@ -24,6 +24,7 @@
 #include "commonj/sdo/SDO.h"
 using commonj::sdo::DataObjectPtr;
 using commonj::sdo::DataFactoryPtr;
+using commonj::sdo::XSDHelperPtr;
 
 #include "tuscany/sca/model/System.h"
 #include "tuscany/sca/model/Subsystem.h"
@@ -90,7 +91,7 @@
                 void loadTypes(const char *fileName, const string &moduleName);
                 void loadWsdl(const char *fileName, const string &moduleName);
 
-                void loadWSDLTypes(DataFactoryPtr dataFactory);
+                void loadWSDLTypes(XSDHelperPtr xsdHelper);
     
                 Interface* getInterface(DataObjectPtr obj);
 

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wsdl.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wsdl.cpp?rev=400081&r1=400080&r2=400081&view=diff
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wsdl.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/Wsdl.cpp Fri May  5 07:04:57 2006
@@ -41,7 +41,7 @@
                 LOGENTRY(1, "Wsdl::constructor");
 
                 // Trace
-                Utils::printDO(wsdlModel);
+                //Utils::printDO(wsdlModel);
 
 
                 
@@ -124,7 +124,7 @@
                                 throw SystemConfigurationException(message.c_str());
                             }
 
-                            Utils::printDO(wsPortType);
+                            //Utils::printDO(wsPortType);
                             
                             // Found the portType, find the operation
                             DataObjectList& operationList = wsPortType->getList("operation");
@@ -150,8 +150,9 @@
                                     string requestType(wsMessageIn->getList("part")[0]->getCString("element"));
                                     string requestTypeName;
                                     string requestTypeUri;
-                                    // Utils::tokeniseQName(requestType, requestTypeUri, requestTypeName); 
-                                    Utils::rTokeniseString(":", requestType, requestTypeUri, requestTypeName); 
+                                     Utils::tokeniseQName(requestType, requestTypeUri, requestTypeName); 
+                                    //Utils::rTokeniseString(":", requestType, requestTypeUri, requestTypeName); 
+                                    cout << "inputMessage:" <<requestTypeUri<<"#"<< requestTypeName<<endl;
 
                                     // Find the type of the response message
                                     string outputMessageType =  string(operationList[k]->getCString("output/message"));
@@ -168,13 +169,15 @@
                                     string responseType(wsMessageOut->getList("part")[0]->getCString("element"));
                                     string responseTypeName;
                                     string responseTypeUri;
-                                    // Utils::tokeniseQName(responseType, responseTypeUri, responseTypeName); 
-                                    Utils::rTokeniseString(":", responseType, responseTypeUri, responseTypeName);
+                                    Utils::tokeniseQName(responseType, responseTypeUri, responseTypeName); 
+                                    //Utils::rTokeniseString(":", responseType, responseTypeUri, responseTypeName);
+                                   cout << "ouputMessage:" <<responseTypeUri<<"#"<< responseTypeName<<endl;
 
                                     return WsdlOperation(requestTypeName, 
                                         soapAction, 
-                                        targetAddress, 
-                                        responseTypeName);
+                                        targetAddress,
+                                        wsMessageIn,
+                                        wsMessageOut);
                                 }
                                 
                             }

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.cpp?rev=400081&r1=400080&r2=400081&view=diff
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.cpp Fri May  5 07:04:57 2006
@@ -30,25 +30,34 @@
             
             
             // Constructor
-            WsdlOperation::WsdlOperation(const string& operation, 
+            WsdlOperation::WsdlOperation(
+                const string& operationNam, 
                 const string& soapAct, 
                 const string& endpointAddress,
-                const string& response) 
-                : operationName(operation), 
-                responseName(response), 
+                DataObjectPtr inMsg,
+                DataObjectPtr outMsg) 
+                :
+                operationName(operationNam),
                 soapAction(soapAct),  
-                endpoint(endpointAddress)
+                endpoint(endpointAddress),
+                inputMessage(inMsg),
+                outputMessage(outMsg)
             {
-                LOGENTRY(1, "WsdlOperation::constructor");
-
-
-
-                
+                LOGENTRY(1, "WsdlOperation::constructor");                
                 LOGEXIT(1, "WsdlOperation::constructor");
             }
 
             WsdlOperation::~WsdlOperation()
             {
+            }
+
+            string WsdlOperation::getResponseName()
+            {
+                string responseType(outputMessage->getList("part")[0]->getCString("element"));
+                string responseTypeName;
+                string responseTypeUri;
+                Utils::tokeniseQName(responseType, responseTypeUri, responseTypeName); 
+                return responseTypeName; 
             }
 
             

Modified: incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.h?rev=400081&r1=400080&r2=400081&view=diff
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.h (original)
+++ incubator/tuscany/cpp/sca/runtime/core/src/tuscany/sca/model/WsdlOperation.h Fri May  5 07:04:57 2006
@@ -47,10 +47,12 @@
                  * @param endpoint The endpoint address of the operation.
                  * @param responseName The name of the response message.
                  */
-                 WsdlOperation(const string& operation,
+                 WsdlOperation(
+                    const string& operationName,
                     const string& soapAction, 
                     const string& endpoint,
-                    const string& responseName);
+                    DataObjectPtr inputMessage,
+                    DataObjectPtr outputMessage);
 
                 /**
                  * Destructor.
@@ -69,7 +71,7 @@
                  * incoming message.
                  * @return The name of the element in the response message.
                  */
-                const string& getResponseName() {return responseName;};
+                string getResponseName();
 
                 /**
                  * The soap action string for this operation.
@@ -83,6 +85,8 @@
                  */
                 const string& getEndpoint() {return endpoint;};
 
+                DataObjectPtr getInputMessage() {return inputMessage;}
+                DataObjectPtr getOutputMessage() {return outputMessage;}
 
                 
             private:
@@ -92,13 +96,7 @@
                  */ 
                 string operationName;
 
-                /**
-                 * The name of the response for use when deserializing an
-                 * incoming message.
-                 */
-                string responseName;
-
-                /**
+                 /**
                  * The soap action string for this operation.
                  */
                 string soapAction;
@@ -107,6 +105,9 @@
                  * The endpoint address of the target web service.
                  */
                 string endpoint;
+
+                DataObjectPtr inputMessage;
+                DataObjectPtr outputMessage;
             };
 
          } // End namespace model