[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Issue - 2 - attribute versus element based subfunction invocations
Chris's mail brings up the issue of - should subfunctions (or subprocesses as he calls them) be invoked using attributes or XML elements? An attribution invocation would look something like "<scope procedure="func(arg1, arg2, arg3)/>". An XML element invocation would look something like: <function functionName="func"> <parameters> <parameter.../> <parameter.../> <parameter.../> </parameters> </function> I believe that subfunction invocations should be expressed as XML elements for the same reason that the from and to XML elements in assign activities are XML elements. Put another way, we should only be willing to have subfunctions called using attributes if we are willing to throw away from and to XML elements and replace them with attributes. I think an example may help to illustrate the problem. Imagine a function is to be called and passed in a static piece of XML such as "<poID><companyDiv><subdiv>32</subdiv><maindiv>14</maindiv></companyDiv><id> 14</id></poID>". If the only way to call subfunction is via attributes then what the programmer would have to do is specify: <scope procedure="func(<poID><companyDiv><subdiv>32</subdiv><maindiv >14</maindiv></companyDiv><id>14</id></poID>)"/> I think we can all agree that the previous is unreadable and a nightmare to type in. Realistically speaking I suspect the only reasonable way to pass in a static value is something like: <assign> <copy> <from> <poID> <companyDiv> <subdiv>32</subdiv> <maindiv>14</maindiv> </companyDiv> <id>14</id> </poID> </from> <to variable="dummyVariable"/> </copy> </assign> <scope procedure="func(dummyVariable)"/> In other words, the programmer has to create a dummy variable, do a full assign and then copy the dummy variable in. I believe it is both easier and less error prone to take our lead from the "from" XML element used in assigns and specify: <function functionName="func"> <parameters> <parameter> <poID> <companyDiv> <subdiv>32</subdiv> <maindiv>14</maindiv> </companyDiv> <id>14</id> </poID> </parameter> </parameters> </function> In fact we can use almost all of the 'from' syntaxes as parameter types on the XML form of the function call. This will make the function call very natural to a BPEL programmer. This also makes other common scenarios very simple. For example, let us say that a function takes a string as an argument and that string is in a message, in part P2 in an element identified by the XPATH "/foo/bar/blah". The function call would look like: <function functionName="func"> <parameters><parameter variable="Message" part="p2" query="/foo/bar/blah"/></parameters> </function>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]