org.kxml.io.ParseException: unexpected: ParseEvent type=8 text='null' @-1:-1

Fahad Aijaz <[email protected]> Tue, 13 Sep 2005 16:47:10 +0200
Newsgroups gmane.comp.java.ide.netbeans.user,gmane.comp.java.enhydra.ksoap
Message-ID <[email protected]>
------=_Part_21599_10667904.1126622830591
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi All,

I am trying to tackle with a problem since 5 days but didnt find any=20
relevant solutions. The problem is that I have to send the SOAP messages=20
over UDP from the client to server. I have used Webservice Addressing to=20
send the URL and the msgId in SOAP messages. I am using kSoap and Kxml for=
=20
this.=20

Now the message is successfully sent from the client and recieved at the=20
server, but when I parse the SOAP Xml at the server with Kxml, I get the=20
following exception:

org.kxml.io.ParseException: unexpected: ParseEvent type=3D8 text=3D'null' @=
-1:-1
 at org.kxml.parser.AbstractXmlParser.read(+53)
 at org.ksoap.SoapEnvelope.parseHead(+19)
 at org.ksoap.SoapEnvelope.parse(+5)
 at cnsoap.server.RequestHandler.run(+112)

I am not able to figure out the reasons since days. Following is my SOAP XM=
L=20
(Soap Envelope) that is being sent and recieved (highligting for your=20
readability):

<SOAP-ENV:Envelope xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"=
=20
xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC=3D"
http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV=3D"
http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa=3D"
http://schemas.xmlsoap.org/ws/2004/08/addressing">
 <SOAP-ENV:Header>
 <wsa:MessageID>16795905</wsa:MessageID>
 <wsa:To>datagram://127.0.0.1:9090/soaprpc</wsa:To>
 </SOAP-ENV:Header>
 <SOAP-ENV:Body SOAP-ENV:encodingStyle=3D"
http://schemas.xmlsoap.org/soap/encoding/">
 <echoString xmlns=3D"urn:Services" id=3D"o0" SOAP-ENC:root=3D"1">
 <String xmlns=3D"" xsi:type=3D"xsd:string">This-is-a-test-msg</String>
 </echoString>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Following is the snapshot of my code. I have highlighted the line where thi=
s=20
exception occurs:

 try {

 InputStreamReader reader =3D new InputStreamReader (new ByteArrayInputStre=
am(
incomingPacket.getData()));
 XmlParser xp=3Dnew XmlParser(reader);
=20
// System.out.println("********"+new String(incomingPacket.getData(), 0,
incomingPacket.getLength()));
=20
 Document doc =3D new Document();
 doc.parse(xp);
 Element root =3D doc.getRootElement();
 Element header =3D root.getElement("Header");
=20
 cm=3DServiceDeployment.getClassmap();
 SoapEnvelope recvEnvelope =3D new SoapEnvelope (cm);

 try {
 recvEnvelope.setBody(root);

 // :::::THIS IS WHERE THE PROBLEM OCCURS i.e. The ParseEvent Exception=20
Mentioned above ::::::
 recvEnvelope.parse (xp);

 //Retrieving the URI from the Soap Envelope
 uri =3D parseUri(((Element)header.getChild(3)).getChild(0).toString());
 System.out.println("URI Extracted:"+uri);
 }
 catch (IOException e) {
 System.out.println("RequestHandler::IOException");
 ServiceDeployment.Fault=3Dtrue;
 ServiceDeployment.oFault.faultcode=3D"Client";
 ServiceDeployment.oFault.faultactor=3D"Errors in Client Soap Message ";
 ServiceDeployment.oFault.faultstring=3D"Error Parsing received Soap=20
message\n" +e.getMessage();
 isFault=3Dtrue;
 e.printStackTrace();
 }

..........

catch(.....){...}


Any help will be GREATLY Appreciated.

Greetings,

--=20
Fahad Aijaz

