Can I create the object of the class which is runn

2019-09-12 20:17发布

问题:

Currently Learning Web project in Java. I have a doubt related to it. Actually I have a task that, access method of Dynamic projects using JBOSS Server through web services.

Initially I didn't get what I want to do.

After learning some things related to it, I thought that If I run my project on JBOSS, then how can I access the methods of it? How to create the web service and how to use to it?

Or is it like that If I run my project on JBOSS server then is methods directly accessible?

Thats why I thought If I am able to create the object of class which is running on JBOSS server then may I can access the methods.

Please advice me on this.

回答1:

You mentioned application.wadl file. WADL or Web Application Description Language is used to define a contract interface for RESTful web services. Please refer to the links for more information.

Now your problem boils down to :

How to invoke the method of an object exposed as RESTful web service.

Now you already have wadl file with you. Please have a look at a tool called wadl2java. This tool will consume your Application.wadl file and generate java stubs. You can use these generated java classes to invoke the methods on the object deployed in JBoss server.



回答2:

The way you are calling it

localhost:8080/proj-name/<@PATH-name in java stub or module name>/method name

is correct, if services is working fine for you initially, you can modify the path by editing in web.xml or path annotations in your java classes.