![]() |
XML Parsing Error: junk after document element - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: XML Parsing Error: junk after document element (/showthread.php?tid=64905) |
XML Parsing Error: junk after document element - goel.sandy86 - 04-09-2016 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. RE: XML Parsing Error: junk after document element - ciadmin - 04-10-2016 If you view the page source of your response, it says ... <?xml version="1.0" encoding="UTF-8" standalone="yes"?><OTA_ErrorRS ErrorCode="401" ErrorMessage="Authentication fields are missing! Please try again with proper input." xmlns="http://www.opentravel.org/OTA/2003/05"/> That suggests you have an authentication problem with your request. RE: XML Parsing Error: junk after document element - goel.sandy86 - 04-10-2016 (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 ... |