Passing ‘&’ or ‘<' to a SOAP operation causes error: System.Xml.XmlException

Symptom

Calling an operation on a SOAP web service fails with the following error:

System.Xml.XmlException

Cause

Caused by passing either the ampersand ( & ) or less than ( < ) character to an operation that takes a parameter.

When the error occurs, any of the following exceptions will be raised:

  • System.Xml.XmlException: An error occurred while parsing EntityName
  • System.Xml.XmlException: Data at the root level is invalid
  • System.Xml.XmlException: Unexpected end of file has occurred.

Steps to Reproduce

Create a connection to any SOAP web service. In the global configuration, test any operation that takes a parameter. With either the ‘&’ or ‘<‘ characters present, the error mode will occur

Applies To

Web Service Connector Tool

Resolution

Update the operation so that it no longer includes the ampersand ( & ) or less than ( < ) character.