I have been creating and consuming web services for years and always have been able to use Visual Studio to create a service reference from the client. I have a third party service I need to work with and they refuse to open their security so I can see the wsdl and make the service reference. It's a public facing service so I don't see the need for that level of security but it is what it is.
I know this is a n00b question and I'm ashamed to be asking it, but how do I do create the equivalent Service Reference information in my client when all I have available to me is a physical copy of the wsdl the client emailed me? The web.config changes, the object layer over the SOAP data, etc. Just like with an automated Service Reference I just want to open a connection to the service and start using it with the defined objects.
The third party service is not WCF as far as I can tell but is SOAP. I'm using VS 2010 btw. Thanks in advance, Ken
This may be the easiest method
- Right click on the project and select "Add Service Reference..."
- In the Address: box, enter the physical path (C:\test\project....) of the downloaded/Modified wsdl.
- Hit Go
There are two ways to go about this. You can either use the IDE to generate a WSDL, or you can do it via the command line.
1. To create it via the IDE:
In the solution explorer pane, right click on the project that you would like to add the Service to:
Then, you can enter the path to your service WSDL and hit go:
2. To create it via the command line:
Open a VS 2010 Command Prompt (Programs -> Visual Studio 2010 -> Visual Studio Tools)
Then execute:
WSDL /verbose C:\path\to\wsdl
WSDL.exe will then output a .cs file for your consumption.
If you have other dependencies that you received with the file, such as xsd's, add those to the argument list:
WSDL /verbose C:\path\to\wsdl C:\path\to\some\xsd C:\path\to\some\xsd
If you need VB output, use /language:VB
in addition to the /verbose
.
来源:https://stackoverflow.com/questions/12710281/how-to-generate-service-reference-with-only-physical-wsdl-file