MyEclipse Forums
This thread has been locked & this forum has been archived.
Please post new topics to General Development
View previous topic Printable version Log in to check your private messages View next topic
Author Message
kokomelle
Post subject: using jax-ws unable to have a setter for method with array  PostPosted: Apr 26, 2012 - 06:10 PM



Joined: Apr 26, 2012
Posts: 1

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
 
 View user's profile Send private message  
Reply with quote Back to top
support-swapna
Post subject:   PostPosted: Apr 27, 2012 - 01:05 PM



Joined: Nov 11, 2010
Posts: 2491

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:
*

* getUPreferences().add(newItem);
*


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.

_________________
Swapna
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits