0

I'm trying to call Amadeus Services with importing local wsdl file and connecting that wsdl to soap client using soap npm. My client is successfully connecting but request body is adding unexpected tags automatically.

Here i'm adding my sample code and error. if anyone has any solution for this please help me.

Sample Code:

const path = process.cwd();
import * as soap from 'soap';

const filePath = `${path}/Hotel_Content.wsdl`;


const inputBody = {
    HotelDescriptiveInfos: {
        HotelDescriptiveInfo: {
            '@HotelCode': 'RTNYCNOV',
        },
    },
};

function main() {
    soap.createClient(filePath, (err, client) => {
        if (err) {
            console.log(err);
            return;
        }
        client.Hotel_DescriptiveInfo(inputBody, (err: any, data: any) => {
           
            if (err) {
                console.log("err ====", err)
            }
            console.log("data ==", data)
        })
    });
}
main()

Expected SOAP BODY From Above Request

<soap:Body>
 <OTA_HotelDescriptiveInfoRQ EchoToken="PartialWithParsing" Version="6.001" PrimaryLangID="en" >
            <HotelDescriptiveInfos>
                <HotelDescriptiveInfo HotelCode="RTNYCNOV" >
                </HotelDescriptiveInfo>
            </HotelDescriptiveInfos>
        </OTA_HotelDescriptiveInfoRQ>
</soap:Body>

SOAP Body which is generating while calling above SOAP client.Hotel_DescriptiveInfo.

    <soap:Body>
        <ota_2003_05:OTA_HotelDescriptiveInfoRQ
            xmlns:ota_2003_05="http://www.opentravel.org/OTA/2003/05"
            xmlns="http://www.opentravel.org/OTA/2003/05">
            <ota_2003_05:HotelDescriptiveInfos>
                <ota_2003_05:HotelDescriptiveInfo>
                    <ota_2003_05: @HotelCode>RTNYCNOV</ota_2003_05:@HotelCode>
                </ota_2003_05:HotelDescriptiveInfo>
            </ota_2003_05:HotelDescriptiveInfos>
        </ota_2003_05:OTA_HotelDescriptiveInfoRQ>
    </soap:Body>

Can anyone please tell me why this unwanted ota_2003_05 is adding ?

radhika thakkar
  • 149
  • 2
  • 9