You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by "Brian S Bates (bribates)" <br...@cisco.com> on 2008/07/16 16:28:07 UTC

Redirecting Web Services

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

Re: Redirecting Web Services

Posted by Samisa Abeysinghe <sa...@wso2.com>.
Axis2/C client cannot handle redirection.

Samisa...

Brian S Bates (bribates) 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
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.138 / Virus Database: 270.5.0/1555 - Release Date: 7/16/2008 6:43 AM
>   


-- 
Samisa Abeysinghe 
Director, Engineering; WSO2 Inc.

http://www.wso2.com/ - "The Open Source SOA Company"


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


Re: Redirecting Web Services

Posted by bvj <wi...@codics.com>.
I vote for basic redirection support. :-D

There are many reasons why the initial endpoint query will need to be
aliased.

If it already exists, the 'echo' sample is not configured to take advantage
of redirection.
-- 
View this message in context: http://www.nabble.com/Redirecting-Web-Services-tp18488744p18902682.html
Sent from the Axis - C++ - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


Re: Redirecting Web Services

Posted by Subra A Narayanan <as...@gmail.com>.
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
>>
>
>

RE: Redirecting Web Services

Posted by "Brian S Bates (bribates)" <br...@cisco.com>.
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&param
3=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&amp;param2=val2&
amp;param3=val3">here</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)
<br...@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



Re: Redirecting Web Services

Posted by Supun Kamburugamuva <su...@gmail.com>.
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
>