You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rpc-dev@xml.apache.org by Rick Johnston <RR...@symantec.com> on 2002/02/20 18:32:40 UTC

problem with client in applet

I've run into a problem when using XmlRpcClient in an applet running in a
Netscape browser.  In that environment, an exception gets thrown when
execute() opens an InputStream without closing the OutputStream.  The
exception explicitly indicates that HTTPS input isn't expected until the
OutputStream is closed.  I made the following changes in
XmlRpcClient.execute and the problem is indeed resolved (sorry I don't have
the stack trace captured).  The exception trace did indicate that the
"in=con.getInputStream()" line threw the exception.

         if (m_conn != null)
         {
            m_conn.setRequestProperty("Content-Type", "text/xml");
            m_conn.setRequestProperty( "User-Agent", XmlRpc.version );
            if (auth != null)
               m_conn.setRequestProperty("Authorization", "Basic "+auth);
            OutputStream out = m_conn.getOutputStream();
            out.write(request);
            out.flush();
->          out.close();
            in = m_conn.getInputStream();
         }
         else
         {
            URLConnection con = url.openConnection ();
            con.setDoInput (true);
            con.setDoOutput (true);
            con.setUseCaches (false);
            con.setAllowUserInteraction(false);
            con.setRequestProperty ("Content-Length", Integer.toString
(request.length));
            con.setRequestProperty ("Content-Type", "text/xml");
            if (auth != null)
               con.setRequestProperty ("Authorization", "Basic "+auth);
            // con.connect ();
            OutputStream out = con.getOutputStream ();
            out.write (request);
            out.flush ();
->          out.close ();
            in = con.getInputStream ();
         }

Hopefully someone will make this change on my behalf.

Rick



Re: problem with client in applet

Posted by Jon Scott Stevens <jo...@latchkey.com>.
Fixed.

-jon

on 2/20/02 9:32 AM, "Rick Johnston" <RR...@symantec.com> wrote:

> I've run into a problem when using XmlRpcClient in an applet running in a
> Netscape browser.  In that environment, an exception gets thrown when
> execute() opens an InputStream without closing the OutputStream.  The
> exception explicitly indicates that HTTPS input isn't expected until the
> OutputStream is closed.  I made the following changes in
> XmlRpcClient.execute and the problem is indeed resolved (sorry I don't have
> the stack trace captured).  The exception trace did indicate that the
> "in=con.getInputStream()" line threw the exception.
> 
>        if (m_conn != null)
>        {
>           m_conn.setRequestProperty("Content-Type", "text/xml");
>           m_conn.setRequestProperty( "User-Agent", XmlRpc.version );
>           if (auth != null)
>              m_conn.setRequestProperty("Authorization", "Basic "+auth);
>           OutputStream out = m_conn.getOutputStream();
>           out.write(request);
>           out.flush();
> ->          out.close();
>           in = m_conn.getInputStream();
>        }
>        else
>        {
>           URLConnection con = url.openConnection ();
>           con.setDoInput (true);
>           con.setDoOutput (true);
>           con.setUseCaches (false);
>           con.setAllowUserInteraction(false);
>           con.setRequestProperty ("Content-Length", Integer.toString
> (request.length));
>           con.setRequestProperty ("Content-Type", "text/xml");
>           if (auth != null)
>              con.setRequestProperty ("Authorization", "Basic "+auth);
>           // con.connect ();
>           OutputStream out = con.getOutputStream ();
>           out.write (request);
>           out.flush ();
> ->          out.close ();
>           in = con.getInputStream ();
>        }
> 
> Hopefully someone will make this change on my behalf.
> 
> Rick


Re: problem with client in applet

Posted by Jon Scott Stevens <jo...@latchkey.com>.
Fixed.

-jon

on 2/20/02 9:32 AM, "Rick Johnston" <RR...@symantec.com> wrote:

> I've run into a problem when using XmlRpcClient in an applet running in a
> Netscape browser.  In that environment, an exception gets thrown when
> execute() opens an InputStream without closing the OutputStream.  The
> exception explicitly indicates that HTTPS input isn't expected until the
> OutputStream is closed.  I made the following changes in
> XmlRpcClient.execute and the problem is indeed resolved (sorry I don't have
> the stack trace captured).  The exception trace did indicate that the
> "in=con.getInputStream()" line threw the exception.
> 
>        if (m_conn != null)
>        {
>           m_conn.setRequestProperty("Content-Type", "text/xml");
>           m_conn.setRequestProperty( "User-Agent", XmlRpc.version );
>           if (auth != null)
>              m_conn.setRequestProperty("Authorization", "Basic "+auth);
>           OutputStream out = m_conn.getOutputStream();
>           out.write(request);
>           out.flush();
> ->          out.close();
>           in = m_conn.getInputStream();
>        }
>        else
>        {
>           URLConnection con = url.openConnection ();
>           con.setDoInput (true);
>           con.setDoOutput (true);
>           con.setUseCaches (false);
>           con.setAllowUserInteraction(false);
>           con.setRequestProperty ("Content-Length", Integer.toString
> (request.length));
>           con.setRequestProperty ("Content-Type", "text/xml");
>           if (auth != null)
>              con.setRequestProperty ("Authorization", "Basic "+auth);
>           // con.connect ();
>           OutputStream out = con.getOutputStream ();
>           out.write (request);
>           out.flush ();
> ->          out.close ();
>           in = con.getInputStream ();
>        }
> 
> Hopefully someone will make this change on my behalf.
> 
> Rick