472,374 Members | 1,500 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,374 software developers and data experts.

Redirect results in lost soap envelope. Changes method from POST to GET

Hello,

I created a web site, site A, that redirects to another web site, site
B, where a simple web service is hosted. The code to call the web
service is simple.

oWS.AllowAutoRedirect = True
oWS.Credentials = New
System.Net.NetworkCredential("user","pass")
str = oWS.HelloWorld("World")

When I set the URI of the webservice to site B an http trace shows the
following.
POST 401 text/html http://siteB/redirect_test/service.asmx
POST 401 text/html http://siteB/redirect_test/service.asmx
POST 200 text/xml http://siteB/redirect_test/service.asmx

The result of the call
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/
envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"
xmlns:xsd="http://www.w3.org/2001/
XMLSchema">
<soap:Body>
<HelloWorldResponse xmlns="http://tempuri.org/">
<HelloWorldResult>Hello World</HelloWorldResult>
</HelloWorldResponse>
</soap:Body>
</soap:Envelope>

When I try to test the redirect from site A to site B, I get the
following trace.
POST 301 text/html http://siteA/redirect_test/service.asmx
http://siteB/redirect_test/service.asmx
GET 401 text/html http://siteB/redirect_test/service.asmx
GET 401 text/html http://siteB/redirect_test/service.asmx
GET 200 text/html http://siteB/redirect_test/service.asmx

The result of this call is too long to post and be meaning full, but
the content is the list of methods for the web service. I am sure
most of you are familiar with the html rendering of the .asmx page
that lists the methods.

In both traces you will see 2 lines containing a 401. You can be
assured that security is not an issue. The 401's are a result of the
handshake that takes place to ensure that the user is valid.

The issue appears to be that the initial POST is getting changed to a
GET during the redirect. Thus the post stream that contains my SOAP
envelope is stripped and not sent to the web service at the new site.

If anyone has any ideas on why this may be happening and the best
method for resolving this issue I would greatly appreciate it.

This has been tested using web services hosted on IIS 6.0 and SAP
Netweaver 2004 & SAP ECC 5.0. The calling application was written
using VB.net in Visual Studio 2005. The .net framework version is 2.0
and the useragent string for the calling application is Mozilla/4.0
(compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.42).

If you need any more information about the environment or the calls
being made. Do not hesitate to post them and I will answer them to
the best of my ability.

Best regards.
Tony Clark
Application Developer
Kimball International.

---------------------------------------------------------------------------------------------------------------------------------------------------
Can someone verify that based on the next to last paragraph, automatic
redirects are not possible? However, the last paragraph points to the
fact that redirects are possible but the user agent could process it
incorrectly?

From: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.
The description for 301 redirects is as follows:

10.3.2 301 Moved Permanently

The requested resource has been assigned a new permanent URI and any
future references to this resource SHOULD use one of the returned
URIs. Clients with link editing capabilities ought to automatically re-
link references to the Request-URI to one or more of the new
references returned by the server, where possible. This response is
cacheable unless indicated otherwise.

The new permanent URI SHOULD be given by the Location field in the
response. Unless the request method was HEAD, the entity of the
response SHOULD contain a short hypertext note with a hyperlink to the
new URI(s).

If the 301 status code is received in response to a request other than
GET or HEAD, the user agent MUST NOT automatically redirect the
request unless it can be confirmed by the user, since this might
change the conditions under which the request was issued.

Note: When automatically redirecting a POST request after
receiving a 301 status code, some existing HTTP/1.0 user agents
will erroneously change it into a GET request.
---------------------------------------------------------------------------------------------------------------------------------------------------

Mar 22 '07 #1
1 4619
You should set PreAuthenticate in true and use a CredentialsCache instead a
NetworkCredentials
Take a look to the following article:
http://msdn2.microsoft.com/en-us/library/aa302390.aspx
"pmasclark" <To**********@gmail.comwrote in message
news:11*********************@b75g2000hsg.googlegro ups.com...
Hello,

I created a web site, site A, that redirects to another web site, site
B, where a simple web service is hosted. The code to call the web
service is simple.

oWS.AllowAutoRedirect = True
oWS.Credentials = New
System.Net.NetworkCredential("user","pass")
str = oWS.HelloWorld("World")

When I set the URI of the webservice to site B an http trace shows the
following.
POST 401 text/html http://siteB/redirect_test/service.asmx
POST 401 text/html http://siteB/redirect_test/service.asmx
POST 200 text/xml http://siteB/redirect_test/service.asmx

