Here's a simple http post request that works:

        DefaultHttpClient httpclient = new DefaultHttpClient();

                        HttpPost httpost = new HttpPost(URI);

                        httpost.setEntity(new UrlEncodedFormEntity
(NAMEVALUEPAIRLIST_OF_HEADERS, HTTP.UTF_8));

                        HttpResponse response = httpclient.execute(httpost);
                    HttpEntity entity = response.getEntity();
                    String sResponse = EntityUtils.toString(entity);

                    if (close == true)
                    {
                        httpclient.getConnectionManager().shutdown();
                    }

                        if (entity != null)
                        {
                        entity.consumeContent();
                        }

                   // sResponse holds string of data


GET Requests are faster (in my tests), and work like this:


class HttpParser extends DefaultHandler
{
    StringBuilder sb;
    SAXParserFactory spf = SAXParserFactory.newInstance();
    SAXParser parser = null;

    public void parse(String url) throws Exception
    {
        parser = spf.newSAXParser();

        parser.parse(
                        new URL("http://www.diddo4android.com/DiddoWebService2/
Service.asmx/" + url)
                        .openConnection().getInputStream(), this);
    }

    @Override
        public void startElement(String uri, String localName, String qName,
                        Attributes attributes) throws SAXException {


                sb = new StringBuilder();

                super.startElement(uri, localName, qName, attributes);
        }

    @Override
    public void characters(char[] ch, int offset, int count) throws
SAXException {
        sb.append(ch, offset, count);

        super.characters(ch, offset, count);
    }

    @Override
    public void endElement(String namespaceUri, String localName,
String qName) throws SAXException
    {
        switch (inTagID)
        {
        case 0: //appID
        String result = sb.toString();

//do something with result
        }


        super.endElement(namespaceUri, localName, qName);
    }

}

HOPE THIS HELPS!

On Jan 11, 4:41 pm, Tommy Hartz <droi...@gmail.com> wrote:
> Yes a soap request gets boiled down to the same thing after u build the
> request from the calling language for the most part. I currently use ksoap2
> to call a .net web service that returns a simple string file location
>
> On Jan 11, 2010 5:33 PM, "Kumar Bibek" <coomar....@gmail.com> wrote:
>
> If you know the request/response structure, you can create you own
> requests without using kSoap. The apache Http Client that comes
> bundled with Android will provide you with everything.
>
> Kumar Bibekhttp://tech-droid.blogspot.com
>
> On Jan 12, 1:48 am, Kevin Duffey <andjar...@gmail.com> wrote: > Is ksoap2
> part of Android? I am int...
>
> > On Mon, Jan 11, 2010 at 10:54 AM, Tommy <droi...@gmail.com> wrote: > >
>
>  Hey Developers, > > > I wa...> > 
> android-developers+unsubscr...@googlegroups.com<android-developers%2Bunsubs 
> cr...@googlegroups.com>
>
> <android-developers%2bunsubscr...@googlegroups.com<android-developers%252Bu 
> nsubscr...@googlegroups.com>
>
>
>
> > > For more options, visit this group at > >
>
> http://groups.google.com/group/android-developers?hl=en...
>
> --
> 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+unsubscr...@googlegroups.com<android-developers%2Bunsubs 
> cr...@googlegroups.com>
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to