tags:

views:

153

answers:

4

Hi,
I need to do xml based client server interaction.
As per my knowledge, steps in client server communication through xml may include:

1. client prepares the xml
2. transmittal of the xml
3. server processes the xml

client can send request to the server through xml document. The XML parser at the server will parse the xml file and pass the information to the server.
If so, What will be the output of xml parser to the server?
How to use the xml parser at the server for this purpose?
What will be the response format from server to client( whether can it send response in xml format) to client?

If i am wrong what is the best way to do client server communication through use of xml?

Thank you,

+1  A: 

XML is a way of describing data, it would probably be better looking at a technology that uses XML to transfer data, for instance WebServices in asp.net use SOAP based XML messages. You should look at these kinds of mechanisms in the technology you work in.

If you are expecting to receive an XML file in a specific format, you need to look at the means of delivery, again this could be WebService based or file transfer?

Mark Redman
A: 

It depends on the language and function-set that you are using.

The output of the xml parser could be somethings like PHP Arrays.

and usualy the praser function works like:

$output=parse_function($xml_input_string)

yes, the connection could be bidirectional (client can have an instance of parser too)

amir beygi
if i use any parser written in Java (like JAXP) at server, what will be the output of the xml parser to server and how the server use it?
preeti
A: 

XML is just a container format to pass the data in to the server.

So for instance if you want to pass the username and password of a user to the server you'd sent something like this:

 <credentials>
      <username>john</username>
      <password>password</password>
 </credentials>

The server would receive this and parse it. It would, (perhaps) create a credentials object out of it like this:

 class Credentials
 {
      String username;
      String password;
 };

fill out the values it got from parsing the XML and send it to the business layer.

The businesslayer checks with the database (or any other datastore) to check if the credentials are correct.

It will then inform if it was ok. The server will then send back (probably in XML as well) the result of the logon:

 <result>
      <errorcode>10</errorcode>
      <errortext>The username and password do not match</errortext>
 </result>

And the client will parse the XML and present the user with the result.

Does this explain your question?

Toad
Thank you, whether the xml parsers used by the client and the server are same?
preeti
how xml is parsed at server? whether by xml parser or server itself?
preeti
any xml parser will be fine. It is not the parser which makes any difference,it is the content in the XML. The 'server' is a definition which means hardware and software. The software of the server probably has an XML parser which will parse the request,
Toad
A: 

Use XML serialization and de-serialization on client and server side rather than doing it yourself. Create and object on client (better yet in a common class that can be used both on server and client), populate the object with data and serialize it on client, send it over to server , de-serialize it to object again and use it. You can do the same with the result that the server had to pass back to the client. There are XML libraries in all languages that will help you do that. For client server plumbing you can use numerous frameworks out there. WCF is one on .NET.

ashish jaiman