?
Solved

Mapping xml messages to c# Functions

Posted on 2007-03-29
1
Medium Priority
?
260 Views
Last Modified: 2013-11-07
Hi All,

I need an approach on calling function that request comes to me with xml message. Ok here is the fully story.

I have an client.aspx in my site and makes xmlhttp calls to serv.aspx. This client.aspx page pass the info about which function it call. Like..

<?xml....?>
<root>
    <msg label="getSubCategories">
         <param lable="categoryId">13</param>
    </msg>
</root>

And I got it in serv aspx and parse it to an object that holds the information of call message.

And now I need a approached that how to invoke requested method.

First thing that comes to my mind is like this.

/*************************************/
switch(msg.label)
{
   case "getSubCategories":
      myapi.getSubCategories(int.parse(msg.parameters[0]))
      break;
   case "getCountries":
      myapi.getCountries()
      break;
   .
   .
   .
}
/*************************************/

This maybe very easy to implement but the list may be to long and every change to api needs change of the inner part of the switch

So I ask what can be done for the issue. Is the above is suitable, or regular web xml service use a best way. Or what can be else?

thanks as now.

note: I use my own api for xml calls and easily made change on message body, and use c# (asp.net 2.0 on w2003 IIS 6.0), by the way I do not want to implement standard soap message rules and set web service project that comes with .net it sells. You can be ask why beacause the job I decide t&#305;o to is more like an remote call system, because I want it to specially to my system..:)



0
Comment
Question by:karanba
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
Nico earned 2000 total points
ID: 18814729
You can use Reflection for this I suppose. I think the following CodeProject article can be helpful to you: http://www.codeproject.com/csharp/runtime_method_invoke.asp


0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question