【问题标题】:Unable to deploy WSF/PHP WebService on WSO2 ESB无法在 WSO2 ESB 上部署 WSF/PHP WebService
【发布时间】:2012-12-14 11:57:34
【问题描述】:

几天前,我开始开发自己的 WebServices。我决定使用 WSO2 WSF/PHP 框架,并根据http://wso2.org/project/wsf/php/2.0.0/docs/manual.html 创建了我的第一个 helloService。代码如下:

function greet($message) {
    $responsePayloadString = <<<XML
        <greetResponse>Hello Client!</greetResponse>
    XML;

    $returnMessage = new WSMessage($responsePayloadString);
    return $returnMessage;
}
$service = new WSService(array("operations" => array("greet")));
$service->reply();

我已经将它部署在我的服务器上并尝试使用简单的 helloClient(在 wso2 wsf/php 手册中描述)和 SoapUI 来调用它 - 一切正常。 现在我会尝试在我的 WSO2 ESB 上部署它,所以我定义了这样的新代理服务:

<proxy name="helloService" transports="https http" startOnLoad="true" trace="disable">
    <target endpoint="helloService">
        <inSequence>
            <log level="full"/>
        </inSequence>
        <outSequence>
            <filter xpath="get-property('FAULT')">
                <then>
                    <log level="full" category="WARN" separator=",">
                        <property name="message" value="SOAP Fault detected"/>
                    </log>
                </then>
                <else/>
            </filter>
            <send/>
        </outSequence>
        <faultSequence>
            <log level="full">
                <property name="MESSAGE" value="Executing default 'fault' sequence"/>
                <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
                <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
            </log>
            <drop/>
        </faultSequence>
    </target>
    <publishWSDL uri="http://myAPIAddress/helloService.php?wsdl"/>
</proxy>
<endpoint name="helloService">
    <address uri="http://myAPIAddress/helloService.php" format="soap11"/>
</endpoint>

新服务在 ESB 管理控制台的“已部署服务”列表中可见,我可以从 myESBaddress:8280/services/helloService?wsdl 获取 WSDL,并且在 myESBaddress:8280/services 列表中一切正常。但是,当我想使用“试用此服务”选项时,会出现超时错误。我尝试使用 SoapUI 调用我的 WS - 对端点 myESBaddress:8280/services/helloService 的请求看起来像(当我将它发送到 myAPIAddress/helloService.php 时,相同的请求工作正常)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.wso2.org/php/xsd">
   <soapenv:Header/>
   <soapenv:Body>
      <greet>asdfasdfas</greet>
   </soapenv:Body>
</soapenv:Envelope>

不幸的是,作为回应,我有一个错误:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <soapenv:Fault>
            <faultcode>411</faultcode>
            <faultstring>Unexpected response received. HTTP response code : 411 HTTP status : Length Required exception : First Element must contain the local name, Envelope , but found html</faultstring>
            <detail>Unexpected response received. HTTP response code : 411 HTTP status : Length Required exception : First Element must contain the local name, Envelope , but found html</detail>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>

我做错了什么?我有感觉,这是完全愚蠢和明显的事情,所以如果这是新手问题,请原谅我,但经过几天的挖掘解决方案后,我真的很绝望。

PS。对不起,我的英语不是我的母语

【问题讨论】:

    标签: php soapui esb wso2esb wsh


    【解决方案1】:

    终于,我开始工作了!该问题是由 HTTP 版本引起的。这是解决方案:

    ...
    <inSequence>
        <log level="full"/>
        <property name="FORCE_HTTP_1.0" value="true" scope="axis2" type="BOOLEAN"/>
    </inSequence>
    ...
    

    希望,有一天它会对某人有所帮助。

    【讨论】:

      【解决方案2】:

      你的 php 服务是什么类型的?

      How to Invoke External PHP Web Services with WSO2 ESB

      我和你有同样的问题,但是我已经将我的服务器更改为 Apache,问题已经解决了。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-12-27
        • 2016-02-13
        • 2022-09-29
        • 1970-01-01
        相关资源
        最近更新 更多