Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trailing solidus not allowed on element

Tags:

php

xml

sabre

I am developing web application in php using soap api. I have the xml format as shown below to send the request to the api but I get the error like Trailing solidus not allowed on element companyname while viewing the xml in postman.

<OTA_AirLowFareSearchRQ xmlns="http://www.opentravel.org/OTA/2003/05" ResponseType="OTA" ResponseVersion="1.9.2" Version="1.9.2" AvailableFlightsOnly="true">
    <POS>
        <Source PseudoCityCode="PCC">
            <RequestorID ID="1" Type="1">
                <CompanyName Code="TN" />                            
            </RequestorID>                        
        </Source>                   

    </POS>
    <OriginDestinationInformation RPH="1">
        <DepartureDateTime>2016-03-15T11:00:00</DepartureDateTime>
        <OriginLocation LocationCode="KTM"/>
        <DestinationLocation LocationCode="DEL"/>
        <TPA_Extensions>
            <SegmentType Code="O"/>                        
        </TPA_Extensions>

    </OriginDestinationInformation>
    <TravelPreferences ValidInterlineTicket="true">
        <CabinPref PreferLevel="Preferred" Cabin="Y" />
        <TPA_Extensions>
            <TripType Value="Return" />
            <LongConnectTime Min="780" Max="1200" Enable="true" />
            <ExcludeCallDirectCarriers Enabled="true" />                        
        </TPA_Extensions>

    </TravelPreferences>
    <TravelerInfoSummary>
        <SeatsRequested>3</SeatsRequested>
        <AirTravelerAvail>
            <PassengerTypeQuantity Code="ADT" Quantity="2" />
            <PassengerTypeQuantity Code="CHD" Quantity="1" />                        
        </AirTravelerAvail>                    
    </TravelerInfoSummary>
    <TPA_Extensions>
        <IntelliSellTransaction>
            <RequestType Name="50ITINS" />                        
        </IntelliSellTransaction>                    
    </TPA_Extensions>                
</OTA_AirLowFareSearchRQ> 

I had googled the error but not found any solution. I also cannot determine what the error say so I need some help.

Screenshot: enter image description here

When I hover to the cross sign in line 5 I get the error like Trailing solidus not allowed on element companyname and when I hover to the line 6 I get error like Unexpected end tag (requestorid) ignored. Here I cannot determined what the error says. I think it's in the correct xml format.

like image 691
Kiran Subedi Avatar asked Oct 19 '25 14:10

Kiran Subedi


2 Answers

I had this happen today, but all I needed to do was switch the response viewer type in Postman from "HTML" to "XML" and the errors went away. This probably happened since the server responding did not appropriately set the Content-Type header - it came in as text/html for me instead of text/xml.

like image 193
jocull Avatar answered Oct 22 '25 04:10

jocull


Actually this has connection to self closing tag like <CompanyName Code="TN" />.

Just replace this with <CompanyName Code="TN"></CompanyName> and the error goes away.

Hope this helps.

like image 25
mayank1513 Avatar answered Oct 22 '25 04:10

mayank1513



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!