How to prevent double-slashes in URLs from being replaced?

G

Guest

Hi,

I have to call a java-written soap webservice from a .NET client
application. Unfortunately, the URL contains of a double slash "//", as u can
see in this example:

http://linux04.bla.blabla.com:18088//LM_SoapServices/BaanRequest.wsdl

..NET automatically replaces the "//" with a "/" and therefore the call
fails. Setting the "Url" property of the web service proxy class at runtime
results in the same behavior.

As far as I was told, it is NOT against the the standard to use multiple
slahes in an URL. So is there any way to stop .NET from replacing them?

thanks in advance,
Benjamin
 
J

james

Benjamin Janecke said:
Hi,

I have to call a java-written soap webservice from a .NET client
application. Unfortunately, the URL contains of a double slash "//", as u
can
see in this example:

http://linux04.bla.blabla.com:18088//LM_SoapServices/BaanRequest.wsdl

.NET automatically replaces the "//" with a "/" and therefore the call
fails. Setting the "Url" property of the web service proxy class at
runtime
results in the same behavior.

As far as I was told, it is NOT against the the standard to use multiple
slahes in an URL. So is there any way to stop .NET from replacing them?

thanks in advance,
Benjamin

url = url.replace("//","////");

(maybe... er...)
 
M

Marina Levit [MVP]

This has never happened to me.

If this was the case, no one would ever be able to call a web service.

What exactly is your code?
 
G

Guest

Hi,

don't get me wrong. .NET does not replace the // of the "http://"-part of
the url. again, the example:

http://linux04.bla.blabla.com:18088//LM_SoapServices/BaanRequest.wsdl

there is a double-slash in the middle of the url, which gets replaced with a
single slash. the double slash at the beginning of the url, after the
protocol name is not affected.

My code is as simple as that:

Service.BaanRequest b = new Service.BaanRequest();
b.Url = "http://172.16.0.74:18088//LM_SoapServices/BaanRequest";

when i then check the b.Url property in the debugger, i get the folowing
result:

http://172.16.0.74:18088/LM_SoapServices/BaanRequest

So its seems the double slash at the middle of the url was replaced
immediately after setting the property - even before calling any web method.
This also happens when I set the url using the app.config file (which is the
normal way to do this).

..NET just doesnt seem to allow for multiple slashes to occurr. I can even do
this:

b.Url =
"http://172.16.0.74:18088/////////////////LM_SoapServices/BaanRequest";

and get the same result.
 
M

Marina Levit [MVP]

I see what you are saying. I don't know why it does that, could be a bug.
 
G

Greg Young

I might disagree with whoever told you that is compliant.

per RFC 1630

" PATH

The rest of the URI follows the colon in a format depending on the
scheme. The path is interpreted in a manner dependent on the
protocol being used. However, when it contains slashes, these
must imply a hierarchical structure."

Since the slashes are implying a hierarchical structure is /foo//bar is
equivalent in the hierarchy to /foo/bar?

foo <null> bar
foo bar

I would say that if these are being looke at in a hierarchical fashio they
are actually equivalent. I cannot find anywhere in the spec directly
discussing this though. The only specific case discussed where this is not
the case in gopher where they are fairly explicit in saying that it is not a
hierarchical relationship even though it should be, they then go through an
example of a gopher URI using // which leads me to believe that the the
intent was to have the two cases be identical.
Cheers,

Greg Young
MVP - C# http://codebetter.com/blogs/gregyoung
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top