Client provided me the wsdl to generate the web service.But when I used the wsdl.exe command it generated the .cs class out of it. I consumed that class in my web service and when I provided the wsdl to client it didn't match their schema. Actually I want the .asmx to be automatically generated from the wsdl so that I could fill in the web method. So that it will exactly match their schema. Hope it make sense.
A Web Services Description Language (WSDL) document specifies the interface to a web service, and enables a web service client to start it. A WSDL document that is generated from a message model defines web service requests and responses in terms of the messages that you have defined in that message model.
You can retrieve the outer-most WSDL file (defined by the <wsdl-file> element within the webservices. xml file) by appending the string /wsdl or /wsdl/ to the endpoint address, for example, http://example.com/services/stockquote/wsdl .
There isn't a magic bullet solution for what you're looking for, unfortunately. Here's what you can do:
create an Interface class using this command in the Visual Studio Command Prompt window:
wsdl.exe yourFile.wsdl /l:CS /serverInterface
Use VB or CS for your language of choice. This will create a new .cs
or .vb
file.
Create a new .NET Web Service project. Import Existing File into your project - the file that was created in the step above.
In your .asmx.cs
file in Code-View, modify your class as such:
public class MyWebService : System.Web.Services.WebService, IMyWsdlInterface { [WebMethod] public string GetSomeString() { //you'll have to write your own business logic return "Hello SOAP World"; } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With