cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

How call OneFabric Connect WebServices function from a php script?

How call OneFabric Connect WebServices function from a php script?

Antonio_Opromol
Contributor II
HI, I'm trying to made a php script (I'm not a php programmer), that execute a web services that in my example is:
https://root:password@192.168.30.34:8443/axis/services/NACWebService/addIPToEndSystemGroup?endSystem...

If I execute this web services from a web browser, it works correctly.
Then I want to execute the same command with a php script.
I've follow the examples that are in the OneFabric Connect WebServices pdf document, and my php code is the following:

$login = 'root';
$password = 'password';

try {
$client = new SoapClient(
'https://' . urlencode($login) . ':' . urlencode($password) . '@192.168.30.34:8443/axis/services/NACWebService?wsdl',
array(
'login' => $login,
'password' => $password,
'authentication' => SOAP_AUTHENTICATION_DIGEST
)
);

$response = $client->addIPToEndSystemGroup(array("endSystemGroup" => "Distributed_IPS","ipAddress" => "192.168.10.78","description" => "ck infected","reauthenticate" => true,"removeFromOtherGroups" => true));
print_r($response);

} catch (Exception $e) {
printf("Error:sendSms: %s\n",$e->__toString());
print($client->__getLastResponse());
return false;
}

?>

The problem is that this script end with an error that is the following:
root@extrememanagement.demo.com:~/scripts$ php test3.php
Error:sendSms: SoapFault exception: [Client] looks like we got no XML document in /root/scripts/test3.php:16
Stack trace:
#0 /root/scripts/test3.php(16): SoapClient->__call('addIPToEndSyste...', Array)
#1 /root/scripts/test3.php(16): SoapClient->addIPToEndSystemGroup(Array)
#2 {main}
root@extrememanagement.demo.com:~/scripts$

I've made a search on google for this error, but seams that must be correct changing same setting on the server side....

Is there someone that know how to execute this web services from the php script?

Thanks

5 REPLIES 5

Antonio_Opromol
Contributor II
Hi, below the output of the php script if I enable the trace option in the SoapClient:
SoapFault exception: [Client] looks like we got no XML document in /root/scripts/Distributed_IPS.php:37
Stack trace:
#0 /root/scripts/Distributed_IPS.php(37): SoapClient->__call('addIPToEndSyste...', Array)
#1 /root/scripts/Distributed_IPS.php(37): SoapClient->addIPToEndSystemGroup(Array)
#2 {main}
code:
POST /services/NACWebService HTTP/1.1

Host: 192.168.30.34:8443

Connection: Keep-Alive

User-Agent: PHP-SOAP/5.5.9-1ubuntu4.21

Content-Type: text/xml; charset=utf-8

SOAPAction: "urn:addIPToEndSystemGroup"

Content-Length: 534

code:


Distributed_IPS192.168.10.78CK infectedtruetrue
/>


code:
HTTP/1.1 200 OK

Expires: 0

Expires: 0

Cache-Control: no-cache, no-store, must-revalidate

Cache-Control: no-cache, no-store, must-revalidate

X-Powered-By: JSP/2.3

Set-Cookie: JSESSIONID=i8_RbyDv3bVVInElOP9AGNfyU3ygMHXVgIWB208A.extrememanagement; path=/

Server: ExtremeManagementCenter

Pragma: no-cache

Pragma: no-cache

Date: Thu, 20 Jul 2017 13:10:28 GMT

Connection: keep-alive

Server-Version: 8.0.0

Content-Type: text/html;charset=ISO-8859-1

Content-Length: 11663



code:


            var aboutWindow = window.open ( url, "About", "top=" + cornerY + ",left=" + cornerX +&nbs
            var newWindow = window.open ( url, title, "top=" + cornerY + ",left=" + cornerX + ",
                background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #3F3F3F), color
                background-image: -moz-linear-gradient(center bottom, #3F3F3F 0%, #383838 50%, #434343 51%,&nbs
                filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3f3f3f', endColorstr='#555555',GradientType=0 )
                /* We use the inset of the box shadow to create a subtle inner gl
              S
http://www.extremenetworks.com/support/' target='_blank' title="Go T...
/>                  lt;/body>lt;/div>  


root@extrememanagement.demo.com:~/scripts$

Seems that the server return the html page for the login where asks for username and password....
GTM-P2G8KFN