Welcome to the new Schneider Electric Community

It's your place to connect with experts and peers, get continuous support, and share knowledge.

  • Explore the new navigation for even easier access to your community.
  • Bookmark and use our new, easy-to-remember address (community.se.com).
  • Get ready for more content and an improved experience.

Contact SchneiderCommunity.Support@se.com if you have any questions.

Close
Invite a Co-worker
Send a co-worker an invite to the Exchange portal.Just enter their email address and we’ll connect them to register. After joining, they will belong to the same company.
Send Invite Cancel
84462members
353665posts

Using php to load data from DCE

EcoStruxure IT forum

A support forum for Data Center Operation, Data Center Expert, and EcoStruxure IT product users to share knowledge on installation, configuration, and general product use.

DCIM_Support
Picard
Picard
0 Likes
1
713

Using php to load data from DCE

This question was originally posted on DCIM Support by Chu Li Wei on 2020-01-31


Hi Team ,

Our customer wanna using php to load the data (humidity sensor) from DCE ,

He tried to use the script as below and got the "bool(false)" error message ,

Does anyone have such this experience and know where the script is wrong?

Your support would be appreciated.

Best Regards 

<?php include ('xml.php'); //Data, connection, auth //$dataFromTheForm = 'value'; // request data from the form $soapUrl = "https://10.xx.xx.xx/integration/services/ISXCentralSensorService_v2_0?wsdl"; // asmx URL of WSDL $soapUser = "username"; // username $soapPassword = "password"; // password // xml post structure //$xml_post_string = $xmldata; $headers = array( "Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", "SOAPAction: http://schemas.xmlsoap.org/soap/envelope/", "Content-length: ".strlen($xmldata), ); //SOAPAction: your op URL $url = $soapUrl; // PHP cURL for https connection with auth $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword); // username and password - declared at the top of the doc curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $xmldata); // the SOAP request curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // converting $response = curl_exec($ch); curl_close($ch); print_r($response); // converting $response1 = str_replace("<soapenv:Body>","",$response); $response2 = str_replace("</soapenv:Body>","",$response1); // convertingc to XML $parser = simplexml_load_string($response2); /*foreach ($parser->xpath('//ns2:Soap_Model_SOAP_Location_Country') as $item) { print_r($item); } */ // user $parser to get your data out of XML response and to display it. var_dump($response); ?> <!doctype-html> <html lang="zh_tw"> <head> <meta content="width=device-width" charset="utf-8" /> <title>DCE</title> <script language="javascript" type="text/javascript" src="js/angular.js"></script> <script type="text/javascript"></script> </head> <body> </body> </html>           ===================================================================================   <?php $xmldata = ' <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soap:Body xmlns:ns1="http://www.apc.com/stdws/xsd/ISXCentralDevices-v2"> <ns1:getAllDevicesResponse> <ns1:ArrayOfISXCDevice> <ns2:ISXCDevice xmlns:ns2="http://www.apc.com/stdws/xsd/ISXCentral/2009/10"> <ns2:ISXCNamedElement> <ns2:ISXCElement> <ns2:ISXCElementType>DEVICE</ns2:ISXCElementType> <ns2:id>B987654_nbSNMPEnc060D85C4</ns2:id> </ns2:ISXCElement> <ns2:name>10.x.x.x</ns2:name> </ns2:ISXCNamedElement> <ns2:ISXCCommState>ONLINE</ns2:ISXCCommState> <ns2:ISXCDeviceType>ENVIRONMENT</ns2:ISXCDeviceType> <ns2:hostName>10.x.x.x</ns2:hostName> <ns2:ipAddress>10.x.x.x</ns2:ipAddress> <ns2:location/> <ns2:modelName>NetBotz Rack Monitor 200</ns2:modelName> <ns2:modelNumber/> <ns2:parentID>B987654</ns2:parentID> <ns2:serialNumber>ZA1438017179</ns2:serialNumber> <ns2:ISXCDeviceState>NONE</ns2:ISXCDeviceState> <ns2:supplemental xsi:nil="true"/> </ns2:ISXCDevice> <ns2:ISXCDevice xmlns:ns2="http://www.apc.com/stdws/xsd/ISXCentral/2009/10"> <ns2:ISXCNamedElement> <ns2:ISXCElement> <ns2:ISXCElementType>DEVICE</ns2:ISXCElementType> <ns2:id>B987654_nbCustomSensorEnc2394E22A</ns2:id> </ns2:ISXCElement> <ns2:name>計中Humidity</ns2:name> </ns2:ISXCNamedElement> <ns2:ISXCCommState>ONLINE</ns2:ISXCCommState> <ns2:ISXCDeviceType>UNKNOWN</ns2:ISXCDeviceType> <ns2:hostName/> <ns2:ipAddress/> <ns2:location/> <ns2:modelName>Virtual Device</ns2:modelName> <ns2:modelNumber/> <ns2:parentID>B987654</ns2:parentID> <ns2:serialNumber/> <ns2:ISXCDeviceState>NONE</ns2:ISXCDeviceState> <ns2:supplemental xsi:nil="true"/> </ns2:ISXCDevice> </ns1:ArrayOfISXCDevice> </ns1:getAllDevicesResponse> </soap:Body> </soap:Envelope> '; ?>

(CID:154796037)

1 Reply 1
DCIM_Support
Picard
Picard
0 Likes
0
713

🔒 Closed

This question is closed for comments. You're welcome to start a new topic if you have further comments on this issue.