Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Found character data inside an array element while deserializing
Found character data inside an array element while deserializing [message #161157] Sun, 19 February 2006 02:01 Go to next message
Ben Sisson is currently offline Ben SissonFriend
Messages: 202
Registered: July 2009
Senior Member
I have a Java client, creted from a WSDL using the WSDL2JAVA plugin, that
calls a Web Service. The return value of the Web Service is a byte[].
The client makes the call, and through the debug I see that the byte array
is populated correctly. However, somewhere between the return at the Web
Service and the client I receive the following error message.

org.xml.sax.SAXException: Found character data inside an array element
while deserializing

Can someone help?

Thanks,
Ben
Re: Found character data inside an array element while deserializing [message #161205 is a reply to message #161157] Mon, 20 February 2006 15:30 Go to previous messageGo to next message
Ben Sisson is currently offline Ben SissonFriend
Messages: 202
Registered: July 2009
Senior Member
A little more information: the WSDL defines the output as a base64Binary.
This then translates to a byte[] in the method. When I look in the
SoapStud file this is how the method is defined:

oper = new org.apache.axis.description.OperationDesc();
oper.setName("Lib_FetchItemByID");
oper.addParameter(new javax.xml.namespace.QName("http://tempuri.org/",
"client_id"), new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"),
int.class, org.apache.axis.description.ParameterDesc.IN, false, false);
oper.addParameter(new javax.xml.namespace.QName("http://tempuri.org/",
"item_id"), new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"),
int.class, org.apache.axis.description.ParameterDesc.IN, false, false);
oper.setReturnType(new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/",
"base64"));
oper.setReturnClass(byte[].class);
oper.setReturnQName(new javax.xml.namespace.QName ("http://tempuri.org/",
"Lib_FetchItemByIDResult"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[6] = oper;

There is also a method defined in the Web Services that the WSDL has
defined as an input parameter base64Binary, that is used to send data to
be stored. This method that I'm having trouble with retrieves the same
data. The method that sends the data I have no problems with. I take my
String data, perform a getbytes() and save the data into a byte[]. I pass
that from the client to the Web Service and have no problem.

So, when I try to retrieve the same data, I just copy the string, perform
a getbytes(), and return it as a byte[]. The data is in the same format
at this point that it was received. That is when I get the
org.xml.sax.SAXException: Found character data inside an array element
while deserializing Error message. The whole message appears as follows
(it appears to be an issue with Axis):

org.xml.sax.SAXException: Found character data inside an array element
while deserializing
at
org.apache.axis.encoding.ser.ArrayDeserializer.characters(Ar rayDeserializer.java:502)
at
org.apache.axis.encoding.DeserializationContext.characters(D eserializationContext.java:966)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRe corder.java:177)
at
org.apache.axis.message.MessageElement.publishToHandler(Mess ageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.ja va:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java :384)
at org.apache.axis.client.Call.invoke(Call.java:2448)
at org.apache.axis.client.Call.invoke(Call.java:2347)
at org.apache.axis.client.Call.invoke(Call.java:1804)
at
org.tempuri.Library_Support_ServicesSoapStub.lib_FetchItemBy ID(Library_Support_ServicesSoapStub.java:381)
at
org.bass.client.library.support.services.librarySupportServi cesPanel$3.actionPerformed(librarySupportServicesPanel.java: 365)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButto n.java:1849)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractB utton.java:2169)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultBu ttonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel .java:258)
at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Bas icButtonListener.java:234)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:312 6)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container. java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.j ava:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java: 3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventD ispatchThread.java:242)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDis patchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread. java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread. java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:11 0)


>>I have a Java client, creted from a WSDL using the WSDL2JAVA plugin, that
>>calls a Web Service. The return value of the Web Service is a byte[]. The
>>client makes the call, and through the debug I see that the byte array is
>>populated correctly. However, somewhere between the return at the Web
>>Service and the client I receive the following error message.

>>org.xml.sax.SAXException: Found character data inside an array element
>>while deserializing

>>Can someone help?

>>Thanks,
>>Ben
Re: Found character data inside an array element while deserializing [message #161253 is a reply to message #161205] Mon, 20 February 2006 20:26 Go to previous messageGo to next message
Ben Sisson is currently offline Ben SissonFriend
Messages: 202
Registered: July 2009
Senior Member
I still have this issue but I found an issue with the way I was creating
the byte[] return value that I want to share in case this may help someone
else and also incase it helps resolve this issue.

Basically, I was creating a byte[] before by taking the string value and
adding .getbytes() to the end of it. This was incorrect, since I was
dealing with base64.

So what I did was create a Base64 instance, took my string value and got
a byte[] of it and encoded it with the base64 insance. This then gives me
a string value of base64 but my Web Service defines a Base64Binary as the
return values which created a byte[] as the return value. So, finally I
convert my base64 string value to a byte[].

Base64 b64 = new Base64();
String base64 = b64.encode(strhold.getBytes());
ret_val = base64.getBytes();

I still get the same error though and don't know why it doesn't accept the
rturn value.


org.xml.sax.SAXException: Found character data inside an array element
while deserializing
at
org.apache.axis.encoding.ser.ArrayDeserializer.characters(Ar rayDeserializer.java:502)
at
org.apache.axis.encoding.DeserializationContext.characters(D eserializationContext.java:966)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRe corder.java:177)
at
org.apache.axis.message.MessageElement.publishToHandler(Mess ageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.ja va:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java :384)
at org.apache.axis.client.Call.invoke(Call.java:2448)
at org.apache.axis.client.Call.invoke(Call.java:2347)
at org.apache.axis.client.Call.invoke(Call.java:1804)
at
org.tempuri.Library_Support_ServicesSoapStub.lib_FetchItemBy ID(Library_Support_ServicesSoapStub.java:381)
at
org.bass.client.library.support.services.librarySupportServi cesPanel$3.actionPerformed(librarySupportServicesPanel.java: 372)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButto n.java:1849)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractB utton.java:2169)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultBu ttonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel .java:258)
at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Bas icButtonListener.java:234)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:312 6)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container. java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.j ava:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java: 3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventD ispatchThread.java:242)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDis patchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread. java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread. java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:11 0)
Re: Found character data inside an array element while deserializing [message #838610 is a reply to message #161157] Sat, 07 April 2012 10:23 Go to previous message
abhinav ladani is currently offline abhinav ladaniFriend
Messages: 2
Registered: April 2012
Junior Member
Hi to all,

I generated webservice using eclipse using axis i have methods which is returning String arrays ex.. public String [] getName();, public String[][]getList();
My steps,

I right cleck on class and than create webservice using wizard i used document/literal wrapped wsdl style and i than complete the wizard i created webservice successfully.

than i generate client using wsdl than call this public String[][]getList() && method public String [] getName(); it works fine.

but the problem is when i just stopped the server and restart it again
than i call above method client

public String [] getName(); working fine.

public String[][]getList(); Not Working.

Its giving me


SEVERE: Exception:
org.xml.sax.SAXException: Found character data inside an array element while




Any one can help me please.
Sincerely,
Abhinav Ladani.

[Updated on: Sat, 07 April 2012 10:24]

Report message to a moderator

Previous Topic:Axis webService Problem
Next Topic:Eclipse's Rhino JavaScript RegEx Not Working
Goto Forum:
  


Current Time: Wed Apr 24 15:34:05 GMT 2024

Powered by FUDForum. Page generated in 0.03503 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top