This is when the partner demands more control and they want to make sure all their partners host similar webservices so that the partner's code for the web service call is consistent.
Now to solve the matter, we do not have a GUI genie (wizard) for our help. We will have to do each step manually taking help of command line.
Here are the steps:
1) From the WSDL file create an Interface class using wsdl tool. For this, bring up the Visual Studio Command Prompt Window and run the below command.
wsdl.exe yourFile.wsdl /l:CS /serverInterfaceNote: You can decide the language of the Interface Class generated. In parameter /l, use VB or CS for your Visual Basic or CSharp respectively. Finally the command will create a new .cs or .vb file.
2) Create a new .NET Web Service (.asmx).
3) Import the file created in the above step into your project.
4) In your .asmx.cs file in Code-View, modify class as below to implement the interface generated in the above step:
public class MyWebService : System.Web.Services.WebService, IWsdlService { // Web methods and other calls goes here.... }5) Implement the methods mentioned in the Interface class. Finally your webservice class will be something like this:
public class MyWebService : System.Web.Services.WebService, IWsdlService { [WebMethod] public string MyWeMethod1() { // your business logic goes here... return "MyWeMethod1 Result"; } [WebMethod] public string MyWeMethod2() { // your business logic goes here... return "MyWeMethod2 Result"; }
This comment has been removed by a blog administrator.
ReplyDelete