locked
Why create a proxy classes file with wsdl tool? RRS feed

  • Question

  • User-872157355 posted

    i have some doubt about web service and will explain shortly Why i have to generate by wsdl.exe proxy classes file (file .cs) then serialize it to send at web service instead to build classes server side (with web method) and simply to create an instance of them when i add the service in Visual Studio. If both methods are good explain me best way to do it

    thanks in advance

    Thursday, September 19, 2013 5:46 AM

Answers

  • User-488622176 posted

    If you use all code on same host (machine/server) there is no need for the WSDL way. In fact, you do not need ASMX or whatever (WCF, ...). You simply create classes (message classes, service classes) directly with the "new" operator.

    However, of you have a client running on a different machine then the ASMX service, you have another issue. When you create objects directly with "new", and these objects access ressources such as dbase, filesystem, ... => you will be using the ressources on the machine you called the "new" operator on. Meaning when you have dbase connections, you might very well be blocked. This is why you need ASMX. The proxy will in this case create the objects, serialize them to XML/SOAP, sent them to the ASMX service on the remote machine, and the service on the remote machine will handle things accordingly.

    Hope this answers your question?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 20, 2013 9:54 AM

All replies

  • User-488622176 posted

    I'm not sure I understand your question correclty.

    The proxy mechanism allows you to call the code from another tier (let's call it the consuming tier). If the consuming tier does not need to be located on another machine, there is no specific need (unless you have another) to use proxy & server code. You could merely create the service object directly & use it ...

    Thursday, September 19, 2013 7:26 AM
  • User-872157355 posted

    thanks for reply, i will try to explain better.

    I have a web method with custom class parameter (request) and custom class as response. These classes are implemented server side where web service is.

    Client side i have 2 options to call web service

    1) After used wsdl tool and implemented proxy classes by wsdl file and then call web service serializing in a xml buffer or file

    or

    2) Instancing on client webservice class to use request/response classes defined in web service side

    for example

    ServiceReference3.classname myrequest = new ServiceReference3.classname();

    My question is why use wsdl tool to create a classes file if i can use webservice's object with same classes?


     
    thanks

    Thursday, September 19, 2013 8:58 AM
  • User-872157355 posted

    Maybe many web service dont exposing request/response classes?

    Thursday, September 19, 2013 9:17 AM
  • User-488622176 posted

    If you use all code on same host (machine/server) there is no need for the WSDL way. In fact, you do not need ASMX or whatever (WCF, ...). You simply create classes (message classes, service classes) directly with the "new" operator.

    However, of you have a client running on a different machine then the ASMX service, you have another issue. When you create objects directly with "new", and these objects access ressources such as dbase, filesystem, ... => you will be using the ressources on the machine you called the "new" operator on. Meaning when you have dbase connections, you might very well be blocked. This is why you need ASMX. The proxy will in this case create the objects, serialize them to XML/SOAP, sent them to the ASMX service on the remote machine, and the service on the remote machine will handle things accordingly.

    Hope this answers your question?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 20, 2013 9:54 AM