THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||
---|---|---|---|---|
| ||||
package com.example.customerservice; @XmlAccessorType( XmlAccessType.FIELD ) public class Customer { String name; String\[\] address; int numOrders; double revenue; BigDecimal test; Date birthDate; CustomerType type; } |
...
Code Block |
---|
package com.example.customerservice; @WebFault(name="NoSuchCustomer") @XmlAccessorType( XmlAccessType.FIELD ) public class NoSuchCustomerException extends RuntimeException { /** * We only define the fault details here. Additionally each fault has a message * that should not be defined separately */ String customerName; } |
Service definition
Code Block | ||||
---|---|---|---|---|
| ||||
package com.example.customerservice;
@WebService
public interface CustomerService {
public Customer[] getCustomersByName(@WebParam(name="name") String name) throws NoSuchCustomerException;
}
|
As you can see only two annotations are necessary here. @WebService marks the interface as a service and @Webparam is necessary as Java will else loose lose the name of the parameter and the wsdl will contain arg0 instead of the desired name. Using the @WebService annotation you can also customize the port name and service name.
...