You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Siomara Pantarotto <hi...@hotmail.com> on 2001/09/27 05:07:44 UTC

Calling a servlet in TC4 from VB

Hi All,

I have a servlet running under tomcat that is called by many points of my 
java application. It works perfectly.

Now, my manager wants me to invoke this servlet from a VB application 
(desktop). I have no idea on how to do that, or if this is possible.

I decided to share this with you and ask for suggestions.

Thanks

Siomara

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


Re: Calling a servlet in TC4 from VB

Posted by Leandro <le...@persogo.com.br>.
Hi
U can use some OLE objects (IE5.5 has one I know) that encapsulate the
concept of a HTTP GET/POST request and just call your servlet.

Or you can open a socket (port:80) to your tomcat and do the same (i don't
know if VB does that) !

If you have any doubts please email me
leandro@solutionweb.com.br

----- Original Message -----
From: Siomara Pantarotto <hi...@hotmail.com>
To: <to...@jakarta.apache.org>
Sent: Thursday, September 27, 2001 12:07 AM
Subject: Calling a servlet in TC4 from VB


> Hi All,
>
> I have a servlet running under tomcat that is called by many points of my
> java application. It works perfectly.
>
> Now, my manager wants me to invoke this servlet from a VB application
> (desktop). I have no idea on how to do that, or if this is possible.
>
> I decided to share this with you and ask for suggestions.
>
> Thanks
>
> Siomara
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>


Re: Calling a servlet in TC4 from VB

Posted by Bo Xu <bo...@cybershop.ca>.
Siomara Pantarotto wrote:

> Hi All,
>
> I have a servlet running under tomcat that is called by many points of my
> java application. It works perfectly.
>
> Now, my manager wants me to invoke this servlet from a VB application
> (desktop). I have no idea on how to do that, or if this is possible.
>
> I decided to share this with you and ask for suggestions.
>
> Thanks
>
> Siomara
> [...]

if VB also has a http-client module(like URLConnection), you can use it to
access TOMCAT .

 you also can use TCP socket to access TOMCAT directly, you can write the
first
several bytes(http header) by youself, for example, the following is a simple
"POST":

            String headerData=
                "POST /" + "myapp/servlet/MYServlet" + "? HTTP/1.1" + '\r'
+'\n' +
                "Content-Type: application/x-www-form-urlencoded" + '\r' +'\n'
+
                "User-Agent: Java1.3.0" + '\r' +'\n' +
                "Host: " + "xxx.xxx.xxx.xxx(IP)" + ":" + "8080" + '\r' +'\n' +

                "Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ '\r' +'\n' +
                "Connection: Keep-Alive" + '\r' +'\n' +
                "Content-length: " + Integer.toString(outData.length) + '\r'
+'\n' +
                '\r' +'\n';

and after send this header, then send outData(a byte array)


Bo
Sept.27, 2001