1

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?

5
  • You should note the namespace when add the Serv reference. And then use that. Commented Jul 1, 2013 at 12:00
  • Can you explain "When I go to the c# code, I am trying to call the webservice but I cannot reach it. However this work if I create a local project and do the same things I explained above." a bit more? What is "cannot reach it"? Do you get an error? What is "go to the C# code"? What is the difference between the two projects? How do you use the generated code? Commented Jul 1, 2013 at 12:00
  • @henk-holterman I named the reference "ziraat". in aspx.cs file, I type "ziraat.savetransation()", intellisense doesnt work and it cannot see the "ziraat". I do the same procedures in local project, it works Commented Jul 1, 2013 at 12:04
  • 1
    The term "cannot reach" is usually used in a different way when talking about services (as in: the service is unreachable), but it seems you cannot find the namespace in which the service client is generated. In that case this question looks relevant. Commented Jul 1, 2013 at 12:08
  • thank you very much for your effort. sorry about the English Commented Jul 1, 2013 at 12:13

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.