Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..
1133 views

REST API Testing - XML Data Issue

Jump to solution

When trying to use XML in the body loadrunner is not escaping the quotes as it should to parse the XML body data. If I attempt to use the "Run Step" test in the Design > Insert into Script > REST API gui option I get an error saying ti cannot run the step - can anyone assist? This appears to be an issue with the handing of XML data. See screenshots

0 Likes
1 Solution

Accepted Solutions
Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..

Re: REST API Testing - XML Data Issue

Jump to solution

Thank you please keep me posted on the patch,  the workaround I used was to use the "Extra Files" feature that documented below. Specifically I inserted this functionality:

        "ResType=XML",
        "BodyFilePath=create.xml",

  1. In the Solution Explorer, right-click the Extra Files node and select Add Files to Script to add the .json data file.

  2. Replace the Body argument with BodyFilePath=<file_name.json>.

  3. Allow JSON files. Select Tools > Options > Scripting > Script Management and add .json to the Allowed Extensions list.

View solution in original post

0 Likes
4 Replies
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: REST API Testing - XML Data Issue

Jump to solution

Hello,

 

I am trying to reproduce this issue without a success.

is it possible to post the full xml file you are using in the REST step?

 

Thanks

0 Likes
Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..

Re: REST API Testing - XML Data Issue

Jump to solution

