hii,
im  passing parameter to .net webservice and it is giving xml as a
response bt the problem is that im not getting complete xml and
getting Anytype before every node and i dont know how to parse that
response through SAX..

my android code looks like following:

private String NAMESPACE = "http://polymerupdate.com/";;

        private String SendSoapMessage(String NAMESPACE, String METHOD_NAME,
                        String testBody) {

                try {
                        URL connectURL = new 
URL("http://demo.polymerupdate.com/web/news-
desk.asmx");
                        HttpURLConnection connection = (HttpURLConnection) 
connectURL
                                        .openConnection();

                        // SoapObject rpc = new SoapObject(NAMESPACE, 
METHOD_NAME);
                        SoapSerializationEnvelope envelope2 = new
SoapSerializationEnvelope(
                                        SoapEnvelope.VER11);
                        envelope2.encodingStyle = SoapSerializationEnvelope.ENC;
                        connection.setRequestProperty("Content-Type", 
"text/xml");
                        connection.setRequestProperty("Content-Length",
                                        "" + testBody.getBytes().length);
                        connection.setRequestMethod("POST");
                        connection.setDoInput(true);
                        connection.setDoOutput(true);

                        OutputStream os = connection.getOutputStream();
                        os.write(testBody.getBytes(), 0, 
testBody.getBytes().length);
                        os.close();

                        testBody = null;

                         InputStream is = connection.getInputStream();
                        //InputStream is = new ByteArrayInputStream(null);
                        is = connection.getInputStream();
                        XmlPullParser xp = new KXmlParser();
                        xp.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, 
true);
                        xp.setInput(is, null);

                        envelope2.parse(xp);
                        final String result2 = 
(envelope2.getResponse()).toString();
                        is.close();
                        Log.d("sid", "result= " + result2);


                        return result2;

                } catch (Exception e) {
                        Log.d("sid", "error " + e.getMessage());
                }

                return null;

        }

        public boolean Checklogin(String user, String pwd) {
                String body = "<?xml version=\"1.0\" encoding=\"utf-8\"?> "
                                + "<soap:Envelope 
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-
instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"; xmlns:soap=
\"http://schemas.xmlsoap.org/soap/envelope/\";> "
                                + "<soap:Body> "
                                + "<DisplayNewsHeadLines 
xmlns=\"http://polymerupdate.com/\";> "
                                + "<Username>" + user +" </Username> "
                                + "<Password>" + pwd + "</Password> " + 
"</DisplayNewsHeadLines> "
                                + "</soap:Body> " + "</soap:Envelope>";

                try {

                        String METHOD_NAME = "DisplayNewsHeadLines";
                        String result2 = SendSoapMessage(NAMESPACE, 
METHOD_NAME, body);
                        Log.d("sid", "final result2 " + result2);

                } catch (Exception e) {
                        // TODO: handle exception
                        Log.d("sid", "error " + e.getMessage());
                }


                return true;
        }

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

Reply via email to