"SyntaxError: Unexpected token '<'" in XML

Hi, there! I’m newbie in Postman and I’m having an error i’m unable to solve. I’ve looked already for an answer but I haven’t found a topic that could help me.

I’m trying to launch a test in XML but I always see the same error: “SyntaxError: Unexpected token ‘<’”

This is the code I’m trying tu run:

I also tried in ‘Tests’ tab and the error stills the same.

This is what Postman console shows:

Thanks in advance for your help.

Best regards.

Hi @flight-operator-6042

I suspect that the “SyntaxError: Unexpected token ‘<’” error is referring to something that you have in your test tab, as the error message says “something went wrong running your script”.

But the 500 server error is likely not related.
Are you sure that the URL you are POSTing to is setup to receive an XML payload? (If you access that URL manually it appears to be an empty PHP file).

Hi w4dd325,

Thanks for your response.

Yes, the URL I’ve POST is supposed to receive XML. This test is part of a process for a job vacancy and all the information is exactly as I have received it. Any other guess? Or it is just simply might be something wrong with the tab? This is also my first time writting XML code.

Thanks again.

Is there any other information available? API documentation maybe?

Unfortunately, no :frowning:

I think your XML is invalid… I put it into this online validator and it says it is invalid.

Poking around and changing it to this seems to have removed the issues;

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
    <soap-env:Header>
        <Interface PartnerID="Fastbooking" Version="1.10" PartnerType="Fastbooking"/>
        <ComponentInfo User="technicaltest" Pwd="SmjnsVg4PwMnHsnE" ID="frpar27225"/>
</soap-env:Header>
<soap-env:Body RequestID="" TimeStamp="2022-10-29T16:07:35+02:00">
    <HotelPARGetRS xmlns="http://www.opentravel.org/OTA/2003/05" TimeStamp="2022-10-29T16:07:35+02:00" Target="Test" PrimaryLangID="en-us" Version="1.003">
        <Success />
        <AvailStatusMessages HotelCode="frpar27225">
            </AvailStatusMessages>
    </HotelPARGetRS>
</soap-env:Body>
</soap-env:Envelope>

It appears to pass with a 200 … (Note that I removed a few things to fix errors… and that I don’t know much about XML).

But I have no way of knowing if this actually working as expected…

Maybe it will help you?

Ok, this seems a step forward.

It seems still being something wrong with my XML code but I can investigate furthermore from here.

Thanks a lot for your help. :+1:

Best regards!