Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6219805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:50:51+00:00 2026-05-24T07:50:51+00:00

Is it possible (Java EE, JBoss 6) to cleverly annotate Java code to provide

  • 0

Is it possible (Java EE, JBoss 6) to cleverly annotate Java code to provide both RESTful and SOAP webservices without implementing two methods?

I’m thinking about:

@Local
@Path("/service")
@WebService
public interface SomeService {
    @GET @Path("somemethod")
    @WebMethod
    public String someMethod (@QueryParam("s") String someParam);
}

Please notice both @Path and @WebService annotations (above example does not work unfortunately).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:50:52+00:00Added an answer on May 24, 2026 at 7:50 am

    While JAX-WS and JAX-RS annotations can quite happily cohabit on the same methods, I find it hard to believe that any interface that is well-tuned for use with JAX-RS could be a good fit for JAX-WS, or vice versa. The problem isn’t that you can’t do it, the problem is that you shouldn’t; they have a different model of the world, a different concept of what it means to be a good interface.

    But if you’re just doing something trivial like a simple lookup, it can indeed work:

    @GET
    @Path("foo/{id}")
    @Produces("application/xml")
    @WebMethod(operationName = "DescribeFoo")
    @WebResult(name = "Description")
    public DescriptionOfFoo getFooDescription(
            @PathParam("id")
            @WebParam(name = "fooId")
            String id) {
        return get_the.description_of(id); // Whatever...
    }
    

    I like to put as much as I can on interfaces though (check your framework documentation for how to make them work) as that reduces the above partial (!!) set of possible annotations down to a more sensible level. (For reference, when things start to get complicated and you’re applying multiple aspects in non-trivial patterns, you can easily get to over 20 annotations per method, some of which relate to your implementation and some of which relate to one or other of your interfaces; partitioning promotes sanity.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Java documentation says: it is not possible for two invocations of synchronized methods
Is it possible to know whether a Java class has been loaded, without attempting
I would like to know if its possible to deploy java class files without
Possible Duplicate: How can I convert my java program to an .exe file ?
Possible Duplicate: How do you send email from a Java app using Gmail? How
Java requires that you catch all possible exceptions or declare them as thrown in
Is it possible to specify a Java classpath that includes a JAR file contained
Is it possible to create a java representation of a package-level oracle associative array.
Is it possible to truncate a Java string to the closest word boundary after
Is it possible to handle POSIX signals within the Java Virtual Machine? At least

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.