NicTool API - get_zone_records XML error

Started by jeffp, April 28, 2014, 03:45:50 PM

Previous topic - Next topic

jeffp

Hello,

I am attempting to use the NicTool API to get a list of zone records using the "get_zone_records" method as described at http://www.nictool.com/docs/api/api.htm#GETZONERECORDSFUNC. However, the N_* parameters are causing me some trouble as they seem to generate invalid XML tags (as per http://www.w3.org/TR/2000/REC-xml-20001006#sec-starttags).  I am able to use any function that does not employ the N_* format, e.g. login, validate_session, get_group_zones, etc.; this leads me to believe the issue is not the same as in marax's thread at https://www.tnpi.net/support/forums/index.php/topic,1047.0.html. After looking through the NicTool source on github, it seems the N_* format is required in order to properly include the search queries (see  NicToolServer::get_advanced_search_conditions()).

Am I generating the XML query incorrectly or is this a bug with the API? Any advice on solving this issue would be greatly appreciated.



Request:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://NICToolServer-api/NicToolServer/SOAP" 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_zone_records>
            <l13e86451a3d8f8f58ce74a227c83dac xsi:type="SOAP-ENC:Struct">
                <nt_zone_id xsi:type="xsd:int">1234</nt_zone_id>
                <page xsi:nil="true"/>
                <start xsi:nil="true"/>
                <limit xsi:nil="true"/>
                <Sort xsi:nil="true"/>
                <search_query xsi:type="xsd:string">address = '192'</search_query>
                <Search xsi:type="xsd:string">Search</Search>
                <quick_search xsi:nil="true"/>
                <search_value xsi:nil="true"/>
                <nt_user_session xsi:type="xsd:string">user_session_removed</nt_user_session>
                <nt_protocol_version xsi:type="xsd:string">1.0</nt_protocol_version>
                <1_option xsi:type="xsd:string">equals</1_option>
                <1_value xsi:type="xsd:string">192.168.1.1</1_value>
                <1_field xsi:type="xsd:string">address</1_field>
            </l13e86451a3d8f8f58ce74a227c83dac>
        </ns1:get_zone_records>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Response:

<?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>
    <soap:Fault>
        <faultcode>soap:Client</faultcode>
        <faultstring>Application failed during request deserialization: not well-formed (invalid token) at line 2, column 916, byte 955 at /usr/local/lib/perl5/site_perl/5.8.8/mach/XML/Parser.pm line 187</faultstring>
    </soap:Fault>
</soap:Body>
</soap:Envelope>

matt

I believe that's a "bug," but it was a necessary one at the time NicTool was written, as there was no other way to do that in SOAP::Lite.  (Maybe that's true. It's dredged up from very, very distant memories).

There is no intent to fix this issue, as the next version of the NicTool API will use JSON for the serialization.

jeffp

Thank you. I will be looking forward to the next version of the API.