Unable to load proxy class at runtime when using "Add Web Reference..."
-
Hi, I have a web service I created and uploaded to my server. In another project (output type .dll) I added a reference to the service via "Add Web Reference..." dialog. All seemed fine at first. A file called Reference.cs is added under the web reference node, and when I look at it, this looks just like the proxy class that is needed. The Build Action associated with this file is "Compile." I am also able to use intellisense to get access to the created proxy class, and when I load the .dll from another project in the same solution through the debugger, everything works fine. However, when I copy the files from my bin\Release\ to another folder (and also calling the .dll from a separate solution altogether), I get an exception : "System.TypeLoadException: Could not load type 'Trading.BrokerProxy.net.sbjgroup.CustomerMgmtSvc' from assembly 'SBJCharts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'..." (where Trading.BrokerProxy.net.sbjgroup.CustomerMgmtSvc is the proxy class) The other part of all of this, is that if I generate the proxy class via wsdl.exe and add the output to my project...at that point all works as expected (after I also remove the WebReference). I'd really like to figure out what's going on here, as it would be much simpler just to add the WebReference and then everything works as expected. Thanks in advance. BW
-
Hi, I have a web service I created and uploaded to my server. In another project (output type .dll) I added a reference to the service via "Add Web Reference..." dialog. All seemed fine at first. A file called Reference.cs is added under the web reference node, and when I look at it, this looks just like the proxy class that is needed. The Build Action associated with this file is "Compile." I am also able to use intellisense to get access to the created proxy class, and when I load the .dll from another project in the same solution through the debugger, everything works fine. However, when I copy the files from my bin\Release\ to another folder (and also calling the .dll from a separate solution altogether), I get an exception : "System.TypeLoadException: Could not load type 'Trading.BrokerProxy.net.sbjgroup.CustomerMgmtSvc' from assembly 'SBJCharts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'..." (where Trading.BrokerProxy.net.sbjgroup.CustomerMgmtSvc is the proxy class) The other part of all of this, is that if I generate the proxy class via wsdl.exe and add the output to my project...at that point all works as expected (after I also remove the WebReference). I'd really like to figure out what's going on here, as it would be much simpler just to add the WebReference and then everything works as expected. Thanks in advance. BW
I've never created a proxy that way. The way I have done it successfully is to run the WSDL command line tool to generate a CSharp file containing the proxy class. I then add this file to a Class Library ( Assembly ) project. The resulting assembly can be added as a reference to any number of projects and used assuming you account for any changes is the address ( URI ) to the hosted Web Service.
led mike
-
I've never created a proxy that way. The way I have done it successfully is to run the WSDL command line tool to generate a CSharp file containing the proxy class. I then add this file to a Class Library ( Assembly ) project. The resulting assembly can be added as a reference to any number of projects and used assuming you account for any changes is the address ( URI ) to the hosted Web Service.
led mike
This would work fine too...only thing is I'd have to re-run wsdl if I added another method to the web service. It' really just a few more steps, but it would be nice to avoid them if I could. If I ever dig anything up on why it's not working as expected, I'll be sure to post the solution to this thread.