473,701 Members | 2,728 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.AllowAutoRe direct = True
oWS.Credentials = New
System.Net.Netw orkCredential(" 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:Envelop e xmlns:soap="htt p://schemas.xmlsoap .org/soap/
envelope/"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-
instance"
xmlns:xsd="http ://www.w3.org/2001/
XMLSchema">
<soap:Body>
<HelloWorldResp onse xmlns="http://tempuri.org/">
<HelloWorldResu lt>Hello World</HelloWorldResul t>
</HelloWorldRespo nse>
</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 4786
You should set PreAuthenticate in true and use a CredentialsCach e instead a
NetworkCredenti als
Take a look to the following article:
http://msdn2.microsoft.com/en-us/library/aa302390.aspx
"pmasclark" <To**********@g mail.comwrote in message
news:11******** *************@b 75g2000hsg.goog legroups.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.AllowAutoRe direct = True
oWS.Credentials = New
System.Net.Netw orkCredential(" 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:Envelop e xmlns:soap="htt p://schemas.xmlsoap .org/soap/
envelope/"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-
instance"
xmlns:xsd="http ://www.w3.org/2001/
XMLSchema">
<soap:Body>
<HelloWorldResp onse xmlns="http://tempuri.org/">
<HelloWorldResu lt>Hello World</HelloWorldResul t>
</HelloWorldRespo nse>
</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
1322
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 is that I get the wrong answer. In this case I get incorrect coordinates. I can use different inputs and get the same result. I suspect I might be formatting the data types incorrectly. Here is the SOAP Envelope <?xml version="1.0"...
4
7881
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
2289
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> and the request and responses are not suffixed with Request and Response. Is there some more I could do with the attributes on the class that defines the WS and on the methods. the code for the WS etc is below. This I can get to work POST...
2
15446
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 web service though. Question 1: Does Java etc have some kind of SOAP tool kit developers could use to access our web service? Question 2: .NET conveniently shows what the serialized xml looks like and what the web service expects (Please see...
16
3183
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 wsdl doc i created a localhost site based on their DTD documetns. How do I configure my site (and client proxy) to match thier envelope? Any help would be greatly appreciated thanks
2
6768
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 definitely getting a hit when I use a browser to get to my hibye.cgi server (well, a blank page rather than a 404). However, when I run my hibye.pl client, I receive a 503 Service Unavailable at H:\scripts\hibye.pl line 25. It works when I...
0
2939
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 Class in C++ with raw tcp/ip and udp calls. I want to now port that code to a high level interpreter that supplies
1
5963
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 /testdb/UnitReporting.asmx HTTP/1.1 Host: localhost Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://mylocation/UpdateInformation"
2
2297
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 xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:loc="http://localhost:2680/"> <soap:Header/> <soap:Body> <loc:CreateNDA> <loc:docname>rem12345</loc:docname>
0
8649
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9232
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9084
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8936
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7827
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6573
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4665
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3104
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.