You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Naggi Rao <na...@softhome.net> on 2001/10/31 21:45:09 UTC

Socket Client For a WebService waits

Hi all,
I am using a Socket Client to POST a request to a WebService which uses
Apache's SOAP Engine..

The Socket makes a request and get Results back..
but at the end (after getting Data from the Socket) it waits indefinetly
before it relinquishes..
The snippet of what I use is :

        InputStream in = s.getInputStream();
        InputStreamReader isr = new InputStreamReader(in);

        BufferedReader br = new BufferedReader(isr);
        int c;
        System.out.println("Waiting for results");
            while ((c = br.read()) != -1) {
           System.out.print((char) c);
         }

Is it because the Data is not being FLUSHED (into teh ServletOutPutStream)
from the SOAP Servlet ?
Is it a bug , if so has it been fixed in any of the recent builds ?
Or if its not then Can I make that change ?





Re: Socket Client For a WebService waits

Posted by Scott Nichol <sn...@computer.org>.
I'm not sure off hand why you see the behavior you do, but it is not a bug
in Apache SOAP.  The Apache SOAP client does something similar to what you
do.  Just check the source for org.apache.soap.util.net.HttpUtils#post.

Something important you should see in that code is that it uses a stream to
read the bytes first, then uses the value of the Context-type header to
convert the data to characters.  Your code reads characters using your
default encoding.  This is fine if the server is sending data using that
encoding, but it will cause problems if the server and client use
incompatible encodings.

Scott

----- Original Message -----
From: "Naggi Rao" <na...@softhome.net>
To: <so...@xml.apache.org>
Sent: Wednesday, October 31, 2001 3:45 PM
Subject: Socket Client For a WebService waits


> Hi all,
> I am using a Socket Client to POST a request to a WebService which uses
> Apache's SOAP Engine..
>
> The Socket makes a request and get Results back..
> but at the end (after getting Data from the Socket) it waits indefinetly
> before it relinquishes..
> The snippet of what I use is :
>
>         InputStream in = s.getInputStream();
>         InputStreamReader isr = new InputStreamReader(in);
>
>         BufferedReader br = new BufferedReader(isr);
>         int c;
>         System.out.println("Waiting for results");
>             while ((c = br.read()) != -1) {
>            System.out.print((char) c);
>          }
>
> Is it because the Data is not being FLUSHED (into teh ServletOutPutStream)
> from the SOAP Servlet ?
> Is it a bug , if so has it been fixed in any of the recent builds ?
> Or if its not then Can I make that change ?
>
>
>
>


Re: Socket Client For a WebService waits

Posted by Scott Nichol <sn...@computer.org>.
I'm not sure off hand why you see the behavior you do, but it is not a bug
in Apache SOAP.  The Apache SOAP client does something similar to what you
do.  Just check the source for org.apache.soap.util.net.HttpUtils#post.

Something important you should see in that code is that it uses a stream to
read the bytes first, then uses the value of the Context-type header to
convert the data to characters.  Your code reads characters using your
default encoding.  This is fine if the server is sending data using that
encoding, but it will cause problems if the server and client use
incompatible encodings.

Scott

----- Original Message -----
From: "Naggi Rao" <na...@softhome.net>
To: <so...@xml.apache.org>
Sent: Wednesday, October 31, 2001 3:45 PM
Subject: Socket Client For a WebService waits


> Hi all,
> I am using a Socket Client to POST a request to a WebService which uses
> Apache's SOAP Engine..
>
> The Socket makes a request and get Results back..
> but at the end (after getting Data from the Socket) it waits indefinetly
> before it relinquishes..
> The snippet of what I use is :
>
>         InputStream in = s.getInputStream();
>         InputStreamReader isr = new InputStreamReader(in);
>
>         BufferedReader br = new BufferedReader(isr);
>         int c;
>         System.out.println("Waiting for results");
>             while ((c = br.read()) != -1) {
>            System.out.print((char) c);
>          }
>
> Is it because the Data is not being FLUSHED (into teh ServletOutPutStream)
> from the SOAP Servlet ?
> Is it a bug , if so has it been fixed in any of the recent builds ?
> Or if its not then Can I make that change ?
>
>
>
>