Hi there,
we would like to write a service that accepts and returns xs:complex-types. We
tried to do so by hand, going from the Java class to an axis-generated WSDL, but
we always ended up with xs:any-types. So we now tried to define a WSDL and go
from there, by using the WSDL2Java command line tool.
Our input WSDL is attached as SVMHCServiceComplex.wsdl. We left the generated
classes alone except for the PortSkeleton, where we implemented this simple
business logic in the method indicated by the Todo comment:
public axis2.apache.org.xsd.PredictEpitopesResponseDocument predictEpitopes(
axis2.apache.org.xsd.PredictEpitopesRequestDocument param0)
throws Exception {
try{
PredictEpitopesResponseDocument ret =
PredictEpitopesResponseDocument.Factory.newInstance();
ret.getPredictEpitopesResponse().setBoolres(true);
ret.getPredictEpitopesResponse().setFloatres((float)23.42);
ret.getPredictEpitopesResponse().setStringres(allele + "\t" +
sequence);
return ret;
} catch(Exception e){
//TODO fill this with the necessary business logic
throw new java.lang.UnsupportedOperationException();
}
}
We also wrote a services.xml, wich is attached. Is there a way to auto-generate
a services.xml? Is ours correct?
When deployed as an AAR, Axis2 generates a WSDL that seems to be invalid, it is
attached as SVMHCServiceComplex_auto.wsdl. We tried to use our generic Client
which creates an OMElement that corresponds to the request specifications from
our original WSDL.
The communication however doesn't work, it gives us this as a response:
org.apache.axis2.AxisFault: Transport error 500 . Error Message is
<html><head><title>Apache Tomcat/5.5.15 - Error report</title>
<p><b>description</b> <u>The server encountered an internal error () that
prevented it from fulfilling this request.</u></p><p><b>exception</b>
<pre>javax.servlet.ServletException: Servlet execution threw an exception
</pre></p><p><b>root cause</b> <pre>java.lang.NoClassDefFoundError
axis2.apache.org.xsd.PredictEpitopesRequestDocument$Factory.parse(PredictEpitopesRequestDocument.java:150)
svmhc.complex.service.SVMHCServicePortMessageReceiverInOut.fromOM(SVMHCServicePortMessageReceiverInOut.java:142)
svmhc.complex.service.SVMHCServicePortMessageReceiverInOut.invokeBusinessLogic(SVMHCServicePortMessageReceiverInOut.java:51)
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:37)
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:408)
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:288)
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:160)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Can you give us some hints as how to create a service that accepts
xs:complex-types? Is it ok to just overwrite the auto-generated WSDL with our
original? Is it ok for the auto-generated one to look like this?
Thanks a lot for your time,
-- Sebi
<wsdl:definitions xmlns:ns1="http://org.apache.axis2/xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://org.apache.axis2/"
targetNamespace="http://org.apache.axis2/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns1="http://org.apache.axis2/xsd"
targetNamespace="http://org.apache.axis2/xsd"
elementFormDefault="unqualified" attributeFormDefault="unqualified">
<xs:element name="predictEpitopesRequest">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="sequence"/>
<xs:element type="xs:string" name="allele"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="predictEpitopesResponse">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="stringres"/>
<xs:element type="xs:float" name="floatres"/>
<xs:element type="xs:boolean" name="boolres"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="predictEpitopesResponseMessage">
<wsdl:part name="part1" element="ns1:predictEpitopesResponse"/>
</wsdl:message>
<wsdl:message name="predictEpitopesRequestMessage">
<wsdl:part name="part1" element="ns1:predictEpitopesRequest"/>
</wsdl:message>
<wsdl:portType name="SVMHCServicePort">
<wsdl:operation name="predictEpitopes">
<wsdl:input message="tns:predictEpitopesRequestMessage"/>
<wsdl:output message="tns:predictEpitopesResponseMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SVMHCServiceBinding" type="tns:SVMHCServicePort">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
<wsdl:operation name="predictEpitopes">
<soap:operation soapAction="predictEpitopes" style="document"/>
<wsdl:input>
<soap:body use="literal"
namespace="http://www.org.apache.axis2"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"
namespace="http://www.org.apache.axis2"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SVMHCService">
<wsdl:port name="SVMHCServicePortType0"
binding="tns:SVMHCServiceBinding">
<soap:address
location="http://localhost/axis2/services/SVMHCService:localhost/axis2/services/SVMHCService"
/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
<wsdl:definitions xmlns:ns1="http://org.apache.axis2/xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://org.apache.axis2/"
targetNamespace="http://org.apache.axis2/"><wsdl:types><xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns1="http://org.apache.axis2/xsd"
targetNamespace="http://org.apache.axis2/xsd" elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<xs:element type="ns1:PredictEpitopesRequestDocument"
name="PredictEpitopesRequestDocument" />
<xs:complexType name="PredictEpitopesRequestDocument">
<xs:sequence>
<xs:element type="ns1:PredictEpitopesRequestDocument$PredictEpitopesRequest"
name="predictEpitopesRequest" />
</xs:sequence>
</xs:complexType>
<xs:element type="ns1:PredictEpitopesRequestDocument$PredictEpitopesRequest"
name="PredictEpitopesRequestDocument$PredictEpitopesRequest" />
<xs:complexType name="PredictEpitopesRequestDocument$PredictEpitopesRequest">
<xs:sequence />
</xs:complexType>
<xs:element type="ns1:PredictEpitopesResponseDocument"
name="PredictEpitopesResponseDocument" />
<xs:complexType name="PredictEpitopesResponseDocument">
<xs:sequence>
<xs:element type="ns1:PredictEpitopesResponseDocument$PredictEpitopesResponse"
name="predictEpitopesResponse" />
</xs:sequence>
</xs:complexType>
<xs:element type="ns1:PredictEpitopesResponseDocument$PredictEpitopesResponse"
name="PredictEpitopesResponseDocument$PredictEpitopesResponse" />
<xs:complexType name="PredictEpitopesResponseDocument$PredictEpitopesResponse">
<xs:sequence />
</xs:complexType>
<xs:element name="predictEpitopesRequest">
<xs:complexType>
<xs:sequence>
<xs:element type="ns1:PredictEpitopesRequestDocument" name="param0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="predictEpitopesResponse">
<xs:complexType>
<xs:sequence>
<xs:element type="ns1:PredictEpitopesResponseDocument" name="return" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema></wsdl:types><wsdl:message
name="predictEpitopesResponseMessage"><wsdl:part name="part1"
element="ns1:predictEpitopesResponse" /></wsdl:message><wsdl:message
name="predictEpitopesRequestMessage"><wsdl:part name="part1"
element="ns1:predictEpitopesRequest" /></wsdl:message><wsdl:portType
name="SVMHCServiceComplexPort"><wsdl:operation
name="predictEpitopes"><wsdl:input message="tns:predictEpitopesRequestMessage"
/><wsdl:output message="tns:predictEpitopesResponseMessage"
/></wsdl:operation></wsdl:portType><wsdl:binding
name="SVMHCServiceComplexBinding"
type="tns:SVMHCServiceComplexPort"><soap:binding
transport="http://schemas.xmlsoap.org/soap/http" style="document"
/><wsdl:operation name="predictEpitopes"><soap:operation
soapAction="predictEpitopes" style="document" /><wsdl:input><soap:body
use="literal" namespace="http://www.org.apache.axis2"
/></wsdl:input><wsdl:output><soap:body use="literal"
namespace="http://www.org.apache.axis2" /></wsdl:output></wsdl:operatio
n></wsdl:binding><wsdl:service name="SVMHCServiceComplex"><wsdl:port
name="SVMHCServiceComplexPortType0"
binding="tns:SVMHCServiceComplexBinding"><soap:address
location="http://localhost/axis2/services/SVMHCServiceComplex:localhost/axis2/services/SVMHCServiceComplex"
/></wsdl:port></wsdl:service></wsdl:definitions>
<service name="SVMHCServiceComplex">
<description>
Service Complex
</description>
<parameter name="ServiceClass" locked="false">svmhc.complex.service.SVMHCServiceComplex</parameter>
<operation name="predictEpitopes">
<messageReceiver class="svmhc.complex.service.SVMHCServicePortMessageReceiverInOut"/>
</operation>
</service>