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/07 04:43:16 UTC

svn commit: r440951 - in /incubator/tuscany/cpp: sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service_skeleton.cpp sdo/runtime/core/sdo_axiom/sdo_axiom.cpp sdo/runtime/core/sdo_axiom/sdo_axiom.h

Author: jsdelfino
Date: Wed Sep  6 19:43:15 2006
New Revision: 440951

URL: http://svn.apache.org/viewvc?view=rev&rev=440951
Log:
Initial server-side REST support with Axis2 0.93, added an optional namespace parameter to sdo_axiom to match the capabilities of XMLHelper and allow our Axis2 skeleton to specify the namespace of the input which is not specified by the client, and minor changes to the Axis2 skeleton to find the input namespace and pass it to the sdo_axiom helper

Modified:
    incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/Axis2Service_skeleton.cpp
    incubator/tuscany/cpp/sdo/runtime/core/sdo_axiom/sdo_axiom.cpp
    incubator/tuscany/cpp/sdo/runtime/core/sdo_axiom/sdo_axiom.h

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=440951&r1=440950&r2=440951
==============================================================================
--- 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 Wed Sep  6 19:43:15 2006
@@ -36,6 +36,8 @@
 #include "tuscany/sca/model/Composite.h"
 #include "tuscany/sca/model/CompositeService.h"
 #include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/WSDLDefinition.h"
+#include "tuscany/sca/model/WSDLOperation.h"
 #include "tuscany/sca/core/TuscanyRuntime.h"
 #include "tuscany/sca/core/SCARuntime.h"
 #include "tuscany/sca/util/Utils.h"
@@ -242,7 +244,31 @@
                         AXIS2_LOG_INFO((env)->log, "Axis2Service invoke has request OM: %s\n", om_str);
                     }
 
-                    DataObjectPtr inputDataObject = axiomHelper->toSdo(node, dataFactory);
+                    // 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)
+                    Composite* composite = compositeService->getComposite();
+                    WSDLDefinition* wsdlDefinition = composite->findWSDLDefinition(portNamespace);
+                    if (wsdlDefinition == 0)
+                    {
+                        string msg = "WSDL not found for " + portNamespace;
+                        throw SystemConfigurationException(msg.c_str());
+                    }
+                    
+                    // 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();
+
+                    // Convert the input AXIOM node to an SDO DataObject
+                    DataObjectPtr inputDataObject = axiomHelper->toSdo(node, dataFactory, inputNamespace);
 
                     //printf("Axis2ServiceType inputDataObject: (%d)\n", inputDataObject);
 
@@ -261,8 +287,7 @@
                     //  Dispatch to the WS proxy
                     //
                     
-                    WSReferenceBinding* referenceBinding = (WSReferenceBinding*)compositeService->getReference()->getBinding();
-                    WSServiceProxy* proxy = (WSServiceProxy*)referenceBinding->getServiceProxy();
+                    WSServiceProxy* proxy = (WSServiceProxy*)binding->getServiceProxy();
                     DataObjectPtr outputDataObject = proxy->invoke(op_name, inputDataObject);
 
                     //std::cout << "Axis2ServiceType outputDataObject:" << outputDataObject;

Modified: incubator/tuscany/cpp/sdo/runtime/core/sdo_axiom/sdo_axiom.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/sdo_axiom/sdo_axiom.cpp?view=diff&rev=440951&r1=440950&r2=440951
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/sdo_axiom/sdo_axiom.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/sdo_axiom/sdo_axiom.cpp Wed Sep  6 19:43:15 2006
@@ -169,7 +169,8 @@
         }
 
         DataObjectPtr AxiomHelper::toSdo(axiom_document_t* document,
-            DataFactoryPtr factory)
+            DataFactoryPtr factory,
+            const char* targetNamespaceURI)
         {
         
             if (!the_env)
@@ -181,11 +182,12 @@
             axiom_node_t* root_node = 
                 AXIOM_DOCUMENT_GET_ROOT_ELEMENT(document, the_env);
 
-            return toSdo(root_node,factory);
+            return toSdo(root_node,factory, targetNamespaceURI);
         }
  
         DataObjectPtr AxiomHelper::toSdo(axiom_node_t* root_node,
-                                DataFactoryPtr factory)
+                                DataFactoryPtr factory,
+                                const char* targetNamespaceURI)
         {
         
             if (!the_env)
@@ -214,7 +216,7 @@
     
             axis2_char_t* buffer = (axis2_char_t*)AXIOM_XML_WRITER_GET_XML(writer, the_env);
 
-            XMLDocumentPtr theXMLDocument = helper->load(buffer);
+            XMLDocumentPtr theXMLDocument = helper->load(buffer, targetNamespaceURI);
 
             if (theXMLDocument != 0)
             {

Modified: incubator/tuscany/cpp/sdo/runtime/core/sdo_axiom/sdo_axiom.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/sdo_axiom/sdo_axiom.h?view=diff&rev=440951&r1=440950&r2=440951
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/sdo_axiom/sdo_axiom.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/sdo_axiom/sdo_axiom.h Wed Sep  6 19:43:15 2006
@@ -56,8 +56,8 @@
             SDO_AXIOM_API axiom_document_t*  toAxiomDoc(DataObjectPtr dob);
             SDO_AXIOM_API axiom_node_t*      toAxiomNode(DataObjectPtr dob);
 
-            SDO_AXIOM_API DataObjectPtr  toSdo(axiom_document_t* doc,DataFactoryPtr factory);
-            SDO_AXIOM_API DataObjectPtr  toSdo(axiom_node_t* root_node,DataFactoryPtr factory);
+            SDO_AXIOM_API DataObjectPtr  toSdo(axiom_document_t* doc, DataFactoryPtr factory, const char* targetNamespaceURI=0);
+            SDO_AXIOM_API DataObjectPtr  toSdo(axiom_node_t* root_node, DataFactoryPtr factory, const char* targetNamespaceURI=0);
 
             SDO_AXIOM_API axis2_env_t* getEnv();
 



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