Welcome Guest, Not a member yet? Register   Sign In
XML Parsing Error: junk after document element
#1

i am using xmlrpc library to send an xml request getting
XML Parsing Error: junk after document element
Location: http://cm.bookingfaculty.com/sandeep
Line Number 12, Column 7:


URL:http://cm.bookingfaculty.com/sandeep

my code is as below:

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Sandeep extends CI_Controller {

    /**
     * Index Page for this controller.
     *
     * Maps to the following URL
     *         http://example.com/index.php/welcome
     *    - or -
     *         http://example.com/index.php/welcome/index
     *    - or -
     * Since this controller is set as the default controller in
     * config/routes.php, it's displayed at http://example.com/
     *
     * So any other public methods not prefixed with an underscore will
     * map to /index.php/welcome/<method_name>
     * @see https://codeigniter.com/user_guide/general/urls.html
     */
    public function index()
    {
        $this->load->library('xmlrpc');

$this->load->helper('xml');
$this->xmlrpc->server('http://stage-api.travelguru.com/jagat-service-2.0/detail/hotels?format=xml', 80);
$this->xmlrpc->method('POST');
$this->output->set_content_type('text/xml');


$request = ['OTA_HotelAvailRQ' => array('xmlns' => 'http://www.opentravel.org/OTA/2003/05',
        'POS' => array(
            'Source' => array(
                'RequestorID' => array('MessagePassword' => '****', 'ID' => '****', 'type' => 'CHM'),
            ),
        ),
        'AvailRequestSegments' => array(
            'AvailRequestSegment' => array(
                'HotelSearchCriteria' => array(
                    'Criterion' => array(
                            'HotelRef' => array('HotelCode'=> '00008164'),
                            'StayDateRange' => array('Start' => '2016-03-01', 'END' => '2016-04-29'),
                            ),
                        ),
                    ),
                            ),
                            ),
                            ];
 

$this->xmlrpc->set_debug(TRUE);

if ( ! $this->xmlrpc->send_request())
        {
            echo $this->xmlrpc->display_error();
        }
        else
        {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
}
    }



Need XML schema like below:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <OTA_HotelAvailRQ xmlns="http://www.opentravel.org/OTA/2003/05">
        <POS>
            <Source>
<RequestorID MessagePassword= "****" ID= "*****" Type="CHM"/>
</Source>
</POS>
<AvailRequestSegments>
<AvailRequestSegment>
<HotelSearchCriteria>
<Criterion>
<HotelRef HotelCode="00008164"/>
<StayDateRange Start="2016-04-01" End="2016-04-12">
</StayDateRange>
</Criterion>
</HotelSearchCriteria>
</AvailRequestSegment>
</AvailRequestSegments>
</OTA_HotelAvailRQ>



Kindly help me on this issue.
Reply
#2

If you view the page source of your response, it says ...
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;&lt;OTA_ErrorRS ErrorCode=&quot;401&quot; ErrorMessage=&quot;Authentication fields are missing! Please try again with proper input.&quot; xmlns=&quot;http://www.opentravel.org/OTA/2003/05&quot;/&gt;

That suggests you have an authentication problem with your request.
Reply
#3

(04-10-2016, 01:19 AM)authentication problem occur due to xml parser error submitted to the server. As per server requirement we have to submit authentication fields in the xml.ciadmin Wrote: If you view the page source of your response, it says ...
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;&lt;OTA_ErrorRS ErrorCode=&quot;401&quot; ErrorMessage=&quot;Authentication fields are missing! Please try again with proper input.&quot; xmlns=&quot;http://www.opentravel.org/OTA/2003/05&quot;/&gt;

That suggests you have an authentication problem with your request.
Thanks & Regards
Sandeep Goel
Reply




Theme © iAndrew 2016 - Forum software by © MyBB