I would like to generate proxy classes/code from a WSDL for IDL. So that I may communicate with a SOAP service.
Anyone know any tutorials or have any clue on how it can be done?
Try to use WseWsdl3 - see http://msdn.microsoft.com/en-us/library/aa529578.aspx .
If WseWsdl3.exe is unable to create the proxy class, there is still a way.
If you can run your service as a regular ASP.NET web application in IIS, it creates temporary ASP.NET files where the proxy class is nicely generated for you.
You can find it in folder:
C:\Windows\Microsoft.NET\Framework\vMAJOR.MINOR.BUILD\Temporary ASP.NET Files\YOUR_WEB_APP.
There are some subfolders with random names, go to most recent one and look something like "App_WebReferences.XXXX.0.cs".
Related
I have a Service Client Library project which has its own
app.config
.
This project is referenced in my Web Application. The problem is My web application throws following exception
Could not find endpoint element with name 'HttpEndPoint' and contract 'ServiceLibReference1.IDalService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.
There is nothing wrong with the service. If i directly refer my service in the web application it works fine as client configurations get added to the web.config. But my requirement is to keep it in a separate library project.
The reason for the exception is service configurations are not added to the web.config. Should i always add them manually? Should not VS add corresponding configurations into web.config whenever a service library is referenced? or am i missing something ?
thanks
Service libraries are, by design, intended to be used by (potentially) multiple different applications. Therefore, they don't use the app.config file included in the template - they will use the config file (web/app) of the application that is referencing them. This promotes code reuse - if you have certain methods that you are always using across multiple applications, it's easier to put them in a separate class library assembly. One benefit of that design is that you only need to change the code in one place to make the change effective for all using applications.
So yes, you will always need to add the service configuration to the specific application configuration file. Unfortunately, VS does not know to do this.
I have an ASP.NET MVC3 project in .NET 4 which needs to act as a SOAP server to receive notifications from another website.
I have created web services before, but I don't know how to set up a way to receive these notifications where the WSDL is provided by the external website.
I know I can create a service and get that to produce its own WSDL, but I'm assuming there must be an easy way to add a service reference, and then create a service that uses the objects/methods generated by it.
How do I do this?
Thanks
You can use the svcutil tool from visual studio commands line, to create the required configuration and proxy files
I am making a window service in .Net2.0 on which I am adding a web reference of a web service in .Net2.0 only, present at the Linux server. For that I am requiring a .wsdl file that is to be generated after i compile the Web service OR I have to make it manually on my own.
I am not able to generate the .wsdl neither automatically nor manually (don't know how to make it).
Kinldy provide me with a solution if someone is aware of the working of .Net Web Services at different Servers.
Thanks
here is url of your service: http://localhost/SuperWebService , if you click this url: http://localhost/SuperWebService?wsdl it will generate WSDL
You need to generate a proxy for calling a web service. The simplest way to do this is using the Add Web Reference option when you right click on your project in Visual Studio.
I'm signed up, I've downloaded sample code, I've got a WSDL...and yet I have no idea how to get this stuff into my existing .Net application. The WSDL was in a zip file, not a URL so I can't just "Add Web Reference." I've run the wsdl tool from the .Net command prompt, and it made a nice class for me...yet dropping that into my web_reference folder doesn't give me any kind of instantiatable class.
I know I'm missing something stupid. Can someone point me in the right direction please?
The proper way to load the FedEx API WSDL file in Visual Studio 2010:
Open the Solution Explorer
Right click your project
Click 'Add Service Reference'
Click the 'Advanced...' button
Click the 'Add Web Reference...' button
Enter the exact path to the WSDL file for the specific FedEx web reference you're using. For example, I extracted mine to the root of my C:\ drive, so all I entered into the URL field was "C:\ShipService.wsdl" without quotes. If you leave quotes, it won't work.
When you hit go, Visual Studio should consume the wsdl into workable classes for you. Click Add Reference and enjoy!
Note: Make sure you read the FedEx documentation well - a lot of their services have gotchyas and implementation can be a nightmare. For example, their address validation service is consumed incorrectly and creates two-dimensional arrays in Reference.cs where they shouldn't exist - this is detailed in the documentation. Worse yet, the fact that they don't allow address validation on their dev environment isn't documented anywhere! Good luck!
Actually, you can just "Add Web Reference". Give the path to the URL.
OTOH, you should be doing all new web service development (even client development) using WCF. Microsoft now considers ASMX web services to be "legacy technology".
BTW, I just tried using their address validation service, and it won't work with .NET. Both ASMX and WCF clients will attempt to use the XML serializer to consume this service, and there is a bug there that prevents that service from being used.
Matt, the WSDL zip file has the WSDL and its associated transactions for that service. Unzip the file and then "Add the reference" to the WSDL in your code.
Try changing the namespace of the proxy class to that of your application. I currently use the proxy class with C# and it works in spite of FedEx's limited documentation and samples.
My problem is closely related to this one: How can I use .NET web services from non-standard ports?. My web service runs behind a port-forwarding firewall, so the port numbers reported in the WSDL document contain the internal high-numbered port. I wrote a SoapExtensionReflector class which is able to rewrite the WSDL document. So a request like example.com/path/loginservice?wsdl is handled correctly.
However, this doesn't handle the "disco" request: example.com/path/loginservice?disco. This returns an XML document like this:
<discovery>
<contractRef ref="http://example.com:10092/loginservice.asmx?wsdl" docRef="http://example.com:10092/loginservice.asmx"/>
<soap address="http://example.com/path/loginservice.asmx" binding="q1:LoginServiceSoap"/>
<soap address="http://example.com/path/loginservice.asmx" binding="q2:LoginServiceSoap12"/>
</discovery>
While the soap bindings have been properly re-written by the SoapExtensionReflector, the contractRef and docRef URLs have the high-numbered port. How can I rewrite them as well?
Finally figured something out. Created proxy classes manually using svcutil after migrating everything to WCF. I figure you could probably do the same thing using the wsdl tool that came with the old asp.net web services, but I haven't tried that.