axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Subra A Narayanan" <aswat...@gmail.com>
Subject Re: Redirecting Web Services
Date Mon, 21 Jul 2008 18:36:41 GMT
Brian,

Basically this is what is happening here:

1. YourClient => Initial Request =>1st Server
2. 1st Server => 301 Response => YourClient
3. YouClient is supposed to interpret the 301 response and resend the
request to the 2nd Server. But since ur client is written in Axis2c which
doesn't support redirection, ur client doesn't know what to do with the
response and doesn't take any further action.


Your browser on the other hand, knows how to interpret the 301 response and
goes after the new location (2nd Server).


So the bottom line is, ur server is behaving correctly. Try writing a client
in some other language like c# or java and I am sure this issue will go
away.

Subra

On Mon, Jul 21, 2008 at 1:51 PM, Brian S Bates (bribates) <
bribates@cisco.com> wrote:

>  Hi,
>
> When I use TCPMon to listen in on what's going on, this is what I get when
> using an Axis2C client:
>
> In the top box of TCPMon:
> GET /dp/go?param1=val1&param2=val2&param3=val3 HTTP/1.1
> User-Agent: Axis2C/1.4.0
> Host: 127.0.0.1:8080
>
> In the bottom box of TCPMon:
> HTTP/1.1 301 Moved Permanently
> Date: Mon, 21 Jul 2008 17:42:49 GMT
> Server: Apache/2.2.9 (Win32) Axis2C/1.4.0
> Location:
> http://127.0.0.1:8080/axis2/restprinter/go?param1=val1&param2=val2&param3=val3
> Content-Length: 294
> Content-Type: text/html; charset=iso-8859-1
>
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
>    <html>
>       <head>
>          <title>301 Moved Permanently</title>
>       </head>
>       <body>
>          <h1>Moved Permanently</h1>
>          <p>The document has moved
>             <a href="
> http://127.0.0.1:8080/axis2/restprinter/go?param1=val1&amp;param2=val2&amp;param3=val3">here</a<http://127.0.0.1:8080/axis2/restprinter/go?param1=val1&param2=val2&param3=val3%22%3Ehere%3C/a>
> >.
>          </p>
>       </body>
>    </html>
> On the other hand, when I use the browser (which works):
>
> In the top box of TCPMon:
> GET /axis2/restprinter/go/vala/valb?param3=valc HTTP/1.1
> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
> application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword,
> application/x-shockwave-flash, application/x-silverlight, */*
> Accept-Language: en-us
> Accept-Encoding: gzip, deflate
> User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
> CLR 1.1.4322; .NET CLR 2.0.50727)
> Host: 127.0.0.1:8080
> Connection: Keep-Alive
>
> In the bottom box of TCPMon:
> HTTP/1.1 200 OK
> Date: Mon, 21 Jul 2008 17:49:11 GMT
> Server: Apache/2.2.9 (Win32) Axis2C/1.4.0
> Content-Length: 26
> Keep-Alive: timeout=5, max=100
> Connection: Keep-Alive
> Content-Type: text/xml
>
> <response>hello</response>
>
> If there is anything else I can provide that you think would help, please
> feel free to let me know.
> Thanks,
> Brian
>
>  ------------------------------
> *From:* Supun Kamburugamuva [mailto:supun06@gmail.com]
> *Sent:* Thursday, July 17, 2008 1:47 AM
> *To:* Apache AXIS C User List
> *Subject:* Re: Redirecting Web Services
>
>  Hi brian,
>
> Can you please send us the redirected message for the Axis2/C client. It
> seems that their is something wrong in the XML. You can capture the message
> using a tool like tcpmon http://ws.apache.org/commons/tcpmon/.
>
> Supun..
>
> On Wed, Jul 16, 2008 at 7:58 PM, Brian S Bates (bribates) <
> bribates@cisco.com> wrote:
>
>>  Hi,
>>
>> I am working on a project using REST with Axis2C, and have encountered a
>> problem.  I would like to take the URI of the REST request and redirect it
>> somewhere else.
>>
>> For example, if the user enters:
>> http://server:port/loc1/service?param1=value1, I want this to be directed
>> to http://server:port/newlocation/service?param1=value1
>>
>> Currently, I am using the mod_axis2.dll module with Apache 2.2.9.  In my
>> Apache httpd.conf file, I have added the following lines (at the end):
>>
>> # Redirect requests to the axis2 directory
>> RewriteEngine on
>> RewriteRule ^/dp(.*) /axis2/restprinter$1 [R=permanent]
>>
>> # Axis2 C Configuration
>> LoadModule axis2_module modules/mod_axis2.dll
>> Axis2RepoPath C:/axis2c
>> Axis2LogFile  logs/axis2.log
>> Axis2LogLevel error
>> Axis2ServiceURLPrefix /axis2
>> Axis2MaxLogFileSize 100
>> <Location />
>>     SetHandler axis2_module
>> </Location>
>>
>> ...Basically, rerouting anything with a URI that begins with /dp to
>> /axis2/restprinter (the first two lines).
>>
>> Using this configuration in a web browser works.  That is to say, the
>> redirection happens and a valid XML response is returned from my service.
>> However, using an Axis2C client fails.  Looking over the log file for the
>> client, it seems that the redirection is not happening?  Here is an excerpt:
>>
>> [Tue Jul 15 16:05:10 2008] [info]  Starting addressing out handler
>> [Tue Jul 15 16:05:10 2008] [debug]
>> ..\..\src\modules\mod_addr\addr_out_handler.c(133) No action present. Stop
>> processing addressing
>> [Tue Jul 15 16:05:10 2008] [debug]
>> ..\..\src\core\transport\http\sender\http_transport_sender.c(246) ctx_epr:
>> http://localhost:80/dp/go
>> [Tue Jul 15 16:05:10 2008] [debug]
>> ..\..\src\core\transport\http\sender\http_transport_sender.c(768) using
>> axis2 native http sender.
>> [Tue Jul 15 16:05:10 2008] [debug]
>> ..\..\src\core\transport\http\sender\http_transport_sender.c(785) OP name
>> axutil_qname_get_localpart = http://www.w3.org/2004/08/wsdl/out-in
>> [Tue Jul 15 16:05:10 2008] [error]
>> ..\..\axiom\src\parser\libxml2\libxml2_reader_wrapper.c(951) Space required
>> after the Public Identifier
>>  -- SEVERITY_ERROR
>> [Tue Jul 15 16:05:10 2008] [error]
>> ..\..\axiom\src\parser\libxml2\libxml2_reader_wrapper.c(951) SystemLiteral "
>> or ' expected
>>  -- SEVERITY_ERROR
>> [Tue Jul 15 16:05:10 2008] [error]
>> ..\..\axiom\src\parser\libxml2\libxml2_reader_wrapper.c(951) SYSTEM or
>> PUBLIC, the URI is missing
>>  -- SEVERITY_ERROR
>> [Tue Jul 15 16:05:10 2008] [error]
>> ..\..\axiom\src\parser\libxml2\libxml2_reader_wrapper.c(462)  error occured
>> in reading xml stream
>> [Tue Jul 15 16:05:10 2008] [debug] ..\..\src\core\engine\phase.c(210)
>> Invoke the handler request_uri_based_dispatcher within the phase Transport
>> [Tue Jul 15 16:05:10 2008] [debug] ..\..\src\core\engine\phase.c(210)
>> Invoke the handler AddressingInHandler within the phase Transport
>> [Tue Jul 15 16:05:10 2008] [info]  Starting addressing in handler
>> [Tue Jul 15 16:05:10 2008] [info]
>> ..\..\src\modules\mod_addr\addr_in_handler.c
>> [Tue Jul 15 16:05:10 2008] [debug] ..\..\src\core\engine\phase.c(210)
>> Invoke the handler addressing_based_dispatcher within the phase Transport
>> [Tue Jul 15 16:05:10 2008] [debug] ..\..\src\core\engine\phase.c(210)
>> Invoke the handler rest_dispatcher within the phase Dispatch
>> [Tue Jul 15 16:05:10 2008] [debug] ..\..\src\core\engine\rest_disp.c(113)
>> Checking for service using target endpoint address :
>> http://localhost:80/dp/go
>> [Tue Jul 15 16:05:10 2008] [debug] ..\..\src\core\engine\phase.c(210)
>> Invoke the handler soap_message_body_based_dispatcher within the phase
>> Dispatch
>> [Tue Jul 15 16:05:10 2008] [debug] ..\..\src\core\engine\phase.c(210)
>> Invoke the handler soap_action_based_dispatcher within the phase Dispatch
>> [Tue Jul 15 16:05:10 2008] [debug] ..\..\src\core\engine\phase.c(210)
>> Invoke the handler dispatch_post_conditions_evaluator within the phase
>> PostDispatch
>> [Tue Jul 15 16:05:10 2008] [debug] ..\..\src\core\engine\phase.c(210)
>> Invoke the handler context_handler within the phase PostDispatch
>> [Tue Jul 15 16:05:10 2008] [error] restprinter.c(92) Stub invoke FAILED:
>> Error code: 2 :: NULL parameter was passed when a non NULL parameter was
>> expected
>>
>> To make a long story short, is it possible for the Axis2C client to handle
>> such a redirect?  Also, if it makes a difference, I am testing both the
>> client and server on the same machine.
>>
>> Thanks,
>> Brian
>>
>
>

Mime
View raw message