------=_Part_21599_10667904.1126622830591
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi All,<br>
<br>
I am trying to tackle with a problem since 5 days but didnt find any
relevant solutions. The problem is that I have to send the SOAP
messages over UDP from the client to server. I have used Webservice
Addressing to send the URL and the msgId in SOAP messages. I am using
kSoap and Kxml for this. <br>
<br>
Now the message is successfully sent from the client and recieved at
the server, but when I parse the SOAP Xml at the server with Kxml, I
get the following exception:<br>
<br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">org.kxml.io.ParseException: unexpected: =
ParseEvent type=3D8 text=3D'null' @-1:-1</span><br style=3D"font-weight: bo=
ld;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; at org.kxml.parser.AbstractXmlParser.read(+53)</span><br style=3D"font-w=
eight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; at org.ksoap.SoapEnvelope.parseHead(+19)</span><br style=3D"font-weight:=
 bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; at org.ksoap.SoapEnvelope.parse(+5)</span><br style=3D"font-weight: bold=
;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; at cnsoap.server.RequestHandler.run(+112)</span><br clear=3D"all"><br>
I am not able to figure out the reasons since days. Following is my
SOAP XML (Soap Envelope) that is being sent and recieved (highligting
for your readability):<br>
<br>
<span style=3D"font-weight: bold; background-color: rgb(255, 102, 102);">&l=
t;SOAP-ENV:Envelope
xmlns:xsi=3D&quot;<a href=3D"http://www.w3.org/2001/XMLSchema-instance">htt=
p://www.w3.org/2001/XMLSchema-instance</a>&quot;
xmlns:xsd=3D&quot;<a href=3D"http://www.w3.org/2001/XMLSchema">http://www.w=
3.org/2001/XMLSchema</a>&quot;
xmlns:SOAP-ENC=3D&quot;<a href=3D"http://schemas.xmlsoap.org/soap/encoding/=
">http://schemas.xmlsoap.org/soap/encoding/</a>&quot;
xmlns:SOAP-ENV=3D&quot;<a href=3D"http://schemas.xmlsoap.org/soap/envelope/=
">http://schemas.xmlsoap.org/soap/envelope/</a>&quot;
xmlns:wsa=3D&quot;<a href=3D"http://schemas.xmlsoap.org/ws/2004/08/addressi=
ng">http://schemas.xmlsoap.org/ws/2004/08/addressing</a>&quot;&gt;</span><b=
r style=3D"font-weight: bold;">
<span style=3D"background-color: rgb(255, 255, 153);">&nbsp;&nbsp; &lt;SOAP=
-ENV:Header&gt;</span><br style=3D"background-color: rgb(255, 255, 153);">
<span style=3D"background-color: rgb(255, 255, 153);">&nbsp; &nbsp; &nbsp; =
&nbsp; &lt;wsa:MessageID&gt;16795905&lt;/</span><span style=3D"background-c=
olor: rgb(255, 255, 153);">wsa:</span><span style=3D"background-color: rgb(=
255, 255, 153);">MessageID&gt;
</span><br style=3D"background-color: rgb(255, 255, 153);">
<span style=3D"background-color: rgb(255, 255, 153);">&nbsp; &nbsp; &nbsp;&=
nbsp; &lt;</span><span style=3D"background-color: rgb(255, 255, 153);">wsa:=
</span><span style=3D"background-color: rgb(255, 255, 153);">To&gt;<a href=
=3D"datagram://127.0.0.1:9090/soaprpc">
datagram://127.0.0.1:9090/soaprpc</a>&lt;/</span><span style=3D"background-=
color: rgb(255, 255, 153);">wsa:</span><span style=3D"background-color: rgb=
(255, 255, 153);">To&gt;</span><br style=3D"background-color: rgb(255, 255,=
 153);">

<span style=3D"background-color: rgb(255, 255, 153);">&nbsp;&nbsp; &lt;/SOA=
P-ENV:Header&gt;</span><br style=3D"background-color: rgb(255, 255, 153);">
<span style=3D"background-color: rgb(153, 255, 153);">&nbsp;&nbsp; &lt;SOAP=
-ENV:Body SOAP-ENV:encodingStyle=3D&quot;<a href=3D"http://schemas.xmlsoap.=
org/soap/encoding/">http://schemas.xmlsoap.org/soap/encoding/</a>&quot;&gt;=
</span><br style=3D"background-color: rgb(153, 255, 153);">

<span style=3D"background-color: rgb(153, 255, 153);">&nbsp; &nbsp; &nbsp; =
&nbsp; &lt;echoString xmlns=3D&quot;urn:Services&quot; id=3D&quot;o0&quot; =
SOAP-ENC:root=3D&quot;1&quot;&gt;</span><br style=3D"background-color: rgb(=
153, 255, 153);">
<span style=3D"background-color: rgb(153, 255, 153);">&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &lt;String xmlns=3D&quot;&quot; xsi:type=3D&quot;xsd:s=
tring&quot;&gt;This-is-a-test-msg&lt;/String&gt;</span><br style=3D"backgro=
und-color: rgb(153, 255, 153);">
<span style=3D"background-color: rgb(153, 255, 153);">&nbsp; &nbsp; &nbsp; =
&nbsp; &lt;/echoString&gt;</span><br style=3D"background-color: rgb(153, 25=
5, 153);">
<span style=3D"background-color: rgb(153, 255, 153);">&nbsp;&nbsp; &lt;/SOA=
P-ENV:Body&gt;</span><br>
<span style=3D"font-weight: bold; background-color: rgb(255, 102, 102);">&l=
t;/SOAP-ENV:Envelope&gt;</span><br style=3D"font-weight: bold;">
<br>
Following is the snapshot of my code. I have highlighted the line where thi=
s exception occurs:<br>
<br>
<span style=3D"font-weight: bold;">&nbsp;&nbsp; try {</span><br style=3D"fo=
nt-weight: bold;">
<br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
InputStreamReader reader =3D new InputStreamReader (new
ByteArrayInputStream(incomingPacket.getData()));</span><br style=3D"font-we=
ight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Xml=
Parser xp=3Dnew XmlParser(reader);</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </s=
pan><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
System.out.println(&quot;********&quot;+new String(incomingPacket.getData()=
,
0,incomingPacket.getLength()));</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </s=
pan><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Doc=
ument doc =3D new Document();</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; doc=
.parse(xp);</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ele=
ment root =3D doc.getRootElement();</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ele=
ment header =3D root.getElement(&quot;Header&quot;);</span><br style=3D"fon=
t-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </s=
pan><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cm=
=3DServiceDeployment.getClassmap();</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Soa=
pEnvelope recvEnvelope =3D new SoapEnvelope (cm);</span><br style=3D"font-w=
eight: bold;">
<br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try=
 {</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp; recvEnvelope.setBody(root);</span><br style=3D"font-we=
ight: bold;">
<br style=3D"font-weight: bold;">
<span style=3D"background-color: rgb(102, 204, 204); font-weight: bold;">&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// :::::THIS IS WHERE THE PROBLEM OCCURS i.e. The ParseEvent Exception
Mentioned above ::::::</span><br style=3D"background-color: rgb(102, 204, 2=
04); font-weight: bold;">
<span style=3D"background-color: rgb(102, 204, 204); font-weight: bold;">&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; recvEnvelope.par=
se (xp);</span><br style=3D"background-color: rgb(102, 204, 204); font-weig=
ht: bold;">
<br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp; //Retrieving the URI from the Soap Envelope</span><br =
style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;
uri =3D parseUri(((Element)header.getChild(3)).getChild(0).toString());</sp=
an><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp; System.out.println(&quot;URI Extracted:&quot;+uri);</s=
pan><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; }</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; catch (IOException e) {</span><br style=3D"font-weight: bold=
;">
<span style=3D"font-weight: bold;"></span><span style=3D"font-weight: bold;=
">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
System.out.println(&quot;RequestHandler::IOException&quot;);</span><br styl=
e=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ServiceDeployment.Fault=3Dtrue;</span><br =
style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ServiceDeployment.oFault.faultcode=3D&quot=
;Client&quot;;</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ServiceDeployment.oFault.faultactor=3D&quot;Errors in Client Soap Message &=
quot;;</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ServiceDeployment.oFault.faultstring=3D&quot;Error Parsing received Soap
message\n&quot; +e.getMessage();</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; isFault=3Dtrue;</span><br style=3D"font-we=
ight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.printStackTrace();</span><br style=3D"fo=
nt-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; }</span><br style=3D"font-weight: bold;">
<br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">..........</span><br style=3D"font-weigh=
t: bold;">
<br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">catch(.....){...}</span><br style=3D"fon=
t-weight: bold;">
<br><br>
Any help will be <span style=3D"font-weight: bold;">GREATLY</span> Apprecia=
ted.<br>
<br>
Greetings,<br>
<br>
-- <br>Fahad Aijaz

------=_Part_21599_10667904.1126622830591--