Within a WSDL it's possible to define a portType whose output message has multiple parts. This is unusual for Java which can only declare a single return type. By contrast, other programming languages, such as C++, can declare multiple return types in the form of INOUT and OUT parameters. Because WSDL is language-agnostic, it allows Web services to define INOUT and OUT parameters in addition to the IN parameters typically used in Java. JAX-RPC overcomes Java's limitations, and accommodates INOUT and OUT parameters through the use of special wrapper classes, called holders. For example, consider the following WSDL fragment:
<wsdl:message name="outgoingResponse">
<wsdl:part name="status" type="xsd:string"/>
<wsdl:part name="totalSale" type="xsd:decimal"/>
<wsdl:part name="saleCategory" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="incomingRequest">
<wsdl:part name="branch" type="xsd:string"/>
<wsdl:part name="SaleNumber" type="xsd:integer"/>
<wsdl:part name="companyNo" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="fault">
<wsdl:part name="saleFault" type="xsd:string">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="StatusInterface">
<wsdl:operation name="getStatus">
<wsdl:input message="tns:incomingRequest"/>
<wsdl:output message="tns:outgoingResponse"/>
<wsdl:fault name="saleFault" message="tns:fault"/>
</wsdl:operation>
</wsdl:portType>
The Java interface generated in this case is:
public interface StatusInterface extends java.rmi.Remote {
public void getStatus(java.lang.String branch, java.math.BigInteger saleNumber, java.lang.String companyNo, javax.xml.rpc.holders.StringHolder status, javax.xml.rpc.holders.BigDecimalHolder totalSale, javax.xml.rpc.holders.StringHolder saleCategory) throws java.rmi.RemoteException, au.com.landmark.Fault;
}
Here, the first three parameters are normal IN parameters, declared as a part of the input message. Because they are IN parameters, the generated interface can use a conventional core-Java type declaration. The other parameters, however, are declared as parts of the output message, and must enable the Web service to pass information back to the client. Core-Java types won't do, so the interface declares these parameters using javax.xml.rpc.holders.Holder types.
I've managed to get this type of web service running under WebSphere but I ran into all sorts of deployment problems under JBoss. This is still a work in progress.
Another point to consider: if you're returning more than a handful of parameters, you might be best to look at a document-style web service.