Friday, June 02, 2006

Dynamically creating a web service proxy class

I'm working on a service integration project these days and so I've been having an interesting time getting to grips with web services and all that stuff. (as you can probably see from some of my recent posts). This code project article by Roman Kiss is really cool, its about creating your own loosely coupled web service bus, but what I really liked about it was the bit about creating web service proxy classes on the fly. Basically wsdl.exe, the command line tool that you can use for generating web service proxy classes, wraps a framework class 'ServiceDescriptionImporter'. It takes a 'ServiceDescription' class with a wsdl file loaded in it and returns a code dom namespace. You can compile any code dom namespace using the CSharpCodeProvider, and you can do it in memory and then directly access the methods and types on the generated assembly. That is so cool, it kind of brings the promise of wsdl as a web service reflection language directly into your project.

1 comment:

  1. Hi,
    thnx for your article.
    i am having a reqmnt, in which user wil enter a wsdl url in a textbox,when i clik a button i shud invole that web service / generate a proxy clas s and access those mthods inside the web
    servcie and populate the records in a grid .
    am using a asp.net 2.0/C#.
    can you help me by providinga sample how to do it?

    ReplyDelete

Note: only a member of this blog may post a comment.