You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by Ashutosh Somani <as...@MIT.EDU> on 2000/11/19 18:00:06 UTC

Using Objects

I have heard a lot of discussion on this list about how SOAP should be
used for the transfer of objects and a user should think in terms of objects.
Well what I am trying to do is have a client send an XQL (that's an XML
querying language for those that do not know) query to the server through
SOAP and have a server that stores some XML documents and returns the
proper portion of the XML document. So the way I was thinking about setting
it up was to have the client send the query as a string, and then just return
the corresponding XML part using literal XML encoding. So the client might
send something like "//customer" and the server might return something like:
<Customer>
Joe Smith
</Customer>

However, am I thinking about this the wrong way and should I be trying to 
return
some type of object instead of some actual data?
Has anyone else done something similar? How did you approach this problem?
Thanks for any insight.
Ash


Re: Using Objects

Posted by "David C. Hicks" <dh...@machturtle.com>.
There are always many ways to solve the same problem, of course.  You
could spend a lot of time writing classes to handle the various parts of
your XML documents so that you can pass all that information back as an
object, or you could simply send the data back and be done with it.  The
best question to ask in order to arrive at the correct answer is...how
often will the layout or format of the XML data you're sending back
change?  Is it really worth writing classes to manage that data?  On the
one hand, you will likely finish your work much quicker by sending back
literal XML.  On the other, you won't have the flexibility to change the
format of that XML down the road without refactoring your code.

I personally tend to send data back first, then when I find I need to
refactor to handle the flexibility issue I do it then.  Only when I know
for certain up front that I need that flexibility will I engage in the
longer-term activity.


Ashutosh Somani wrote:
> 
> I have heard a lot of discussion on this list about how SOAP should be
> used for the transfer of objects and a user should think in terms of objects.
> Well what I am trying to do is have a client send an XQL (that's an XML
> querying language for those that do not know) query to the server through
> SOAP and have a server that stores some XML documents and returns the
> proper portion of the XML document. So the way I was thinking about setting
> it up was to have the client send the query as a string, and then just return
> the corresponding XML part using literal XML encoding. So the client might
> send something like "//customer" and the server might return something like:
> <Customer>
> Joe Smith
> </Customer>
> 
> However, am I thinking about this the wrong way and should I be trying to
> return
> some type of object instead of some actual data?
> Has anyone else done something similar? How did you approach this problem?
> Thanks for any insight.
> Ash

-- 
David C. Hicks
Mach Turtle Technologies,  Inc. (www.machturtle.com)
dhicks@machturtle.com
770-753-8810

Re: Using Objects

Posted by "David C. Hicks" <dh...@machturtle.com>.
There are always many ways to solve the same problem, of course.  You
could spend a lot of time writing classes to handle the various parts of
your XML documents so that you can pass all that information back as an
object, or you could simply send the data back and be done with it.  The
best question to ask in order to arrive at the correct answer is...how
often will the layout or format of the XML data you're sending back
change?  Is it really worth writing classes to manage that data?  On the
one hand, you will likely finish your work much quicker by sending back
literal XML.  On the other, you won't have the flexibility to change the
format of that XML down the road without refactoring your code.

I personally tend to send data back first, then when I find I need to
refactor to handle the flexibility issue I do it then.  Only when I know
for certain up front that I need that flexibility will I engage in the
longer-term activity.


Ashutosh Somani wrote:
> 
> I have heard a lot of discussion on this list about how SOAP should be
> used for the transfer of objects and a user should think in terms of objects.
> Well what I am trying to do is have a client send an XQL (that's an XML
> querying language for those that do not know) query to the server through
> SOAP and have a server that stores some XML documents and returns the
> proper portion of the XML document. So the way I was thinking about setting
> it up was to have the client send the query as a string, and then just return
> the corresponding XML part using literal XML encoding. So the client might
> send something like "//customer" and the server might return something like:
> <Customer>
> Joe Smith
> </Customer>
> 
> However, am I thinking about this the wrong way and should I be trying to
> return
> some type of object instead of some actual data?
> Has anyone else done something similar? How did you approach this problem?
> Thanks for any insight.
> Ash

-- 
David C. Hicks
Mach Turtle Technologies,  Inc. (www.machturtle.com)
dhicks@machturtle.com
770-753-8810