Petals-SE-Jsr181 1.1

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (2)

View Page History
throw new Exception( "This is a server side Exception" );
}

/**
* Gets a list of persons.
*/
@WebMethod
public List<Person> getPersons() {
...
}
}
{code}
* The *@WebParam* annotation is used to configure an operation parameter.

\\
{tip}
If one your method returns a collection of beans, do not forget to annotate the fields of the bean class with *@XmlAttribute*.
Otherwise, the WSDL generation will be incomplete (missing elements in the XML schemas).
{tip}

\\
{code:lang=java}import java.util.Calendar;

import javax.xml.bind.annotation.XmlAttribute;

public class Person {

public enum Sex {
F ("Female"),M("Male");

private String textToDisplay;

Sex(String text) {
this.textToDisplay = text;
}

@Override
public String toString() {
return this.textToDisplay;
}
}

@XmlAttribute
private String firstName;

@XmlAttribute
private String surname;

@XmlAttribute
private Calendar birthday;

@XmlAttribute
private Sex sex;

public Person() {
this.firstName = null;
this.surname = null;
this.birthday = null;
this.sex = null;
}

public String getFirstName() {
return firstName;
}

public String getSurname() {
return surname;
}

public Calendar getBirthday() {
return birthday;
}

public Sex getSex() {
return sex;
}
}
{code}

\\
There are many more annotations to use with JAX-WS.
More information is available on the [Apache Axis2 page|http://ws.apache.org/axis2/].