File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Can i host  web service through batch file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Can i host  web service through batch file" Watch "Can i host  web service through batch file" New topic

Can i host web service through batch file

kannagiri rosei
Ranch Hand

Joined: Nov 26, 2005
Posts: 31

i just want to host my web service from batch file.

my batch files are exe(java).

consider my java file is two method add and subract

i want to host this methods as web service from batch files

my batch file run in d:/imwf/java

how to host web service in tomcat remotely without putting my class file inside the tomcat??
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
A web service has to respond to requests - how were you planning to receive a request if not through a web server like Tomcat?
Define how you want the outside world to communicate with your service.
kannagiri rosei
Ranch Hand

Joined: Nov 26, 2005
Posts: 31

i am creating java exe using batchfile. am calling batchfile

inside my Mqworkflow BuildTime - process Template i configured the exe .

when the document is triggerred from mq workflow it will execute my java exe and move to next activity based on some condition in sample.FDL file.

i assume that u know Mq workflow that is qhy am writing this mail to u.

here when my batch file runs in the Mq workflow - process.

my web service need three input from third party guys

based on that input i use my logic.

when i start trigger the process from MQ workflow.
is it possible to call web service?
inside my exe.

like my class file is here (path).(D;//imwf/java/giri.jar

is it possible to configure tomcat to directly call this jar(outside WEB-INF)
execute request/responses.
[ December 05, 2005: Message edited by: kannagiri rosei ]
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
Earlier you mentioned you want to host a webservice. If I understood correctly, now I guess you want to know how to call and consume an existing webservice ??
Is that right ? If yes.. then its possible. Try to see how java client samples that is shipped with Apache Axis.
Import or refer the necessary class for consuming the webserivce along with your giri.jar file. Then you should be able to consume a webservice.
Axis Samples:

Spritle Software Blogs
kannagiri rosei
Ranch Hand

Joined: Nov 26, 2005
Posts: 31
no balaji

the path i mentioned will be executed in Mqworkflow configuration.

i configure giri.jar file will be condigured out side web app.

my batch files will be there in the path.

simply i will take this path and inside MQ workflow -process template i will give this path.

when i start MQ it auotmatically executes java exe.

now tell me
my web service method which is hosted on TOMCAT.

when client call my web service
method add 4 5
i need pass those (4,5) parameters from (integration-any external program) externally to use inside my batch file.

when they access my URL defintely it will execute inside web-inf/classes/myservice -this class i want automatically executed
in my batch file-any way

please tell me.
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
Calling webservice is as simple as running a java method/function.
For example...
if you want your giri.jar to send an email, then you will need the mail.jar file configured to your MQ workflow..
That is mail.jar file should be available at runtime classpath. Otherwise the system will throw "class not found exception.."
Please let me know whether you understood the above logic ??

Simillar to that calling a webservice requires you have some jar files configured to your workflow. Once done, you can call a webserivce.
kannagiri rosei
Ranch Hand

Joined: Nov 26, 2005
Posts: 31
hi balaji.

i can call a web service,but i want to host my webservice method

is outside webserver.(remotely).

let me clear:

1. my method is in c:/imwf/java

2. i used deploy.wsdd -the class files if i copy it in web server/web-inf/classes only it will work write?

3.i don't want that, my class files will be here
D:/imwf/java if i run deploy.wsdd it should automatically connect web server
and my method in the path should execute.the path i specified that method should execute.

but what actually is doing here is in axis when i deploy.wsdd?

am running deploy.wsdd in the path D:/imwf/java/MyService //org.apache.axis.client.AdminClient deploy.wsdd
please this issue only?

weather should i have to copy these files in web-inf/classes dir

or it is automatically copy's the files inside webinf/classes/

if this happens automatically?

D;/imwf/java/myservice will execute or tomcat server/myservice will execute?

please tell me.

where the my service method will be called.
I agree. Here's the link:
subject: Can i host web service through batch file
jQuery in Action, 3rd edition