-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not working for requests Content-Type is application/xml #37
Comments
Could you share your Postman collection and postman-to-k6 configuration? That way we can use it to reproduce the faulty behaviour, which will allow us to debug & potentially fix it. |
Sorry, my script only work in my company vpn. I can try to find a public api, to try to simulate. |
The problem is in xml parse, the same broken:
|
Not sure what is broken, since I was able to properly parse the XML example you shared. const xml = '<RequestTransactionPOSRegistration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.43"><authentication><login>xxx</login><password /><externalLoginName /></authentication><POSs><POS><TaxId>03.361.770/0001-58</TaxId><TipoPdC>LibC</TipoPdC><Ambiente>PRD</Ambiente><ExternalId>1234</ExternalId><Identifier>1234</Identifier><Description>MASSA ROBO</Description><Status>1</Status><POSType>LibC</POSType><POSApplication /><POSApplicationVersion /><RoutingProfile>undefined</RoutingProfile><CardEntryModes><CardEntryMode>01</CardEntryMode></CardEntryModes><CardEntryModes><CardEntryMode>02</CardEntryMode></CardEntryModes><CommGroup>1136</CommGroup><CardTypes><CardType>01</CardType></CardTypes><CardTypes><CardType>02</CardType></CardTypes><InstallmentPlans><InstallmentPlan>1</InstallmentPlan></InstallmentPlans><Unattended>FALSE</Unattended><FiscalPrinter>TRUE</FiscalPrinter><Printer>TRUE</Printer><Automation>TRUE</Automation><PINPad>TRUE</PINPad><PINPadIdleMsgLine1>QA TESTE</PINPadIdleMsgLine1><PINPadIdleMsgLine2>QA TESTE</PINPadIdleMsgLine2></POS></POSs><Error><Number /><Description /></Error></RequestTransactionPOSRegistration>';
const json = xml2Json(xml);
console.log(JSON.stringify(json, null, 2)); The result: {
"RequestTransactionPOSRegistration": {
"$": {
"xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
"xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
"version": "1.43"
},
"authentication": [
{
"login": [
"xxx"
],
"password": [
""
],
"externalLoginName": [
""
]
}
],
"POSs": [
{
"POS": [
{
"TaxId": [
"03.361.770/0001-58"
],
"TipoPdC": [
"LibC"
],
"Ambiente": [
"PRD"
],
"ExternalId": [
"1234"
],
"Identifier": [
"1234"
],
"Description": [
"MASSA ROBO"
],
"Status": [
"1"
],
"POSType": [
"LibC"
],
"POSApplication": [
""
],
"POSApplicationVersion": [
""
],
"RoutingProfile": [
"undefined"
],
"CardEntryModes": [
{
"CardEntryMode": [
"01"
]
},
{
"CardEntryMode": [
"02"
]
}
],
"CommGroup": [
"1136"
],
"CardTypes": [
{
"CardType": [
"01"
]
},
{
"CardType": [
"02"
]
}
],
"InstallmentPlans": [
{
"InstallmentPlan": [
"1"
]
}
],
"Unattended": [
"FALSE"
],
"FiscalPrinter": [
"TRUE"
],
"Printer": [
"TRUE"
],
"Automation": [
"TRUE"
],
"PINPad": [
"TRUE"
],
"PINPadIdleMsgLine1": [
"QA TESTE"
],
"PINPadIdleMsgLine2": [
"QA TESTE"
]
}
]
}
],
"Error": [
{
"Number": [
""
],
"Description": [
""
]
}
]
}
} |
ERRO[0007] TypeError: Cannot read property 'RequestTransactionPOSRegistration' of undefined
var jsonObject = xml2Json(pm.response.text());
pm.environment.set(
"pdc",
jsonObject.RequestTransactionPOSRegistration.POSs.POS.Identifier
);
Does not recognize as object.
The text was updated successfully, but these errors were encountered: