For my masterthesis I had to figure out, how to use the action sequences as webservice with PHP. According to the documentation you can receive soap messages but the action sequences don't offer a WSDL that would help you building your client. I also had problems with the http basic authentication, that Pentaho uses.
After a couple hours of research and try and error, I found a solution. I doubt thats the best way to go, but at least it works. All you need is the PEAR HTTP Request class.
Here is the code:
If anonye has a better solutions to use Pentaho action sequences as a webservice in PHP is very welcome to post a comment.
I'm also looking for a good solution, how to handle the results in the SOAP message the easiest way.
After a couple hours of research and try and error, I found a solution. I doubt thats the best way to go, but at least it works. All you need is the PEAR HTTP Request class.
Here is the code:
The variable $xml_string contains the SOAP message.
//PEAR Request
require_once 'Request.php';
$response = $req->sendRequest();
if (PEAR::isError($response)) {
echo $response->getMessage();
} else {
$req->clearPostData();
$req->setURL("localhost:8080/pentaho/ServiceAction");
$req->addQueryString("solution", "bi-developers");
$req->addQueryString("path", "reporting");
$req->addQueryString("action", "Testreport.xaction");
$response2 = $req->sendRequest();
//$xml_string now has the SOAP message
$xml_string = $req->getResponseBody();
}
If anonye has a better solutions to use Pentaho action sequences as a webservice in PHP is very welcome to post a comment.
I'm also looking for a good solution, how to handle the results in the SOAP message the easiest way.
Comments
I have the bad feeling that the implementation is kind of special. They provide SOAP bindings in the WSDL, but the only way to invoke the service is by REST (so using the URL to invoke methods). I am handling with a tool called soapUI and trying to get some idea how it works.
Up to now the authentication problem can easily be solved by giving pentaho the basic authentication from HTTP by parameters in the URL:
http://localhost:8080/pentaho/content/ws-run/DatasourceService/getDataSources?userid=joe&password=password
This works for the method getDataSources of the Web Service DatasourceService.