Hello,
I am trying to make a connection betweek the OCS SOAP WebService and a C# class.
My OCS server can handle SOAP request, as I can get computers data from perl (https://github.com/OCSInventory-NG/OCSInventory-Server/blob/master/binutils/soap-client.pl) and php (code here: https://stackoverflow.com/questions/36751458/enabling-ocs-inventory-webservice-interface-for-querying-assets-data).
But when I try to make it with C#, using the same XML structure, I get an error: Can't find root element in the message at /usr/local/perl5/SOAP/Lite.pm line 2857, which is:
die "Can't find ..." unless $request->match($som->enveloppe);
My XML:
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Enveloppe xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://172.23.0.189:80/Apache/Ocsinventory/Interface"xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:get_computers_V1> <param0 xsi:type="xsd:string"> <REQUEST> <ENGINE>FIRST</ENGINE> <ASKING_FOR>META</ASKING_FOR> <CHECKSUM >131071</CHECKSUM> <OFFSET>0</OFFSET> <WANTED>131071</WANTED> </REQUEST> </param0> </ns1:get_computers_V1> </SOAP-ENV:Body></SOAP-ENV:Enveloppe>
I also tried an other XML, which gives me "Denied access to method (get_computers_V1) in class (main) at /usr/local/share/perl5/SOAP/Lite.pm line 2827":
<?xml version='1.0' encoding='UTF-8'?><soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' soap:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> <soap:Body> <get_computers_V1> <REQUEST> <ENGINE>FIRST</ENGINE> <ASKING_FOR>META</ASKING_FOR> <CHECKSUM>131071</CHECKSUM> <OFFSET>0</OFFSET> <WANTED>131071</WANTED> </REQUEST> </get_computers_V1> </soap:Body></soap:Envelope>
P.S: Pour construire ma requête en C#, j'ai repris le format de trame HTTP généré par le script PHP, qui est fonctionnel. J'ai aussi repris les headers pour être sur de n'avoir rien manqué.