phpsoapwsdlwso2-cep

How can I get the UserAdmin service function list from wso2cep-4.1.0 with php and soap?


I'm trying to get the function list from UserAdmin admin service of wso2cep-4.1.0 with the following code:

<?php
checkWSDLfunctions();

function checkWSDLfunctions(){

    $wsdl = "https://10.69.16.44:9445/services/UserAdmin?wsdl";

    $paramtrs = array(
        'trace'    => true,
        'login'    => 'admin',
        'password' => 'admin',
        'keep_alive' => false
        );

    $client = new SoapClient($wsdl, $paramtrs);
    print_r($client->__getFunctions());
}
?>

The wsdl is available from the web browser and SoapUI loads it without any problem, I use php 5.2.9 with apache 2.0.55 and when I run the above php on, I get this:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://10.69.16.44:9445/services/UserAdmin?wsdl' : Start tag expected, '<' not found in C:\Program Files\Apache Group\Apache2\htdocs\wso2\checkFunctions.php:15 Stack trace: #0 C:\Program Files\Apache Group\Apache2\htdocs\wso2\checkFunctions.php(15): SoapClient->SoapClient('https://10.69.1...', Array) #1 C:\Program Files\Apache Group\Apache2\htdocs\wso2\checkFunctions.php(2): checkWSDLfunctions() #2 {main} thrown in C:\Program Files\Apache Group\Apache2\htdocs\wso2\checkFunctions.php on line 15

I checked other questions and openssl is enabled. I also tried the exact same php with the wsdl from wso2cep 3.1.0 and it works..

What do you suggest to try next?

UPDATE: I've found a workaround for the above mentioned issue by adding the wsdl from the link to a file wso2.wsdl, and now the __getFunctions() function returns the list of functions from the wsdl.

But still, when I want to call a simple function from the wsdl, let's say listUsers, I get this error:

Fatal error: Uncaught SoapFault exception: [HTTP] Error Fetching http headers in C:\Program Files\Apache Group\Apache2\htdocs\CARE.wso2\checkFunctions.php:18 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'https://10.69.1...', 'urn:listUsers', 1, 0) #1 [internal function]: SoapClient->__call('listUsers', Array) #2 C:\Program Files\Apache Group\Apache2\htdocs\wso2\checkFunctions.php(18): SoapClient->listUsers() #3 C:\Program Files\Apache Group\Apache2\htdocs\wso2\checkFunctions.php(2): checkWSDLfunctions() #4 {main} thrown in C:\Program Files\Apache Group\Apache2\htdocs\wso2\checkFunctions.php on line 18

The new php code is:

<?php
checkWSDLfunctions();

function checkWSDLfunctions(){

    //$wsdl = "https://10.69.16.44:9445/services/UserAdmin?wsdl";
    $wsdl = "wso2.wsdl";

    $paramtrs = array(
        'trace'    => true,
        'login'    => 'admin',
        'password' => 'admin',
        'keep_alive' => false
        );

    $client = new SoapClient($wsdl, $paramtrs);
    //print_r($client->__getFunctions());
    print_r($client->listUsers());
}
?>

I've tried the default socket timeout fix suggested on the internet but, nothing..maybe I've missed some setting in wso2cep but I don't know what else to change there..or what do you think might be the problem here?


Solution

  • After lots of retries, the only solution that I found was to upgrade the Apache server and PHP. I've upgraded both to Apache 2.4.20 and PHP 5.4.45 and now everything works fine.

    I didn't found the cause, but my assumption is that there is an incompatibility between the php soap or openssl libraries and the new CEP version.

    Hope it helps.

    If anybody else has a better explanation, would be great.

    Thank you.