【问题标题】:Redirect Soap request with apache使用 apache 重定向 Soap 请求
【发布时间】:2014-01-19 12:44:51
【问题描述】:

请原谅我的英语,我是法国人。

我有一个关于使用 apache(在 wampserver 上)进行肥皂请求重定向的问题。

我在localhost:3511 上有一个文件server.php

虚拟主机:

<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();
?>

我的班级Test.php:

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

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

使用 SoapUi,我在调用时会得到这个结果

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>

所以它起作用了!

现在我想将请求重定向到

http://localhost/test2/server.php 

当 soapui 调用 localhost:3511 时。 我在localhost/test2/ 有相同的项目,但ConversionRateResult 返回1 而不是0

我已经使用此代码在localhost/test/ 中创建了一个 htaccess:

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

当我在网络浏览器中测试此 URL localhost:3511 时,会调用 test2/server.php。它有效,但是当我使用 SoapUi 调用 localhost:3511 时,没有返回任何内容。

你能解释一下我的 htaccess 出了什么问题吗? 可能我必须添加一些东西吗?

【问题讨论】:

    标签: php apache redirect soap soapui


    【解决方案1】:

    使用代理标志[P]:

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

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

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

    【讨论】:

      猜你喜欢
      • 2011-11-01
      • 2020-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多