You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Sascha-Matthias Kulawik <sa...@kulawik.de> on 2005/07/06 09:13:45 UTC
Mystic Bug - sending array in bean through document / wrapped does not work (org.xml.sax.SAXException: Found character data inside an array element while deserializing)
Hello,
Ive found a mysterious bug and just wanted to know if this is already known.
Several days I've tried to figure out, why I'm getting a "org.xml.sax.SAXException: Found character data inside an array element while deserializing" by sending a request through WSDL2Java-generated stubs to my webservice. First - it is not the client, this error comes on the server side.
Today I've found the solution - it was an array inside a bean.
Following example:
Remote method is:
public void enableGroup(GroupValue groupValue);
+----------------------+
| GroupValue |
+----------------------+
| +roles : RoleValue[] |
| +groupId : Integer |
+----------------------+
On client side it is:
+---------------------------+
| GroupValue |
+---------------------------+
| +roles : ArrayOfRoleValue |
| +groupId : Integer |
+---------------------------+
Where roles != null and ArrayOfRoleValue contains one item.
Then the request sended looks good:
<?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>
<addUserToGroup xmlns="http://ws.cms.juwimm.de">
<groupValue>
<groupId>19</groupId>
<roles>
<item>
<roleId>testRole</roleId>
</item>
</roles>
</groupValue>
</addUserToGroup>
</soapenv:Body>
</soapenv:Envelope>
But then the server answeres with:
<faultstring>org.xml.sax.SAXException: Found character data inside an array element
while deserializing</faultstring>
...
If im doing groupValue.setRoles(new ArrayOfRoleValue()); before sending the request, all went fine.
Any ideas?
Regards,
Sascha