logo       

RE: Kxml digest, Vol 1 #176 - 1 msg: msg#00010

java.enhydra.kxml

Subject: RE: Kxml digest, Vol 1 #176 - 1 msg

Hi Stefan,
i will try again.
problem is, it works only when i have kxml libaries on both J2ME and
servlet.
One weird thing: when i copy the kxml input string, paste to a file and read
that file from axis, it works perfectly fine.
it's just when i write to the request output stream that something seems wrong.
i'll try to get the String obtained from the request and start from there.
i'll post the outcomes on the list.

thanx and regards
marco

> -----Original Message-----
> From: ext kxml-request@xxxxxxxxxxx [mailto:kxml-request@xxxxxxxxxxx]
> Sent: 26 August, 2003 10:02
> To: kxml@xxxxxxxxxxx
> Subject: Kxml digest, Vol 1 #176 - 1 msg
>
>
> Send Kxml mailing list submissions to
> kxml@xxxxxxxxxxx
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://www.enhydra.org/mailman/listinfo.cgi/kxml
> or, via email, send a message with subject or body 'help' to
> kxml-request@xxxxxxxxxxx
>
> You can reach the person managing the list at
> kxml-admin@xxxxxxxxxxx
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Kxml digest..."
>
>
> Today's Topics:
>
> 1. Re: Help in retrieving XML contant submitted via J2ME
> (Stefan Haustein)
>
> --__--__--
>
> Message: 1
> Date: Mon, 25 Aug 2003 16:19:17 +0200
> From: Stefan Haustein <haustein@xxxxxxxxxxxxxxxxxxxxxxx>
> To: kxml@xxxxxxxxxxx
> Subject: Re: Kxml: Help in retrieving XML contant submitted via J2ME
> Reply-To: kxml@xxxxxxxxxxx
>
> Marco.Mistroni@xxxxxxxxx wrote:
> > hi all,
> > i have written a J2ME client that, using ksoap, sends
> XML request
> > to a servlet.
> > in the servlet (running on JBoss), i am trying to parse the
> XML request using
> > AXIS 1.1, but the code keeps on giving me a null pointer
> exception when i try
> > to read the content of the message.
>
>
> Hi Marco,
>
> the message syntax seems correct.
>
> Did you already try to generate the same message using Axis
> in order to see if
> there are any significant differences and/or if Axis is able
> to read the same
> message when generated using Axis?
>
> Best,
> Stefan
>
>
>
>
> > here is the message
> >
> > <v:Envelope xmlns:i="http://www.w3.org/1999/XMLSchema-instance";
> > xmlns:d="http://www.w3.org/1999/XMLSchema";
> > xmlns:c="http://schemas.xmlsoap.org/soap/encoding/";
> > xmlns:v="http://schemas.xmlsoap.org/soap/envelope/";>
> > <v:Header />
> > <v:Body>
> > <n0:agency id="o0" c:root="1"
> xmlns:n0="http://www.tgmm.com/agenciesdemo";>
> > <name i:type="d:string">testagency</name>
> > <tel i:type="d:string">12234</tel>
> > <email i:type="d:string">tgmm@xxxxxxxxx</email>
> > <contacted i:type="d:string">01012003</contacted>
> > <contactperson i:type="d:string">Myself</contactperson>
> > </n0:agency>
> > </v:Body>
> > </v:Envelope>
> >
> > the code for retrieving it is as follows
> >
> > Enumeration enumeration = request.getHeaderNames();
> > MimeHeaders mimeHeaders = new MimeHeaders();
> > while (enumeration.hasMoreElements()) {
> > String string1 = (String)enumeration.nextElement();
> > String string2 = request.getHeader(string1);
> > mimeHeaders.addHeader(string1, string2);
> > }
> > System.err.println("Now instantianting message..");
> > MessageFactory factory = MessageFactory.newInstance();
> > SOAPMessage message = factory.createMessage(mimeHeaders, stream);
> > System.err.println("OK GOT THE MESSAGE..");
> > SOAPPart soapPart = message.getSOAPPart();
> > System.err.println("OK GOT THE PART..");
> > SOAPEnvelope envelope = soapPart.getEnvelope();
> >
> > and the output is this (showing the exception when i try to
> retrieve the envelope..)
> >
> > 13:25:10,927 ERROR [STDERR] Now instantianting message..
> > 13:25:10,977 ERROR [STDERR] OK GOT THE MESSAGE..
> > 13:25:10,977 ERROR [STDERR] OK GOT THE PART..
> > 13:25:11,007 ERROR [STDERR] Exception in reading stream:
> java.lang.NullPointerEx
> > ception
> >
> > If i write my own PullParser that is just looking for the
> agency etc tags, it works fine
> >
> > so it looks like AXIS and ksoap cannot talk to each other...
> >
> > is there a solution for parsing SOAP messages sent by ksoap client?
> >
> > thanx in advance and regards
> > marco
> >
> >
> >
> >
> >
> >
> >
> >> -----Original Message-----
> >>From: Mistroni Marco (NET-IMN/Espoo)
> >>Sent: 23 August, 2003 20:05
> >>To: 'kXML@xxxxxxxxxxx'
> >>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
> >>
> >> << File: SoapParser.java >>
> >>
> >
> >
> > _______________________________________________
> > Kxml mailing list
> > Kxml@xxxxxxxxxxx
> > http://www.enhydra.org/mailman/listinfo.cgi/kxml
>
>
>
>
>
> --__--__--
>
> _______________________________________________
> Kxml mailing list
> Kxml@xxxxxxxxxxx
> http://www.enhydra.org/mailman/listinfo.cgi/kxml
>
>
> End of Kxml Digest
>


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

News | FAQ | advertise