You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Sebastian J. Schultheiss" <se...@umich.edu> on 2006/03/31 18:06:01 UTC
[Axis2] 0.95 complex types with proprietary MessageReceiver
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
Re: [Axis2] 0.95 complex types with proprietary MessageReceiver
Posted by Ajith Ranabahu <aj...@gmail.com>.
Hi,
Please see my answers inline
On 3/31/06, Sebastian J. Schultheiss <se...@umich.edu> wrote:
> 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();
> }
> }
upto this point what you've done is correct.
> We also wrote a services.xml, wich is attached. Is there a way to auto-generate
> a services.xml? Is ours correct?
Yes. use the -sd option with the codegenerator. Your services.xml
seems to be correct anyway
>
> When deployed as an AAR, Axis2 generates a WSDL that seems to be invalid, it is
> attached as SVMHCServiceComplex_auto.wsdl.
We actually discovered this problem recently and unfortunately it is
not documented anywhere. The Axis2 WSDL generator generates the WSDL
without taking any notice of a generated message receiver and that
screws up the thing when there is a generated message receiver
What you can do is to include the WSDL file inside the META-INF folder
of the aar file. Then axis2 will pickup the correct 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
>
>
>
--
Ajith Ranabahu