Java Reference
In-Depth Information
Defining Zero-Argument Operations
Problem
You are using a Start from Schema approach to develop your service, and you need to know
how to represent a Java method that does not take any arguments.
Solution
Say you have the following Java method that takes no arguments:
@WebMethod
public boolean startBatch(){
return true;
}
If you want to have JAX-WS generate the WSDL for you, you're done. But if you are starting
from schema, what do you type to represent nothing? Use the following schema definition:
<xs:schema xmlns:tns="urn:myNs"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.0" targetNamespace="urn:myNs">
<xs:element name="startBatch" type="tns:startBatch" />
<xs:element name="startBatchResponse" type="tns:startBatchResponse" />
<xs:complexType name="startBatch">
<xs:sequence />
</xs:complexType>
<xs:complexType name="startBatchResponse">
<xs:sequence>
<xs:element name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
The key is to define a schema element and have it refer to a complex type, but to have the
complex type define an empty sequence.
Search WWH ::




Custom Search