471,627 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,627 software developers and data experts.

better way of using XML

hi all

I have a small application assembled from

C# winForm client side (few of them)

C# webService at the server side

I'm using xml file to transfer the GUI information from client to server

For Example in the client window there are 3 text box's and one button

Text boxes are "first num" , " second num" and "sum"

And "calc" button

So when the user click the "calc" button , the winForm window send the GUI
xml to the server , and the server parses the xml file and fill in the
records

Xml example :

<Gui_items>

<item>

<textbox name="first
num">30</textbox>

</item>

<item>

<textbox name="second
num">50</textbox>

</item>

<item>

<textbox
name="sum"></textbox>

</item>

</Gui_items>

the server response will be :

<Gui_items>

<item>

<textbox name="first
num">30</textbox>

</item>

<item>

<textbox name="second
num">50</textbox>

</item>

<item>

<textbox
name="sum">80</textbox>

</item>

</Gui_items>

Then the winForm client get the response XML and parses it ,

All GUI item's are filed in to the GUI controls

This only simple example, the real client window is much complex,

I'm using labels and label's color changing

Currently I'm parsing the XML file using System.Xml

Is there any way I can bind the GUI elements to this XML and make it easier
for me to develop it ?

Is there any way I can use dataset's and have the same goal ?

Please post any comment you have

Thank you very much

Sharon


Dec 5 '05 #1
2 1253
Hi Sharon,

I think you need to separate in your mind the GUI and the data that it
represents. The only data going to the Web Service should be business data.
The GUI can manage itself, and the Web Service doesn't have to know anything
about the GUI, only the data that it represents. Remember that the "U" in
GUI is "User," meaning that the GUI is for a human user, not for a business
class.

The GUI is supposedly getting its data from some sort of business layer of
business objects that actually do the work with the data, or it should be.
This type of layered design makes it easier to port from one sort of
interface to another (such as a Windows form to an ASP.Net app or a Console
App, for example). The GUI's job is to present data to a User, and to
receive input from the User.

As for the Web Service, it should be a set of SOAP Web Methods that are,
essentially, business methods. That is, these methods operate only on data,
receiving it, retrieving it, and manipulating it. It is possible, for
example, to create an application whose business classes are entirely Web
Services. The GUI simply talks to the Web Service by calling Web Methods, as
if it were talking to a local set of business objects and making method
calls to them.

This separation enables each logical "layer" to manage the business that is
its own, without any other layer having to know anything about that layer's
"personal" business. Or, as my Uncle Chutney sez, "a class should mind its
own business."

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.

"Sharon" <Sh*******@hotmail.com> wrote in message
news:uO****************@TK2MSFTNGP10.phx.gbl...
hi all

I have a small application assembled from

C# winForm client side (few of them)

C# webService at the server side

I'm using xml file to transfer the GUI information from client to server

For Example in the client window there are 3 text box's and one button

Text boxes are "first num" , " second num" and "sum"

And "calc" button

So when the user click the "calc" button , the winForm window send the GUI
xml to the server , and the server parses the xml file and fill in the
records

Xml example :

<Gui_items>

<item>

<textbox name="first
num">30</textbox>

</item>

<item>

<textbox name="second
num">50</textbox>

</item>

<item>

<textbox
name="sum"></textbox>

</item>

</Gui_items>

the server response will be :

<Gui_items>

<item>

<textbox name="first
num">30</textbox>

</item>

<item>

<textbox name="second
num">50</textbox>

</item>

<item>

<textbox
name="sum">80</textbox>

</item>

</Gui_items>

Then the winForm client get the response XML and parses it ,

All GUI item's are filed in to the GUI controls

This only simple example, the real client window is much complex,

I'm using labels and label's color changing

Currently I'm parsing the XML file using System.Xml

Is there any way I can bind the GUI elements to this XML and make it
easier
for me to develop it ?

Is there any way I can use dataset's and have the same goal ?

Please post any comment you have

Thank you very much

Sharon



Dec 5 '05 #2
Why don't you just create a serializable "UIState" class that you send to the
webservice via a Webmethod, and it sends you something similar back?
Then all you have to do is read the properties on the response class and do
whatever they say to your UI (Colors, values, etc).
Then you can set a WebReference to your WebService and you don't have to
parse any XML at all.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Sharon" wrote:
hi all

I have a small application assembled from

C# winForm client side (few of them)

C# webService at the server side

I'm using xml file to transfer the GUI information from client to server

For Example in the client window there are 3 text box's and one button

Text boxes are "first num" , " second num" and "sum"

And "calc" button

So when the user click the "calc" button , the winForm window send the GUI
xml to the server , and the server parses the xml file and fill in the
records

Xml example :

<Gui_items>

<item>

<textbox name="first
num">30</textbox>

</item>

<item>

<textbox name="second
num">50</textbox>

</item>

<item>

<textbox
name="sum"></textbox>

</item>

</Gui_items>

the server response will be :

<Gui_items>

<item>

<textbox name="first
num">30</textbox>

</item>

<item>

<textbox name="second
num">50</textbox>

</item>

<item>

<textbox
name="sum">80</textbox>

</item>

</Gui_items>

Then the winForm client get the response XML and parses it ,

All GUI item's are filed in to the GUI controls

This only simple example, the real client window is much complex,

I'm using labels and label's color changing

Currently I'm parsing the XML file using System.Xml

Is there any way I can bind the GUI elements to this XML and make it easier
for me to develop it ?

Is there any way I can use dataset's and have the same goal ?

Please post any comment you have

Thank you very much

Sharon



Dec 5 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

220 posts views Thread by Brandon J. Van Every | last post: by
24 posts views Thread by Faith Dorell | last post: by
39 posts views Thread by bazad | last post: by
43 posts views Thread by Rob R. Ainscough | last post: by
22 posts views Thread by JoeC | last post: by
23 posts views Thread by mike3 | last post: by
1 post views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.