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





Reply via email to