Last post Sep 20, 2013 09:54 AM by Illeris
Sep 19, 2013 05:46 AM|xartadas|LINK
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
Sep 19, 2013 07:26 AM|Illeris|LINK
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 ...
Sep 19, 2013 08:58 AM|xartadas|LINK
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
2) Instancing on client webservice class to use request/response classes defined in web service side
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?
Sep 19, 2013 09:17 AM|xartadas|LINK
Maybe many web service dont exposing request/response classes?
Sep 20, 2013 09:54 AM|Illeris|LINK
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?