-1

I have a strange problem with webservices. There is a WebMethod as below:

public string GenerateUrl(string webserviceId,string webmethodId, string versionId)
{
    return @"C:\" + webserviceId + @"\" + webmethodId + @"\Versions\V" + versionId + ".txt";
}

if I call it with the following parameters:

GenerateUrl("ws","wm","1");

it returns C:\\Versions\V1.txt

but if i pass versionId any other value than "1" like

GenerateUrl("ws","wm","2");

it works properly and returns C:\ws\wm\Versions\V2.txt!

Saro Taşciyan
  • 5,210
  • 5
  • 31
  • 50
Heba El-Fadly
  • 281
  • 1
  • 5
  • 17

1 Answers1

0

Just to test the case i have tried the following using a Console Application as a test project:

public static string GenerateUrl(string webserviceId, string webmethodId, string versionId)
{
    return @"C:\" + webserviceId + @"\" + webmethodId + @"\Versions\V" + versionId + ".txt";
}

And called it a couple times as follows:

Console.WriteLine(GenerateUrl("ws", "wm", "1"));            
Console.WriteLine(GenerateUrl("ws", "wm", "2"));            
Console.WriteLine(GenerateUrl("ws", "wm", "3"));

As expected the results (copied from console output) are:

C:\ws\wm\Versions\V1.txt

C:\ws\wm\Versions\V2.txt

C:\ws\wm\Versions\V3.txt

In this case my final thought is the method GenerateUrl() works fine, there must be a problem the way it is being called. To see that i suggest you place a breakpoint and check for the arguments (watch) webserviceId and webmethodId each time method is called. You will probably see the values as string.Empty or "". Before executing return statement you can manipulate the value for versionId argument, set it to 1 and see if it's going to break

Community
  • 1
  • 1
Saro Taşciyan
  • 5,210
  • 5
  • 31
  • 50