数日前、私は自分の Web サービスに取り組み始めました。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。私の英語でごめんなさい、それは私の母国語ではありません