logo       

help in parsing soap messages: msg#00007

java.enhydra.kxml

Subject: help in parsing soap messages

hi all,
i am fairly new to ksoap. i have written 'two way' xml communication
between a J2ME app (midp toolkit 2.0) and a serverside app implemented with
struts
on jboss.
so far, i have been using my own xml format,but now i want to move to SOAP.

writing SOAP from J2ME to serverside logic works fine, but now i have the
problem
of parsing the SOAP request.

i have tried to use ksoap for parsing this simple XML

<?xml version="1.0"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
<SOAP-ENV:Body>
<agencies>
<agency>
<name>name1</name>
<tel>1234</tel>
</agency>
</agencies>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


i have followed what was said in previous email to have a look at SOAPEnvelope
to see
how to parse it.
So, i copied the code from SOAPEnvelope and tried to customize for my own
needs, using
a the xml pullparser.

but for some reason i keep on getting following exception

Creating new AgencyImpl..
Exception in thread "main" org.xmlpull.v1.XmlPullParserException: expected: END_
TAG {http://www.w3.org/2001/12/soap-envelope}Body (position:START_TAG <agency> @
7:13)
at org.kxml2.io.KXmlParser.exception(KXmlParser.java:228)
at org.kxml2.io.KXmlParser.require(KXmlParser.java:1261)
at com.tgmm.commons.SoapParser.parse(Unknown Source)
at com.tgmm.commons.SoapParser.main(Unknown Source)

i cannot figure out what's wrong. the XML seems ok, since i can see it in IE 5.5

i can attach the code that i am using.... if anyone can help me in figuring out
where is the problem.


with best regards
marco

<<SoapParser.java>>

Attachment: SoapParser.java
Description: SoapParser.java

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise