Defining a request wrapper for a web service
This recipe describes a method of defining a request wrapper for a web service that is built from Java code. A request wrapper is used by the marshalling process and specifies the bean that is used at runtime. This approach is used in most scenarios when we start developing a web service out of WSDL and want to provide a different Java implementation code.
Getting ready
In this recipe, we will build upon the example from the Wrapping exceptions into faults recipe.
How to do it…
We create a new wrapper class in JDeveloper and name it AuthoriseRequest
. The content of the class is trivial; it contains two members and its getter/setter methods. The annotations of the class are more interesting:
@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "auth", propOrder = { "ccd", "amount" }) public class AuthoriseRequest {
With these annotations, we define the XML complex type auth
with two members: ccd
and amount
.
Now...