Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Mapping xml messages to c# Functions

Posted on 2007-03-29
1
Medium Priority
?
262 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

610 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