• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to pass parameters  RSS feed

 
Daniel Sun
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, All:
This is actually a design question raised during developing a WS project. The question itself is not WS specific.
To make the issue simple to understand, I will use online purchase as an example. Suppose the system has to support 2 functions:
* place order (pass in customer_name, item1, item2.., return purchase_id)
* look order by customer name (pass in customer_name, return whole order)
Suppose we have developed a business object model to model a purchase order. The order model in XML format looks like
<order>
<id>****</id>
<customer>
<name>****</name>
</customer>
<items>
<item>**</item>
<item>**</item>
</items>
</order>
Now to implement the functions, we have a few choices on how to pass the parameters:
Choice A: Using the business object as in/out message,
*for place_order:
in_message:
<order>
<customer>
<name>****</name>
</customer>
<items>
<item>**</item>
<item>**</item>
</items>
</order>
out_message:
<order>
<id>****</id>
<customer>
<name/>
</customer>
<items>
<item/>
</items>
</order>
*for search by name:
in_message:
<order>
<customer>
<name>****</name>
</customer>
<items>
<item/>
</items>
</order>
out_message:
<order>
<id>****</id>
<customer>
<name>****</name>
</customer>
<items>
<item>***</item>
<item>***</item>
</items>
</order>
Choice B: Using elements in the business object as in/out message,
*for place_order:
in_message:
<order>
<customer>
<name>****</name>
</customer>
<items>
<item>**</item>
<item>**</item>
</items>
</order>
out_message:
<id>****</id>
*for search by name:
in_message:
<customer>
<name>****</name>
</customer>
out_message:
<order>
<id>****</id>
<customer>
<name>****</name>
</customer>
<items>
<item>***</item>
<item>***</item>
</items>
</order>
Choice C: Using the properties as in/out message,
*for place_order:
in_message:
<order>
<customer>
<name>****</name>
</customer>
<items>
<item>**</item>
<item>**</item>
</items>
</order>
out_message:
<property name="id" value="***"/>
*for search by name:
<property name="name" value="***"/>
out_message:
<order>
<id>****</id>
<customer>
<name>****</name>
</customer>
<items>
<item>***</item>
<item>***</item>
</items>
</order>
Of the 3 approaches, which one is the best. I would prefer the second one. The third one is OK, but definitely not the first one.
Can anyone offer your opnions

Thanks
HS
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!