Skip to content

Invalid XML 1.0 characters causes 500 error #570

Description

@sberlan-odeko

Version: 0.8.11

It appears this gem, or at least NetSuite itself, uses an XML 1.0 parser, so when a string field includes an invalid unicode character as defined by the XML 1.0 spec, the response will cause a 500 error.

Expected behavior:
Either strip or escape invalid characters.

Reproduction:

item = NetSuite::Records::InventoryItem.new
item.item_id = "Ooops \u0003 Invalid Character"
item.add

Result:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <soapenv:Fault>
      <faultcode>soapenv:Server.userException</faultcode>
      <faultstring>org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 300; An invalid XML character (Unicode: 0x3) was found in the element content of the document.</faultstring>
    </soapenv:Fault>
  </soapenv:Body>
</soapenv:Envelope>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions