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;"> &nbs=
p; at org.kxml.parser.AbstractXmlParser.read(+53)</span><br style=3D"font-w=
eight: bold;">
<span style=3D"font-weight: bold;"> &nbs=
p; at org.ksoap.SoapEnvelope.parseHead(+19)</span><br style=3D"font-weight:=
bold;">
<span style=3D"font-weight: bold;"> &nbs=
p; at org.ksoap.SoapEnvelope.parse(+5)</span><br style=3D"font-weight: bold=
;">
<span style=3D"font-weight: bold;"> &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"<a href=3D"http://www.w3.org/2001/XMLSchema-instance">htt=
p://www.w3.org/2001/XMLSchema-instance</a>"
xmlns:xsd=3D"<a href=3D"http://www.w3.org/2001/XMLSchema">http://www.w=
3.org/2001/XMLSchema</a>"
xmlns:SOAP-ENC=3D"<a href=3D"http://schemas.xmlsoap.org/soap/encoding/=
">http://schemas.xmlsoap.org/soap/encoding/</a>"
xmlns:SOAP-ENV=3D"<a href=3D"http://schemas.xmlsoap.org/soap/envelope/=
">http://schemas.xmlsoap.org/soap/envelope/</a>"
xmlns:wsa=3D"<a href=3D"http://schemas.xmlsoap.org/ws/2004/08/addressi=
ng">http://schemas.xmlsoap.org/ws/2004/08/addressing</a>"></span><b=
r style=3D"font-weight: bold;">
<span style=3D"background-color: rgb(255, 255, 153);"> <SOAP=
-ENV:Header></span><br style=3D"background-color: rgb(255, 255, 153);">
<span style=3D"background-color: rgb(255, 255, 153);"> =
<wsa:MessageID>16795905</</span><span style=3D"background-c=
olor: rgb(255, 255, 153);">wsa:</span><span style=3D"background-color: rgb(=
255, 255, 153);">MessageID>
</span><br style=3D"background-color: rgb(255, 255, 153);">
<span style=3D"background-color: rgb(255, 255, 153);"> &=
nbsp; <</span><span style=3D"background-color: rgb(255, 255, 153);">wsa:=
</span><span style=3D"background-color: rgb(255, 255, 153);">To><a href=
=3D"datagram://127.0.0.1:9090/soaprpc">
datagram://127.0.0.1:9090/soaprpc</a></</span><span style=3D"background-=
color: rgb(255, 255, 153);">wsa:</span><span style=3D"background-color: rgb=
(255, 255, 153);">To></span><br style=3D"background-color: rgb(255, 255,=
153);">
<span style=3D"background-color: rgb(255, 255, 153);"> </SOA=
P-ENV:Header></span><br style=3D"background-color: rgb(255, 255, 153);">
<span style=3D"background-color: rgb(153, 255, 153);"> <SOAP=
-ENV:Body SOAP-ENV:encodingStyle=3D"<a href=3D"http://schemas.xmlsoap.=
org/soap/encoding/">http://schemas.xmlsoap.org/soap/encoding/</a>">=
</span><br style=3D"background-color: rgb(153, 255, 153);">
<span style=3D"background-color: rgb(153, 255, 153);"> =
<echoString xmlns=3D"urn:Services" id=3D"o0" =
SOAP-ENC:root=3D"1"></span><br style=3D"background-color: rgb(=
153, 255, 153);">
<span style=3D"background-color: rgb(153, 255, 153);"> =
<String xmlns=3D"" xsi:type=3D"xsd:s=
tring">This-is-a-test-msg</String></span><br style=3D"backgro=
und-color: rgb(153, 255, 153);">
<span style=3D"background-color: rgb(153, 255, 153);"> =
</echoString></span><br style=3D"background-color: rgb(153, 25=
5, 153);">
<span style=3D"background-color: rgb(153, 255, 153);"> </SOA=
P-ENV:Body></span><br>
<span style=3D"font-weight: bold; background-color: rgb(255, 102, 102);">&l=
t;/SOAP-ENV:Envelope></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;"> try {</span><br style=3D"fo=
nt-weight: bold;">
<br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">
InputStreamReader reader =3D new InputStreamReader (new
ByteArrayInputStream(incomingPacket.getData()));</span><br style=3D"font-we=
ight: bold;">
<span style=3D"font-weight: bold;"> Xml=
Parser xp=3Dnew XmlParser(reader);</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> </s=
pan><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">//
System.out.println("********"+new String(incomingPacket.getData()=
,
0,incomingPacket.getLength()));</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> </s=
pan><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> Doc=
ument doc =3D new Document();</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> doc=
.parse(xp);</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> Ele=
ment root =3D doc.getRootElement();</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> Ele=
ment header =3D root.getElement("Header");</span><br style=3D"fon=
t-weight: bold;">
<span style=3D"font-weight: bold;"> </s=
pan><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> cm=
=3DServiceDeployment.getClassmap();</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> 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;"> try=
{</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> &nbs=
p; 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;
// :::::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; 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;"> &nbs=
p; //Retrieving the URI from the Soap Envelope</span><br =
style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> &nbs=
p;
uri =3D parseUri(((Element)header.getChild(3)).getChild(0).toString());</sp=
an><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> &nbs=
p; System.out.println("URI Extracted:"+uri);</s=
pan><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> &nbs=
p; }</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> &nbs=
p; catch (IOException e) {</span><br style=3D"font-weight: bold=
;">
<span style=3D"font-weight: bold;"></span><span style=3D"font-weight: bold;=
"> =
System.out.println("RequestHandler::IOException");</span><br styl=
e=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> &nbs=
p; ServiceDeployment.Fault=3Dtrue;</span><br =
style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> &nbs=
p; ServiceDeployment.oFault.faultcode=3D"=
;Client";</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> &nbs=
p;
ServiceDeployment.oFault.faultactor=3D"Errors in Client Soap Message &=
quot;;</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> &nbs=
p;
ServiceDeployment.oFault.faultstring=3D"Error Parsing received Soap
message\n" +e.getMessage();</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;"> &nbs=
p; isFault=3Dtrue;</span><br style=3D"font-we=
ight: bold;">
<span style=3D"font-weight: bold;"> &nbs=
p; e.printStackTrace();</span><br style=3D"fo=
nt-weight: bold;">
<span style=3D"font-weight: bold;"> &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--