I've wrote some simple service that consists of several files (wsdl, xsd). In xsd file I've got following definition:
<xs:complexType name="ServerMessage">
<xs:sequence>
<xs:element name="type" type="xs:int"/>
<xs:element name="info" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="ServerMessage" type="tns:ServerMessage"/>
Then this element is referenced in wsdl file like this
<wsdl:message name="createItemFault">
<wsdl:part name="createItemFault" element="tns:ServerMessage"/>
</wsdl:message>
<wsdl:portType name="Service">
<wsdl:operation name="createItem">
<wsdl:input message="tns:createItemRequest"/>
<wsdl:output message="tns:createItemResponse"/>
<wsdl:fault name="Fault" message="tns:createItemFault"/>
</wsdl:operation>
And at last
<wsdl:binding name="ServiceBinding" type="intf:Service">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="createItem">
<soap:operation soapAction="http://test.com/createItem"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="Fault">
<soap:fault name="Fault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
After launching WSDL2Java I receive the following code
public interface ServerMessage extends org.apache.xmlbeans.XmlObject
{
How come ServerMessage becomes defined like this? When I've used WSDL2Java provided by Axis1 final definition in java file was like this
public class ServerMessage extends org.apache.axis.AxisFault implements java.io.Serializable
And after Axis2 generation resulting "item" is drastically differs, it's not even throwable. What am I doing wrong?
From that WSDL you should get a CreateItemFault
(due to the wsdl:message
name) that looks something like:
public class CreateItemFault extends java.lang.Exception {
private org.example.www.service.ServerMessageDocument faultMessage;
...
}
That ServerMessageDocument
probably looks like:
public interface ServerMessageDocument extends org.apache.xmlbeans.XmlObject {
...
org.example.www.service.ServerMessage getServerMessage();
void setServerMessage(org.example.www.service.ServerMessage serverMessage);
org.example.www.service.ServerMessage addNewServerMessage();
...
}
And here's where we get to your ServerMessage
:
public interface ServerMessage extends org.apache.xmlbeans.XmlObject {
...
}
The method signature should throw a CreateItemFault
, though.