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 8676417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:11:26+00:00 2026-06-12T20:11:26+00:00

I want to know if I put a generics method in jax-ws, like: public

  • 0

I want to know if I put a generics method in jax-ws, like:

public List<MyCustomClass> getSomething()

Does the jax-ws support this?
On the client side what will the return of the method looks like?

  • 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-06-12T20:11:28+00:00Added an answer on June 12, 2026 at 8:11 pm

    You will get a List in the client side (or an array of MyCustomClass objects if the WS consumer is written in another language). That won’t be a problem. Remember to always program to interfaces.

    Looks like you still don’t have much practice creating WS in Java, so I’ll give you some advices:

    • You must not send 2 or more objects that contains a circular reference, or you will end with circular reference problems. This is because the JAX-WS tool will create an interminable XML response for the request. It could be very hard to discover. Let’s see a case:

      public class ClassA {
          ClassB instanceOfB;
          //getters and setters...
      }
      
      public class ClassB {
          ClassA instanceOfA;
          //getters and setters...
      }
      
      public class MyJAXWS {
      
          @WebMethod
          public ClassA getClassA() {
               ClassA classA = new ClassA();
               ClassB classB = new ClassB();
               classB.setInstanceOfA(classA);
               classA.setInstanceOfB(classB);
               return classA; //boom! circular reference problems!
          }
      }
      
    • You must always have interfaces in your return classes, not specific Java library classes. This means, your classes should have List, Set and Map (in case of containers), because this interfaces are in higher level than the implementation classes, and you could get problems if a non-Java client tries to consume your web service method.

      public class ClassC {
      
          List<ClassA> lstClassA; //good!
          ArrayList<ClassB> alstClassB; //not very flexible with other languages =\
      }
      
    • The classes that will go through your web services should be POJOs (Plain Old Java Objects), not service or business logic layer classes. Why? Because only the attributes values will be marshalled/unmarshalled when communicating with the clients, no method code will appear in the contract of your Web Service.

      public class ClassD {
          private int intValue;
          //naive business logic method
          //won't be generated in the WSDL for the clients/consumers of the Web Services
          public void printIntValue() {
              //pretty simple implementation
              System.out.println(this.intValue);
          }
      }
      

    I’ve faced these three problems in my last SOA project with Java. I hope other people could enhance this answer or provide info with links.

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

Sidebar

Related Questions

I don't know exactly how to put this question. I want to create a
I have got problem with this method: public List<int> menu_wid_w_kat() { DataSet1TableAdapters.menu_widac_wszystkoTableAdapter pk =
I want to know if really 'put' has succeeded in putting the file to
I'm starting in the Rails world and i want to know how to put
want to know why String behaves like value type while using ==. String s1
Want to know what is the difference between ipv4 and ipv6 and how does
hi i want to know how to put the json data into html is
i want know how i can manage multiple twitter account on iOS in my
i want know if is possible, to get a specific element value of a
please help me. I want know about what types of flags to run an

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.