Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.11.1 available

The official documentation can be found on http://wiki.ocsinventory-ng.org. Read it before asking your question.

Can't find root element Lite.pm [closed]

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é.

closed with the note: Solved
in Core server development by (200 points)
closed by

1 Answer

0 votes
Solution find.

XML used:

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://ip/Apache/Ocsinventory/Interface" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><ns1:get_computers_V1 ><c-gensym3 xsi:type="xsd:string">&lt;REQUEST&gt;&lt;ENGINE&gt;FIRST&lt;/ENGINE&gt;&lt;ASKING_FOR&gt;META&lt;/ASKING_FOR&gt;&lt;CHECKSUM &gt;131071&lt;/CHECKSUM&gt;&lt;OFFSET&gt;0&lt;/OFFSET&gt;&lt;WANTED&gt;131071&lt;/WANTED&gt;&lt;/REQUEST&gt;</c-gensym3></ns1:get_computers_V1></soap:Body></soap:Envelope>
by (200 points)
 
Powered by Question2Answer
...