Sunday, October 23, 2011

[android-developers] Re: Implement an XML-RPC server on Android

It seems that the XMLPullParser is not returned....

Only Log 1 and 2 is printed out; Log 3 and 4 is not.

XmlPullParser xmlPullParserFromSocket(InputStream socketInputStream)
throws IOException, XmlPullParserException {
Log.i(LOG_TAG, "xmlPullParserFromSocket"); // 1
String line, xmlRpcText = "";
BufferedReader br = new BufferedReader(new
InputStreamReader(socketInputStream));
while ((line = br.readLine()) != null && line.length() > 0); // eat
the HTTP POST headers
Log.i(Tag.LOG, "test1"); // 2
while (br.ready()) {
xmlRpcText = xmlRpcText + br.readLine();
Log.i(LOG_TAG, "test2"); //3
}
Log.i(Tag.LOG, "xml received:" + xmlRpcText); //4

InputStream inputStream = new
ByteArrayInputStream(xmlRpcText.getBytes("UTF-8"));
XmlPullParser pullParser =
XmlPullParserFactory.newInstance().newPullParser();
Reader streamReader = new InputStreamReader(inputStream);
pullParser.setInput(streamReader);
return pullParser;
}

On Oct 23, 9:00 pm, Weikang Wan <weikang....@gmail.com> wrote:
> Hello pskink,
>
> I have put the TestXMLRPCServer you just checked in with the client
> codes together. I made some changes:
>
> 1. I put following codes in the end of onCreate() of Test Activity
> class:
>
> Intent intent = new Intent(Test.this, XMLRPCService.class);
> startService(intent);
>
> 2. I changed IP address from "10.0.2.2:8888" to "127.0.0.1:8888"
>
> The screen of emulator stopped as "Calling host 127.0.0.1".
>
> When I debugged it, I found that the method called from client;
> however, it seems that it has not been received by theserverside.
>
> What might be the problem of it?
>
> Thanks.
> Vycon
>
> On Oct 22, 12:31 pm, skink <psk...@gmail.com> wrote:
>
>
>
>
>
>
>
> > On Oct 22, 5:31 pm, Weikang Wan <weikang....@gmail.com> wrote:
>
> > > We know that we can iimplement anXML-RPCclient onAndroid. I am
> > > wondering if there is a way to implement anXML-RPCserveronAndroid.
>
> > > Thanks.
>
> > Hi,
>
> > See client &serverlibrary I created some time ago:
>
> >http://code.google.com/p/android-xmlrpc/
>
> > pskink

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment