facebook

using jax-ws unable to have a setter for method with array

  1. MyEclipse Archived
  2.  > 
  3. Web 2.0 / AJAX
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #325589 Reply

    kokomelle
    Member

    Hi
    I use axis2 and jax-ws to generate a web service client.
    In the service I have a method that contains in parameter a complex type
    public int sendSaveUserPreferencesWS(UserSetWS[] prefs)

    the UserSetWS class defined as follow:

    public class UserSetWS {

    private String setName;
    private UserPreferenceWS[] userPreferences;

    /**
    *
    * @param setName
    * @param uPreferences
    */
    public UserSetWS(String setName, UserPreferenceWS[] uPreferences) {
    this.setName = setName;
    this.userPreferences = uPreferences;
    }

    public void setTiti(String[] setNam){
    this.setName = setNam[0];
    }

    public String getSetName() {
    return setName;
    }

    public void setSetName(String setName) {
    this.setName = setName;
    }

    public int setuPreferences(UserPreferenceWS[] userPreferences) {
    this.userPreferences = userPreferences;
    return 0;
    }

    public UserPreferenceWS[] getuPreferences() {
    return userPreferences;
    }

    }

    after generating the clien code. The class UserSetWS is generated but without the method setuPreferences and I’m enable to use the constructor with parameters. the only constructor is new UserSetWS ()

    could you help me ?

    thanks in advance

    #325608 Reply

    support-swapna
    Moderator

    kokomelle,

    If you look at the generated client code for the class UserSetWS in the comments section for getUPreferences method :

    * This accessor method returns a reference to the live list, not a
    * snapshot. Therefore any modification you make to the returned list will
    * be present inside the JAXB object. This is why there is not a
    * <CODE>set</CODE> method for the uPreferences property.
    * <p>
    * For example, to add a new item, do as follows:
    * <pre>
    * getUPreferences().add(newItem);
    * </pre>

    This pretty much explains why you are not seeing the setter method for the complex type.

    I think the WSDL only operates on a no-arguments constructor. I am not sure about this one. I suggest you check on Webservices forums for better support on how to get it working.

    Hope this helps.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: using jax-ws unable to have a setter for method with array

You must be logged in to post in the forum log in