aspose file tools
The moose likes Web Services and the fly likes can we expose only required methods of EJB into Web service ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "can we expose only required methods of EJB into Web service ?" Watch "can we expose only required methods of EJB into Web service ?" New topic
Author

can we expose only required methods of EJB into Web service ?

deepa karkala
Ranch Hand

Joined: Jan 29, 2003
Posts: 62
Hello web service experts, please help me. I have an session ejb having couple of methods out only selective methods need to be converted to web service.

I know that I can run java2wsdl, wsdl2java etc to convert an EJB to webservice. But all the methods will be exposed in web service.

Is there any way that only selective methods can be exposed as web service ? I wan to use Apache Axis tools java2wsdl and wsdl2java to conver EJB to web service.

Greately appreciate your valuable suggestion.

thanks
Deepa.
Amit ChaudhariC
Ranch Hand

Joined: Aug 06, 2009
Posts: 33
You can specify what all methods to expose in the services.xml.

Regards,
Amit
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
I am not sure if there is any flag using which you can select methods to be exposed as webservice in java2wsdl. But once WSDL is generated you can manually remove the methods you don't want to expose as webservice. Once you have edited WSDL as needed, run WSDL2java.


SCJP 1.5(97%) My Blog
deepa karkala
Ranch Hand

Joined: Jan 29, 2003
Posts: 62
Thank you Amit and Shivenra.

Shivendra, after dooing so much research in the web, even I got same thoughts . But my concern is, if I edit wsdl file, I am wondering should I modify any other generated files to ensure that all are in sync. In order to avoid this problem, I looked for any option that we may pass while running java2wsdl but I did not fine one.

But I am wondering this topic was not discussed anywhere in any site ( I did not find one). The tool java2wsdl is used when we already have EJB running in some application and we want to make use of its methods in some application or in some other machines. In most of the examples for java2wsdl, I see that existing EJB was considered to convert to Web service. But in every example, only one method is written in EJB which will not be the real case.

I hope some expert will get back to my question with proper solution (if I am lucky) :-).

thanks
deepa
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
Deepa, If you are using AXIS2 then since WSDL will be only output so you don't need to worry about syncing.

Anyway if you don't want to edit your WSDL, good news is java2wsdl has flag "-m" to export only limited method to WSDL.

Refer this for more info http://ws.apache.org/axis/java/reference.html#Java2WSDLReference

-Shiv
deepa karkala
Ranch Hand

Joined: Jan 29, 2003
Posts: 62
Wow ! that's great. Thank you very much Shivendra. I am lucky today :-).

thanks
deepa
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can we expose only required methods of EJB into Web service ?
 
Similar Threads
Info while runing the WSDL2java as standalone application
Basic doubts in Web services
wsdl error
Which way to create a web service?
@WebMethod annotation