Hi Dave,
thank you for trying to help me!
I attached my WSDL file which uses a abstract-type and a extension. The
WSDL file validates fine with the Eclipse WTP Validator.
My Service directory structure is the folloging:
webapps/axis2/WEB-INF/services
inheritance
META-INF
services.xml
inheritance.wsdl
org
apache
...
example
...
w3
...
xmlsoap
..
schemaorg_apache_xmlbeans
...
So I already have the generated files in my classpath. I also tried to
package them in a jar and place it under services/inheritance/lib but
that didn't help.
I don't want to do crazy things with axis2 ;-)
I hope that I have some errors in my WSDL file because I think that the
building of my service is correct.
By the way:
I know that this will not help much but I'll show the Exception that
occured on the serverside:
<?xml version="1.0" encoding="http://schemas.xmlsoap.org/soap/envelope/"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>Data binding error</faultstring>
<detail>
<Exception>org.apache.axis2.AxisFault: Data binding error; nested
exception is:
java.lang.RuntimeException: Data binding error
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:318)
at
org.apache.axis2.InheritanceMessageReceiverInOut.invokeBusinessLogic(InheritanceMessageReceiverInOut.java:66)
at
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:37)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:454)
at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:284)
at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:136)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.RuntimeException: Data binding error
at
org.apache.axis2.InheritanceMessageReceiverInOut.fromOM(InheritanceMessageReceiverInOut.java:158)
at
org.apache.axis2.InheritanceMessageReceiverInOut.invokeBusinessLogic(InheritanceMessageReceiverInOut.java:50)
... 20 more
Caused by: java.lang.NullPointerException
at
org.apache.xmlbeans.impl.store.Cur$CurLoadContext.attr(Cur.java:3041)
at
org.apache.xmlbeans.impl.store.Cur$CurLoadContext.attr(Cur.java:3058)
at
org.apache.xmlbeans.impl.store.Locale.doNamespaces(Locale.java:900)
at
org.apache.xmlbeans.impl.store.Locale.loadXMLStreamReader(Locale.java:1135)
at
org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:843)
at
org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:826)
at
org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:231)
at
org.example.www.inheritance.SaveRequestDocument$Factory.parse(SaveRequestDocument.java:128)
at
org.apache.axis2.InheritanceMessageReceiverInOut.fromOM(InheritanceMessageReceiverInOut.java:137)
... 21 more
</Exception>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Thank you very much,
Siamak Haschemi
Dave MacLean schrieb:
Hi Siamak,
You should be able to use extensions with xmlbeans and axis2 no problem.
I've managed to get a very similar scenario working here. One important
point is to make sure all of the generated xml beans classes are also
included in your classpath somewhere (I jar them all up in a separate
jar). Without those, I was also getting a databinding error.
If you want to post your wsdl I wouldn't mind taking a quick look.
-Dave
-----Original Message-----
From: Siamak Haschemi [mailto:[EMAIL PROTECTED]
Sent: Monday, May 08, 2006 12:36 PM
To: [email protected]
Subject: [axis2] How would you do this?
Hello to all.
I'll be happy if someone could help me.
I want to create a Web-Service which uses abstract-types and extensions.
Until now I try to use Axis2 with XmlBeans but I go crazy because Axis2
always throws Databinding errors (see
http://issues.apache.org/jira/browse/AXIS2-644).
So *PLEASE* can someone help me with this?
Maybe the usage of extensions is not right for my scenario so I'm gonna
describe it i a few words:
Think of having the Classes
- User
- Product
- Profile
A Web-Service provides the following operations for all this classes:
- save
- update
- getAll
- get
- delete
So should I go and write so much wsdl-messages?
-saveUserRequest
-saveUserResponse
- saveProductRequest
- saveProductResponse
- saveProfileRequest
- saveProfileResponse
- updateProductRequest
.......
No, I don't think so. So is the usage of abstract-types and extensions
right here?
Thank you very much,
Siamak Haschemi
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.example.org/inheritance/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="inheritance"
targetNamespace="http://www.example.org/inheritance/">
<wsdl:types>
<xsd:schema targetNamespace="http://www.example.org/inheritance/">
<xsd:complexType name="mytype" abstract="true" />
<xsd:complexType name="product">
<xsd:complexContent>
<xsd:extension base="tns:mytype">
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="saveRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="mytype" type="tns:mytype" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="saveResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="id" type="xsd:long" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="saveRequest">
<wsdl:part element="tns:saveRequest" name="saveRequest" />
</wsdl:message>
<wsdl:message name="saveResponse">
<wsdl:part element="tns:saveResponse" name="saveResponse" />
</wsdl:message>
<wsdl:portType name="inheritance">
<wsdl:operation name="save">
<wsdl:input message="tns:saveRequest" />
<wsdl:output message="tns:saveResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="inheritanceSOAP" type="tns:inheritance">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="save">
<soap:operation soapAction="http://www.example.org/inheritance/save" />
<wsdl:input>
<soap:body parts="saveRequest" use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body parts="saveResponse" use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="inheritance">
<wsdl:port binding="tns:inheritanceSOAP" name="inheritanceSOAP">
<soap:address location="http://www.example.org/" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>