Solved

Mapping xml messages to c# Functions

Posted on 2007-03-29
1
257 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 500 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

729 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