Hi all,

I was looking to put together another "real-world" sample for SCA C++,
using Sebastien's REST support to invoke the Yahoo REST services.
Unfortunately, this won't currently work due to how we support
arguments - currently they're indexed purely by number.

The Yahoo REST services need an HTTP GET call like:
http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemo&query=Tuscany&results=2

If we have the Yahoo service configured in a SCA reference using the
REST binding and then call webSearch("YahooDemo", "Tuscany", 2) on a
SCA reference object in some component code, the HTTP GET call
generated is:
http://search.yahooapis.com/WebSearchService/V1/webSearch?param1=YahooDemo&param2=Tuscany&param3=2

In another example, if we want to use a SOAP service which has a
request schema containing a bunch of non-required elements like:
<xs:element name="myMethod">
 <xs:complexType>
    <xs:sequence>
      <xs:element name="anArgument" minOccurs="0" type="xs:string"/>
      <xs:element name="anotherArgument" minOccurs="0" type="xs:string"/>
      <xs:element name="lastArgument" minOccurs="0" type="xs:string"/>
    </xs:sequence>
 </xs:complexType>
</xs:element>

And this is again configured as an SCA reference (using the WS
binding). A component calling this operation would have to call
myMethod("", "", "some data") - which would mean the first 2 elements
get sent in the SOAP message with empty data (rather than being left
out completely) and only the "lastArgument" element would contain
anything useful. Doing this may also cause errors at the server as
elements are received without any data to work on.

I think we can fix these case pretty easily (in some circumstances) by
adding a parameter name index to the tuscany::sca::core::Operation
object - so parameters have a number and an optional name. For scagen
generated C++ proxy objects, the parameter names can be based on those
provided by the header and set inside the proxy. For Python you can
use named arguments when calling methods like myMethod(
lastArgument="someData" ) or webSearch(appid="YahooDemo",
query="Tuscany", results=2). I don't think Ruby supports named
arguments, but there may be ways of using a Ruby dictionary object to
do this.

If the Operation object passed to the ws or rest bindings contains
named arguments we can  use them in creating the right SOAP message or
HTTP call.

Any thoughts on this? Is it worth doing?

Cheers
Andy

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

Reply via email to