chaillouvincent
chaillouvincent

Reputation: 197

Redirect Soap request with apache

Excuse my for my English, I’m French.

I have a question about soap request redirection with apache (on wampserver).

I have one file server.php on localhost:3511

vhost :

<VirtualHost *:3511>
DocumentRoot "C:/wamp/www/test/server.php"
ServerName test.local
</VirtualHost>

server.php :

<?php
ini_set('soap.wsdl_cache_enabled', 0);
require_once('Test.php');

$wsdl = "CurrencyConvertor.asmx.wsdl";
$server = new SoapServer($wsdl);
$server->setClass("Test");
$server->handle();
?>

My class Test.php :

<?php
class Test
{
    public function ConversionRate($p_conversion_rate_request)
    {   

        return array('ConversionRateResult' => 0);
    }
}

With SoapUi, I have this result when I call

http://localhost:3511


<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:ns1="http://www.webserviceX.NET/">
    <SOAP-ENV:Body>
      <ns1:ConversionRateResponse>
         <ns1:ConversionRateResult>0</ns1:ConversionRateResult>
      </ns1:ConversionRateResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

So it works!

Now I want to redirect request to

http://localhost/test2/server.php 

when soapui call localhost:3511. I have the same project in localhost/test2/ but ConversionRateResult returns 1 instead of 0.

I have made an htaccess in localhost/test/ with this code :

Redirect / http://localhost/test2/server.php

When I test this url localhost:3511 in a web browser, test2/server.php is called. It works but when I call localhost:3511 with SoapUi, nothing was returned.

Can you explain me what’s wrong with my htaccess? May be I must add something?

Upvotes: 2

Views: 2823

Answers (1)

Simone Nigro
Simone Nigro

Reputation: 4887

Use Proxy flag [P]:

RewriteEngine on
RewriteRule  /  http://localhost/test2/server.php  [NC, P] 

mod_proxy: http://httpd.apache.org/docs/current/mod/mod_proxy.htm

flag: http://httpd.apache.org/docs/current/rewrite/proxy.html

Upvotes: 1

Related Questions