Arif YILMAZ
Arif YILMAZ

Reputation: 5866

adding wsdl to .net website doesn't work

I am trying to add a web service reference to my customer's windows server. I can add it by clicking the Add Service Reference from the menu and type the correct web service url in the address bar. Then I click the GO button to validate the url. It locates the web service perfectly. Then I click the OK button to finish the job.

Then I see that Visual Studio creates a folder called App_WebReference, and puts a file like this Reference.svcmap in that folder.

When I go to the c# code, I am trying to call the web service but I cannot reach it. However this work if I create a local project and do the same things I explained above.

Here is web service url if you want to take a look at it. What am I doing wrong? I don't have any code to display because I couldn't code anything since I cannot reach the web service from c#. What am I supposed to do?

Upvotes: 1

Views: 676

Answers (1)

Belogix
Belogix

Reputation: 8147

When you added your Service Reference you gave it the Namespace of ziraat so the following code should access the method you are trying to call:

using (var client = new ziraat.RegisterTransactionSoapClient())
{
    client.SaveTransaction(...);
}

In addition I have seen an issue in Visual Studio where the Service Reference is added but the code generated is incorrect... This might be your issue?! To try a work-around:

  • Right-click on the ziraat service reference item in your Solution Explorer tree
  • Click Configure Service Reference... from the context-menu that appears
  • Make sure that the Reuse types in referenced assemblies check box is NOT ticked
  • Click OK to save the changes

Then try the code sample above again.

Upvotes: 2

Related Questions