The result of the call
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/
envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"
xmlns:xsd="http://www.w3.org/2001/
XMLSchema">
<soap:Body>
<HelloWorldResponse xmlns="http://tempuri.org/">
<HelloWorldResult>Hello World</HelloWorldResult>
</HelloWorldResponse>
</soap:Body>
</soap:Envelope>

When I try to test the redirect from site A to site B, I get the
following trace.
POST 301 text/html http://siteA/redirect_test/service.asmx
http://siteB/redirect_test/service.asmx
GET 401 text/html http://siteB/redirect_test/service.asmx
GET 401 text/html http://siteB/redirect_test/service.asmx
GET 200 text/html http://siteB/redirect_test/service.asmx

The result of this call is too long to post and be meaning full, but
the content is the list of methods for the web service. I am sure
most of you are familiar with the html rendering of the .asmx page
that lists the methods.

In both traces you will see 2 lines containing a 401. You can be
assured that security is not an issue. The 401's are a result of the
handshake that takes place to ensure that the user is valid.

The issue appears to be that the initial POST is getting changed to a
GET during the redirect. Thus the post stream that contains my SOAP
envelope is stripped and not sent to the web service at the new site.

If anyone has any ideas on why this may be happening and the best
method for resolving this issue I would greatly appreciate it.

This has been tested using web services hosted on IIS 6.0 and SAP
Netweaver 2004 & SAP ECC 5.0. The calling application was written
using VB.net in Visual Studio 2005. The .net framework version is 2.0
and the useragent string for the calling application is Mozilla/4.0
(compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.42).

If you need any more information about the environment or the calls
being made. Do not hesitate to post them and I will answer them to
the best of my ability.

Best regards.
Tony Clark
Application Developer
Kimball International.

---------------------------------------------------------------------------------------------------------------------------------------------------
Can someone verify that based on the next to last paragraph, automatic
redirects are not possible? However, the last paragraph points to the
fact that redirects are possible but the user agent could process it
incorrectly?

From: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.
The description for 301 redirects is as follows:

10.3.2 301 Moved Permanently

The requested resource has been assigned a new permanent URI and any
future references to this resource SHOULD use one of the returned
URIs. Clients with link editing capabilities ought to automatically re-
link references to the Request-URI to one or more of the new
references returned by the server, where possible. This response is
cacheable unless indicated otherwise.

The new permanent URI SHOULD be given by the Location field in the
response. Unless the request method was HEAD, the entity of the
response SHOULD contain a short hypertext note with a hyperlink to the
new URI(s).

If the 301 status code is received in response to a request other than
GET or HEAD, the user agent MUST NOT automatically redirect the
request unless it can be confirmed by the user, since this might
change the conditions under which the request was issued.

Note: When automatically redirecting a POST request after
receiving a 301 status code, some existing HTTP/1.0 user agents
will erroneously change it into a GET request.
---------------------------------------------------------------------------------------------------------------------------------------------------
Mar 23 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Elijah | last post by:
My objective is to send a SOAP formatted request to a web method hosted by the M.S. TerraServer. I use the HTTP Post method. I also use the HttpWebRequest object to build the request. The problem...
4
by: Mark | last post by:
i have a very simple web servive Imports System.Web.Services <System.Web.Services.WebService(Namespace:="urn:Example1")> _ Public Class Example1 Inherits System.Web.Services.WebService
0
by: Michael Jackson | last post by:
I have attempted to mark up a service and it's methods so that it doesn't require the SOAPAction HTTP header to resolve the methods being called, this is done from first element in <SOAP-ENV:Body>...
2
by: Paul Hale | last post by:
I have a vb.net web service and client that are both working fine. If someone wanted to consume our web service using .NET, no problem. Im a little confused on how non .NET clients would use the...
16
by: MR | last post by:
my soap messages to a remote site are failing. as far as i can tell the only differences between what my SOAP message looks liek and what they want are in the SOAP envelope SInce they don't have a...
2
by: furrypop | last post by:
Hi, I'm trying to get the Perl SOAP::Lite examples to work on a Windows PC, running Apache 2.2.4. Apache is definitely serving CGI scripts, as I've tested a dummy Hello World thing. I'm also...
0
by: SpreadTooThin | last post by:
Not sure if this is the appropriate place to ask a question about soap. If you think you know a better news group to discuss this please point me there. I wrote a UPnP Internet Gateway Device...
1
Plater
by: Plater | last post by:
I have a webservice that claims the following: SOAP 1.1 The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values. POST...
2
by: Leafy | last post by:
Hi Folks! I sure hope someone can guide me on this issue. Here is the XML document I'm working from (nda.xml): <?xml version="1.0" encoding="utf-8"?> <soap:Envelope...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.