Author: jsdelfino
Date: Tue Sep 12 03:06:30 2006
New Revision: 442549

URL: http://svn.apache.org/viewvc?view=rev&rev=442549
Log:
Changed WSServiceProxy to use the actual type of the data returned by a service 
invocation, instead of the type specified in the WSDL. This will allow a 
service to return a long for example and let SDO convert it to an int if the 
WSDL/XSD specified an int.

Modified:
    
incubator/tuscany/cpp/sca/runtime/extensions/ws/service/axis2c/src/tuscany/sca/ws/WSServiceProxy.cpp
    
incubator/tuscany/cpp/sca/samples/Calculator/sample.calculator/sample.calculator.composite
    
incubator/tuscany/cpp/sca/samples/PythonCalculator/sample.calculator/sample.calculator.composite
    
incubator/tuscany/cpp/sca/samples/RubyCalculator/sample.calculator/sample.calculator.composite

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=442549&r1=442548&r2=442549
==============================================================================
--- 
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
 Tue Sep 12 03:06:30 2006
@@ -471,103 +471,72 @@
                 for(int i=0; i<pl.size(); i++)
                 {
                     const char* name = pl[i].getName();
-            
-                    switch (pl[i].getTypeEnum()) 
+
+                    Operation::ParameterType resultType = 
operation.getReturnType();
+                    switch(resultType)
                     {
-                    case Type::BooleanType:
+                    case Operation::BOOL: 
                         {
-                            bool* boolData = (bool*)operation.getReturnValue();
-                            //printf("outputDataObject has BooleanType named 
%s with value %d\n", name, *boolData);
-                            outputDataObject->setBoolean(pl[i], *boolData); 
-                        }
-                        break;
-                    case Type::ByteType:
-                        {
-                            char* byteData = (char*) 
operation.getReturnValue();
-                            //printf("outputDataObject has ByteType named %s 
with value %c (#%d)\n", name, *byteData, *byteData);
-                            outputDataObject->setByte(pl[i], *byteData);
-                        }
-                        break;
-                    case Type::BytesType:
-                        {
-                            const char** bytesData = (const char**) 
operation.getReturnValue();
-                            // TODO This looks for the first NULL byte - this 
may not be the full length of the data...
-                            int len = 0;
-                            while((*bytesData)[len] != 0)
-                            {
-                                len++;
-                            }
-                            //printf("outputDataObject has BytesType named %s 
with value %s and length %d\n", name, *bytesData, len);
-                            outputDataObject->setBytes(pl[i], *bytesData, len);
-                        }
-                        break;
-                    case Type::CharacterType:
-                        {
-                            wchar_t* charData = (wchar_t*) 
operation.getReturnValue();
-                            //printf("outputDataObject has CharacterType named 
%s with value %s\n", name, charData);
-                            outputDataObject->setCharacter(pl[i], *charData);
-                        }
-                        break;
-                    case Type::DoubleType:
-                        {
-                            long double* doubleData = (long double*) 
operation.getReturnValue();
-                            //printf("outputDataObject has DoubleType named %s 
with value %f\n", name, *doubleData);
-                            outputDataObject->setDouble(pl[i], *doubleData);
-                        }
-                        break;
-                    case Type::FloatType:
-                        {
-                            float* floatData = (float*) 
operation.getReturnValue();
-                            //printf("outputDataObject has FloatType named %s 
with value %f \n", name, *floatData);
-                            outputDataObject->setFloat(pl[i], *floatData);
-                        }
-                        break;
-                    case Type::IntegerType:
-                        {
-                            long* intData = (long*) operation.getReturnValue();
-                            //printf("outputDataObject has IntegerType named 
%s with value %d\n", name, *intData);
-                            outputDataObject->setInteger(pl[i], *intData);
-                        }
-                        break;
-                    case Type::ShortType:
-                        {
-                            short* shortData = (short*) 
operation.getReturnValue();
-                            //printf("outputDataObject has ShortType named %s  
with value %d\n", name, *shortData);
-                            outputDataObject->setShort(pl[i], *shortData);
-                        }
-                        break;
-                    case Type::StringType:
-                        {
-                            const char** stringData = (const char**) 
operation.getReturnValue();
-                            //printf("outputDataObject has StringType named %s 
with value %s\n", name, *stringData);
-                            outputDataObject->setCString(pl[i], *stringData);
-                        }
-                        break;
-                    case Type::DataObjectType:
-                        {
-                            DataObjectPtr* dataObjectData = (DataObjectPtr*) 
operation.getReturnValue();
-                            //printf("outputDataObject has DataObjectType 
named %s with value (%d)\n", name, (*dataObjectData));
-                            outputDataObject->setDataObject(pl[i], 
*dataObjectData);
-                        }
-                        break;
-                    case Type::DateType:
-                        LOGERROR_1(0, "SDO DateType return values are not yet 
supported (%s)", name);
-                        break;
-                    case Type::LongType:
-                        LOGERROR_1(0, "SDO LongType (int64_t) return values 
are not yet supported (%s)", name);
-                        break;
-                    case Type::UriType:
-                        LOGERROR_1(0, "SDO UriType return values are not yet 
supported (%s)", name);
-                        break;
-                    case Type::BigDecimalType:
-                        LOGERROR_1(0, "SDO BigDecimalType return values are 
not yet supported (%s)", name);
-                        break;
-                    case Type::BigIntegerType:
-                        LOGERROR_1(0, "SDO BigIntegerType return values are 
not yet supported (%s)", name);
-                        break;
+                            outputDataObject->setBoolean(pl[i], 
*(bool*)operation.getReturnValue());
+                            break;
+                        }
+                    case Operation::SHORT: 
+                        {
+                            outputDataObject->setShort(pl[i], 
*(short*)operation.getReturnValue());
+                            break;
+                        }
+                    case Operation::LONG: 
+                        {
+                            outputDataObject->setLong(pl[i], 
*(long*)operation.getReturnValue());
+                            break;
+                        }
+                    case Operation::USHORT: 
+                        {
+                            outputDataObject->setInteger(pl[i], *(unsigned 
short*)operation.getReturnValue());
+                            break;
+                        }
+                    case Operation::ULONG: 
+                        {
+                            outputDataObject->setInteger(pl[i], *(unsigned 
long*)operation.getReturnValue());
+                            break;
+                        }
+                    case Operation::FLOAT: 
+                        {
+                            outputDataObject->setFloat(pl[i], 
*(float*)operation.getReturnValue());
+                            break;
+                        }
+                    case Operation::DOUBLE: 
+                        {
+                            outputDataObject->setDouble(pl[i], 
*(double*)operation.getReturnValue());
+                            break;
+                        }
+                    case Operation::LONGDOUBLE: 
+                        {
+                            outputDataObject->setDouble(pl[i], *(long 
double*)operation.getReturnValue());
+                            break;
+                        }
+                    case Operation::CHARS: 
+                        {
+                            outputDataObject->setCString(pl[i], 
*(char**)operation.getReturnValue());
+                            break;
+                        }
+                    case Operation::STRING: 
+                        {
+                            outputDataObject->setCString(pl[i], 
(*(string*)operation.getReturnValue()).c_str());
+                            break;
+                        }
+                    case Operation::DATAOBJECT: 
+                        {
+                            outputDataObject->setDataObject(pl[i], 
*(DataObjectPtr*)operation.getReturnValue());
+                            break;
+                        }
                     default:
-                        LOGERROR_1(0, "Unknown SDO type return value named %s 
has been found. Unknown types are not yet supported", name);
-                    }   
+                        {
+                            string msg = "Unsupported parameter type";
+                            msg += resultType;
+                            throw msg.c_str();
+                        }
+                    }
                 }
             }
     

Modified: 
incubator/tuscany/cpp/sca/samples/Calculator/sample.calculator/sample.calculator.composite
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/Calculator/sample.calculator/sample.calculator.composite?view=diff&rev=442549&r1=442548&r2=442549
==============================================================================
--- 
incubator/tuscany/cpp/sca/samples/Calculator/sample.calculator/sample.calculator.composite
 (original)
+++ 
incubator/tuscany/cpp/sca/samples/Calculator/sample.calculator/sample.calculator.composite
 Tue Sep 12 03:06:30 2006
@@ -19,8 +19,8 @@
        name="sample.calculator">
 
        <service name="CalculatorService">
-               <interface.wsdl 
interface="http://sample/calculator#wsdl.interface(CalculatorPortType)"/>
-               <binding.ws 
port="http://sample/calculator#wsdl.endpoint(CalculatorService/CalculatorPort)"/>
+               <interface.wsdl 
interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+               <binding.ws/>
                <reference>CalculatorComponent/CalculatorService</reference>
        </service>
 

Modified: 
incubator/tuscany/cpp/sca/samples/PythonCalculator/sample.calculator/sample.calculator.composite
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/PythonCalculator/sample.calculator/sample.calculator.composite?view=diff&rev=442549&r1=442548&r2=442549
==============================================================================
--- 
incubator/tuscany/cpp/sca/samples/PythonCalculator/sample.calculator/sample.calculator.composite
 (original)
+++ 
incubator/tuscany/cpp/sca/samples/PythonCalculator/sample.calculator/sample.calculator.composite
 Tue Sep 12 03:06:30 2006
@@ -19,8 +19,8 @@
        name="sample.calculator">
 
        <service name="CalculatorService">
-               <interface.wsdl 
interface="http://sample/calculator#wsdl.interface(CalculatorPortType)"/>
-               <binding.ws 
port="http://sample/calculator#wsdl.endpoint(CalculatorService/CalculatorPort)"/>
+               <interface.wsdl 
interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+               <binding.ws/>
                <reference>CalculatorComponent/CalculatorService</reference>
        </service>
 

Modified: 
incubator/tuscany/cpp/sca/samples/RubyCalculator/sample.calculator/sample.calculator.composite
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/RubyCalculator/sample.calculator/sample.calculator.composite?view=diff&rev=442549&r1=442548&r2=442549
==============================================================================
--- 
incubator/tuscany/cpp/sca/samples/RubyCalculator/sample.calculator/sample.calculator.composite
 (original)
+++ 
incubator/tuscany/cpp/sca/samples/RubyCalculator/sample.calculator/sample.calculator.composite
 Tue Sep 12 03:06:30 2006
@@ -19,8 +19,8 @@
        name="sample.calculator">
 
        <service name="CalculatorService">
-               <interface.wsdl 
interface="http://sample/calculator#wsdl.interface(CalculatorPortType)"/>
-               <binding.ws 
port="http://sample/calculator#wsdl.endpoint(CalculatorService/CalculatorPort)"/>
+               <interface.wsdl 
interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+               <binding.ws/>
                <reference>CalculatorComponent/CalculatorService</reference>
        </service>
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to