<?xml version="1.0" encoding="utf-8"?>
<TXLife xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://ACORD.org/Standards/Life/2">
<TXLifeRequest PrimaryObjectID="Holding">
<TransRefGUID>f642aa45-e218-4539-8f72-8ef238bb026d</TransRefGUID>
<TransType tc="103">New Submission</TransType>
<TransSubType tc="1">All</TransSubType>
<TransExeDate>2017-12-01</TransExeDate>
<TransExeTime>08:46:12.4916856-05:00</TransExeTime>
<TransEffDate>2017-12-01</TransEffDate>
<TransMode tc="2">Original</TransMode>
<NoResponseOK tc="0">false</NoResponseOK>
<TestIndicator tc="1">true</TestIndicator>
<OLifE Version="2.24.00">
<Party id="Agent_01">
<PartyTypeCode tc="1">Person</PartyTypeCode>
<FullName>Adam Smith11</FullName>
<Person>
<FirstName>Adam</FirstName>
<LastName>Smith11</LastName>
</Person>
<Producer>
<NIPRNumber />
</Producer>
<EMailAddress>
<EMailType tc="1">Business</EMailType>
<AddrLine>test@test_ifs.com</AddrLine>
</EMailAddress>
</Party>
<Party id="Carrier_01">
<PartyTypeCode tc="2">Organization</PartyTypeCode>
<FullName>Test Life Insurance Company</FullName>
<Organization>
<OrgForm tc="23">Corporation (general)</OrgForm>
<OrgCode>68632</OrgCode>
<OrgCodeName>Test Life Insurance Company</OrgCodeName>
</Organization>
<Carrier>
<CarrierCode>68632</CarrierCode>
</Carrier>
<EMailAddress>
<EMailType tc="1">Business</EMailType>
<AddrLine>test@test_ifs.com</AddrLine>
</EMailAddress>
</Party>
<Party id="Distributor_01">
<PartyTypeCode tc="2">Organization</PartyTypeCode>
<FullName>Test Insurance Agency, LLC</FullName>
<Organization>
<OrgCode>W89</OrgCode>
<OrgCodeName>Test Insurance Agency, LLC</OrgCodeName>
</Organization>
</Party>
<Party id="Insured_01">
<PartyTypeCode tc="1">Person</PartyTypeCode>
<GovtID>122334432</GovtID>
<GovtIDTC tc="1">Social Security Number US</GovtIDTC>
<Person>
<FirstName>Albert</FirstName>
<LastName>Smith32</LastName>
<Gender tc="1">Male</Gender>
<BirthDate>1987-11-25</BirthDate>
</Person>
<Address id="Insured_01_Address1">
<Line1>7909 Izetta Lane</Line1>
<City>Hartford</City>
<AddressStateTC tc="51">Texas</AddressStateTC>
<Zip>06011</Zip>
<AddressCountryTC tc="1">United States of America</AddressCountryTC>
</Address>
<PartialIdentification>
<IdentificationPart>4432</IdentificationPart>
<PartialIDType tc="1">Last four digits of US SSN</PartialIDType>
</PartialIdentification>
</Party>
<Party id="Owner_01">
<PartyTypeCode tc="1">Person</PartyTypeCode>
<GovtID>122334432</GovtID>
<GovtIDTC tc="1">Social Security Number US</GovtIDTC>
<Person>
<FirstName>Albert</FirstName>
<LastName>Smith32</LastName>
<Gender tc="1">Male</Gender>
<BirthDate>1987-11-25</BirthDate>
</Person>
<Address id="Owner_01_Address1">
<Line1>7909 Izetta Lane</Line1>
<City>Hartford</City>
<AddressStateTC tc="51">Texas</AddressStateTC>
<Zip>06011</Zip>
<AddressCountryTC tc="1">United States of America</AddressCountryTC>
</Address>
<PartialIdentification>
<IdentificationPart>4432</IdentificationPart>
<PartialIDType tc="1">Last four digits of US SSN</PartialIDType>
</PartialIdentification>
</Party>
<Party id="Payor_01">
<PartyTypeCode tc="1">Person</PartyTypeCode>
<GovtID>122334432</GovtID>
<GovtIDTC tc="1">Social Security Number US</GovtIDTC>
<Person>
<FirstName>Albert</FirstName>
<LastName>Smith32</LastName>
<Gender tc="1">Male</Gender>
<BirthDate>1987-11-25</BirthDate>
</Person>
<Address id="Payor_01_Address1">
<Line1>7909 Izetta Lane</Line1>
<City>Hartford</City>
<AddressStateTC tc="51">Texas</AddressStateTC>
<Zip>06011</Zip>
<AddressCountryTC tc="1">United States of America</AddressCountryTC>
</Address>
<PartialIdentification>
<IdentificationPart>4432</IdentificationPart>
<PartialIDType tc="1">Last four digits of US SSN</PartialIDType>
</PartialIdentification>
</Party>
<Party id="PrimBene_01">
<PartyTypeCode tc="1">Person</PartyTypeCode>
<GovtID>122334434</GovtID>
<GovtIDTC tc="1">Social Security Number US</GovtIDTC>
<Person>
<FirstName>Dana</FirstName>
<LastName>Smith34</LastName>
<Gender tc="2">Female</Gender>
<BirthDate>1987-07-30</BirthDate>
</Person>
<Address id="PrimBene_01_Address1">
<Line1>7909 Izetta Ln</Line1>
<City>Hartford</City>
<AddressStateTC tc="51">Texas</AddressStateTC>
<Zip>06011</Zip>
<AddressCountryTC tc="1">United States of America</AddressCountryTC>
</Address>
<PartialIdentification>
<IdentificationPart>4434</IdentificationPart>
<PartialIDType tc="1">Last four digits of US SSN</PartialIDType>
</PartialIdentification>
</Party>
<Holding id="Holding">
<CurrencyTypeCode tc="840">USD</CurrencyTypeCode>
<Policy id="Policy">
<PolNumber>W89P000003</PolNumber>
<ProductType tc="2">Term</ProductType>
<CarrierCode>68632</CarrierCode>
<PolicyStatus tc="12">Proposed</PolicyStatus>
<IssueNation tc="1">United States of America</IssueNation>
<Jurisdiction tc="51">TX</Jurisdiction>
<PaymentMode tc="4">Monthly</PaymentMode>
<PaymentAmt>23.57</PaymentAmt>
<Life>
<Coverage>
<PlanName>Twenty Year Level Term</PlanName>
<ProductCode>54T20</ProductCode>
<LifeParticipant id="Policy_Insured_01" PartyID="Insured_01">
<LifeParticipantRoleCode tc="1">Primary Insured</LifeParticipantRoleCode>
<IssueAge>29</IssueAge>
<FaceAmt>250000.00</FaceAmt>
</LifeParticipant>
<OLifEExtension>
<ProductTerm xmlns="">20</ProductTerm>
</OLifEExtension>
</Coverage>
</Life>
<OLifEExtension>
<SaleExpirationDate xmlns="">12/31/2017 8:41:00 AM</SaleExpirationDate>
</OLifEExtension>
</Policy>
</Holding>
<Relation id="Policy_PrimBene_01" OriginatingObjectID="Policy" RelatedObjectID="PrimBene_01">
<OriginatingObjectType tc="18">Policy</OriginatingObjectType>
<RelatedObjectType tc="6">Party</RelatedObjectType>
<RelationRoleCode tc="34">Beneficiary</RelationRoleCode>
<InterestPercent>100</InterestPercent>
</Relation>
<Relation id="Policy_Distributor_01" OriginatingObjectID="Policy" RelatedObjectID="Distributor_01">
<OriginatingObjectType tc="18">Policy</OriginatingObjectType>
<RelatedObjectType tc="6">Party</RelatedObjectType>
<RelationRoleCode tc="48">General Agent</RelationRoleCode>
</Relation>
<Relation id="Policy_Owner_01" OriginatingObjectID="Policy" RelatedObjectID="Owner_01">
<OriginatingObjectType tc="18">Policy</OriginatingObjectType>
<RelatedObjectType tc="6">Party</RelatedObjectType>
<RelationRoleCode tc="8">Owner</RelationRoleCode>
</Relation>
<Relation id="Policy_Payor_01" OriginatingObjectID="Policy" RelatedObjectID="Payor_01">
<OriginatingObjectType tc="18">Policy</OriginatingObjectType>
<RelatedObjectType tc="6">Party</RelatedObjectType>
<RelationRoleCode tc="31">Payer</RelationRoleCode>
</Relation>
<Relation id="Policy_Carrier_01" OriginatingObjectID="Policy" RelatedObjectID="Carrier_01">
<OriginatingObjectType tc="18">Policy</OriginatingObjectType>
<RelatedObjectType tc="6">Party</RelatedObjectType>
<RelationRoleCode tc="87">Carrier</RelationRoleCode>
</Relation>
<Relation id="Policy_Insured_01" OriginatingObjectID="Policy" RelatedObjectID="Insured_01">
<OriginatingObjectType tc="18">Policy</OriginatingObjectType>
<RelatedObjectType tc="6">Party</RelatedObjectType>
<RelationRoleCode tc="32">Insured</RelationRoleCode>
</Relation>
<Relation id="Policy_Agent_01" OriginatingObjectID="Policy" RelatedObjectID="Agent_01">
<OriginatingObjectType tc="18">Policy</OriginatingObjectType>
<RelatedObjectType tc="6">Party</RelatedObjectType>
<RelationRoleCode tc="11">Agent</RelationRoleCode>
</Relation>
</OLifE>
</TXLifeRequest>
</TXLife>

0 Likes
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: REST API Testing - XML Data Issue

Jump to solution

Thank you for bringing this to our attention. 
We'll open the needed defect and do our best to fix this for the next release.

0 Likes
Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..

Re: REST API Testing - XML Data Issue

Jump to solution

Thank you please keep me posted on the patch,  the workaround I used was to use the "Extra Files" feature that documented below. Specifically I inserted this functionality:

        "ResType=XML",
        "BodyFilePath=create.xml",

  1. In the Solution Explorer, right-click the Extra Files node and select Add Files to Script to add the .json data file.

  2. Replace the Body argument with BodyFilePath=<file_name.json>.

  3. Allow JSON files. Select Tools > Options > Scripting > Script Management and add .json to the Allowed Extensions list.

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.