Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tRestRequest & JSON

Hi, 
I have a problem, like most of us Smiley Happy
I use Talend ESB v5.3.1. 
Actually, i've a very simple Web Service (see screenshot) totally OK with XML input. 
When i try to use JSON instead i get the error :
ERROR=INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified

The problem is only when i add an attribute.
Exemple, for an XML like this :

<root>
    <magasin groupe="LAGARDERE">
        <libelle>Carrefour</libelle>
        <id>10</id>
    </magasin>
</root>


i have the answer : 

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <Magasin>Magasin : 10-Carrefour du groupe : LAGARDERE</Magasin>
</root>



But when i try with the corresponding JSON :

{
  "root": {
    "magasin": {
      "-groupe": "LAGARDERE",
      "libelle": "Carrefour",
      "id": "10"
    }
  }
}



I have the error :

{URI_ABSOLUTE=, ERROR=INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified. , VERB=POST, STATUS=400, URI_BASE=, URI=Test}

Last thing, without the attribute "GROUPE" everything is fine.
Someone could tell me why and how could i correct that please ?

Thanks.
Labels (4)
1 Reply
Anonymous
Not applicable
Author

Hi
The problem is the "-groupe" starts with '-', is there any specific reason for it ?
tRESTRequest JSON to XML auto conversion fails to process "-groupe" because indeed an XML tag can have no '-' prefix.
Thanks, Sergey