few days ago I started to work on my own WebServices. I decided to use WSO2 WSF/PHP framework and according to http://wso2.org/project/wsf/php/2.0.0/docs/manual.html created my first helloService. Here's code:
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();
I've deployed it on my server and tried to call it using simple helloClient (described in wso2 wsf/php manual) and SoapUI - everything works fine. Now I would try to deploy it on my WSO2 ESB, so I've defined new proxy service like this:
<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>
New service is visible on "Deployed services" list in ESB management console, I can get WSDL from myESBaddress:8280/services/helloService?wsdl and everything looks fine on the myESBaddress:8280/services list. But, when I want to use "Try this service" option, there's timeout error. I tried to call my WS using SoapUI - the request to endpoint myESBaddress:8280/services/helloService looks like (the same request worked fine when I sent it to 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>
Unfortunately, as a response, I've got a fault:
<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>
What did I wrong? I have feeling, that it's something completely stupid and obvious, so forgive me if it's newbie question but after few days of digging for solution I'm really desperate.
PS. Sorry for my english, it's not my mother tongue
Finally, I got it to work! The problem was caused by the version of HTTP. Here's the solution:
...
<inSequence>
<log level="full"/>
<property name="FORCE_HTTP_1.0" value="true" scope="axis2" type="BOOLEAN"/>
</inSequence>
...
I hope, it will be someday helpful for someone.