locked
What is the best approach to turning a Web application into a Web Service? RRS feed

  • Question

  • I'm hoping someone can point me in the right direction.

    I have a Web application in C# that allows users to enter street addresses into a UI, the addresses are then geocoded and spatially referenced against custom boundaries, and then information from within the boundary is appended to the address and displayed on the screen for the user.

    I need to take the application a step further, now I need to create a Web service so that users can call the Web service from their own applications, bypass the UI, send addresses to the application, and return the appended information to the client application.

    What would be the best approach to creating a Web service to handle the requests and utilize the spatial applications abilities and transporting the data using XML over HTTP?

    Thanks very much in advance!

    Thursday, February 23, 2012 2:29 AM

Answers

  • Hi!

    I think you should look at the Windows Communication Foundation.

    This is an overview:

    1. Define the Interface and implementation classes of your service  with attributes.

    2. Generate (the framework) the WSDL and other classes to handle the serialization (object -> xml and xml->object)

    3. Generate (the framework) the API for the client-side (optional, because if you dont have to develop the client, you can just provide the WSDL and the client is expected to generate its own code)

    4. Deploy your service in IIS or as a Service in a Windows Server.

    You should go on details on this WCF. It is easy.

    Some tutorials and introductions:

    http://wcftutorial.net/Introduction-to-WCF.aspx

    http://msdn.microsoft.com/en-us/library/dd936243.aspx

    This book is not bad too: "Windows® Communication Foundation 4 Step by Step".

    Regards,

    C.

    • Marked as answer by Peter516 Monday, March 5, 2012 1:24 PM
    Thursday, February 23, 2012 4:44 PM

All replies

  • Hi,

    Well, I'm not sure I understand completely what you app is doing but you have to decide which processing tasks are going to be done in the server-side and in the client-side.

    I guess this could be a solution:

    "to enter street addresses into a UI" -> client-side

    "the addresses are then geocoded and spatially referenced against custom boundaries" -> a service task

    "then information from within the boundary is appended to the address" -> a service task, or it could be a client-side task!. Is this stored?

    "displayed on the screen for the user" -> client-side

    You have to decide what is going to be the services in your service layer.

    Anyway, technologies: WCF, with MTOM if you need to transmit large images (you could transmit only numbers to your client and the client-side app then uses bing maps to present the information).

    http://msdn.microsoft.com/en-us/library/aa395209.aspx MTOM encoding.

    Regards,

    C.

    Thursday, February 23, 2012 12:06 PM
  • C.

    Thank you! Actually, I would only be sending back a few lines of appended text information. No images or large data files.

    Your analysis of my architecture is spot on.

    1. The client would reference the API from their internal application. (Client Side)

    2. Addresses frorm the client application would be sent using XML over HTTP to our application. (Client Side)

    3. Addresses are geocoded > (Service Task)

    4. Append information > (Service Task)

    5. Send XML over HTTP with response (Service Task)

    6. Client receives updated information (Client Side)

    I've been looking into adding an API to the application or a Web Service I'm just not sure on where the right point is to start. I will look over the link you provided and if you have any additional ideas please let me know.

    Thank you for your time!

    Thursday, February 23, 2012 4:27 PM
  • Hi!

    I think you should look at the Windows Communication Foundation.

    This is an overview:

    1. Define the Interface and implementation classes of your service  with attributes.

    2. Generate (the framework) the WSDL and other classes to handle the serialization (object -> xml and xml->object)

    3. Generate (the framework) the API for the client-side (optional, because if you dont have to develop the client, you can just provide the WSDL and the client is expected to generate its own code)

    4. Deploy your service in IIS or as a Service in a Windows Server.

    You should go on details on this WCF. It is easy.

    Some tutorials and introductions:

    http://wcftutorial.net/Introduction-to-WCF.aspx

    http://msdn.microsoft.com/en-us/library/dd936243.aspx

    This book is not bad too: "Windows® Communication Foundation 4 Step by Step".

    Regards,

    C.

    • Marked as answer by Peter516 Monday, March 5, 2012 1:24 PM
    Thursday, February 23, 2012 4:44 PM