3

I have spent hours figuring this issue out, but still haven't able to resolve this issue. If I send a request to the API with the same request body using Postman, it works just fine, but in the code it's giving me 'Invalid XML' error.

Anyone has any idea what am I doing wrong here?

Code Snippet

const host = "https://staging.familytreedna.com/ftdnawebservice/lifelinehometest.asmx?wsdl";

Soap.createClient(host, function(err, client){

    client.on('soapError', function(err, eid){
        console.log("REQUEST ERROR", err);
    });
    client.on('request', function(xml, eid){
        console.log("REQUEST SOAP", xml);
    });
    const _requestParam = {......};

    var result1 = client.LifelineHomeTestWS.LifelineHomeTestWSSoap.Create({
        message: _requestParam,
    });
});

Request Body

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://tempuri.org/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/">
    <soap:Body>
        <Create xmlns="http://tempuri.org/">
            <message>
                <Authentication>
                    <UserName>USERNAME</UserName>
                    <Password>PASSWORD</Password>
                </Authentication>
                <Order>
                    <FtdnaOrderId>LH100031</FtdnaOrderId>
                    <RsOrderId>494648361009</RsOrderId>
                    <FirstName>Saud</FirstName>
                    <MiddleName></MiddleName>
                    <LastName>S.</LastName>
                    <FamilySurname>S.</FamilySurname>
                    <Address>abc </Address>
                    <City>Austin</City>
                    <State>TX</State>
                    <Zip>78704</Zip>
                    <Country>USA</Country>
                    <PhoneNumber>1341324123</PhoneNumber>
                    <CustomerEmail>mail@email.com</CustomerEmail>
                    <TotalPrice>79</TotalPrice>
                    <Gender>Male</Gender>
                    <Products>
                        <Product>
                            <Name>PRODUCT NAME</Name>
                        </Product>
                    </Products>
                    <Password>PASSWORD</Password>
                </Order>
                <Date>2018-05-21T19:16:31-04:00</Date>
            </message>
        </Create>
    </soap:Body>
</soap:Envelope>

Request Header

enter image description here

Response

  • faultcode: 500
  • faultstring: 'Invalid XML'
  • detail: 'Error: Unexpected close tag\nLine: 88\nColumn: 19\nChar: >
  • statusCode: 500

enter image description here

Muhammad Saud
  • 356
  • 3
  • 13

0 Answers0