Hello Ajith.

Sorry, I thought I put all the relevant infos into my mail.

It is on the server side. On the client-side everything goes o.k. There I can use changeType very well.

Again, the identical Skeleton works if a call it outside of Axis2.

I already testet to unpack the xmlbean-resources like:

care
+ org
 + haschemi
 + ...
+ schemaorg_apache_xmlbeans
 ...
+ META-INF
 + services.xml

And I also put the packed XBeans-packaged.jar into the axis2/WEB-INF folder.

None of this changes works.

Is there a way to increase the verbosity of xmlbeans? I tried to change the 
log4j.properties in the axis2/WEB-INF/conf folder but nothing has been printed.


------------

Here is the Request and the Response:

<?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>
   <addProductRequest xmlns="http://haschemi.org/shop/common";>
<product xmlns:com="http://haschemi.org/shop/common"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; id="3" xsi:type="com:milk-type"> <fillingQuantity>55.55</fillingQuantity>
     </product>
   </addProductRequest>
 </soapenv:Body>
</soapenv:Envelope>


<?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>org.haschemi.shop.common.impl.ProductTypeImpl; nested exception is: 
java.lang.ClassCastException: 
org.haschemi.shop.common.impl.ProductTypeImpl</faultstring>
     <detail>
<Exception>org.apache.axis2.AxisFault: org.haschemi.shop.common.impl.ProductTypeImpl; nested exception is: java.lang.ClassCastException: org.haschemi.shop.common.impl.ProductTypeImpl&#13;
          at org.apache.axis2.AxisFault.makeFault(AxisFault.java:318)&#13;
          at 
org.haschemi.shop.service.SpringCareMessageReceiverInOut.invokeBusinessLogic(SpringCareMessageReceiverInOut.java:66)&#13;
          at 
org.haschemi.shop.service.SpringAbstractInOutSyncMessageReceiver.receive(SpringAbstractInOutSyncMessageReceiver.java:37)&#13;
          at 
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:450)&#13;
          at 
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:305)&#13;
          at 
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:164)&#13;
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)&#13;
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)&#13;
          at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)&#13;
          at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)&#13;
          at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)&#13;
          at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)&#13;
          at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)&#13;
          at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)&#13;
          at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)&#13;
          at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)&#13;
          at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)&#13;
          at 
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)&#13;
          at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)&#13;
          at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)&#13;
          at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)&#13;
          at java.lang.Thread.run(Thread.java:595)&#13;
       Caused by: java.lang.ClassCastException: 
org.haschemi.shop.common.impl.ProductTypeImpl&#13;
          at 
org.haschemi.shop.service.SpringCareSkeleton.addProduct(SpringCareSkeleton.java:64)&#13;
          at 
org.haschemi.shop.service.SpringCareMessageReceiverInOut.invokeBusinessLogic(SpringCareMessageReceiverInOut.java:51)&#13;
          ... 20 more&#13;
       </Exception>
     </detail>
   </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>




Thank you very much for your support,

Siamak Haschemi




Ajith Ranabahu schrieb:
Hi,
Do you get the classcast exception in the server side or the client
side ? if it is the client side it could be due to either the type
attribute being missing or not being namespace qualified.
If so can you pipe the requests through tcpmon and send the request
and response messages ?

On 4/18/06, Siamak Haschemi <[EMAIL PROTECTED]> wrote:
Hello to all.

I have a problem with Axis2 and XMLBeans and I think that this could be
a bug.

I have a WSDL-file with the following schemas:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
elementFormDefault="qualified"
      targetNamespace="http://haschemi.org/sale/common";>

      <xsd:complexType name="product-type" abstract="true">
        <xsd:attribute name="id" type="xsd:long" />
      </xsd:complexType>

      <xsd:complexType name="milk-type">
        <xsd:complexContent>
          <xsd:extension base="common:product-type">
            <xsd:attribute name="fillingQuantity" type="xsd:float" />
          </xsd:extension>
        </xsd:complexContent>
      </xsd:complexType>

      <xsd:element name="addProductRequest">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="product" type="common:product-type"
minOccurs="0" maxOccurs="unbounded" />
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>

      <xsd:element name="addProductResponse">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="productId" type="xsd:long" minOccurs="0"
maxOccurs="unbounded" />
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>

    </xsd:schema>

I used WSDL2Java to generate the service and the xmlbean-resources. The
xmlbean-resources are packed into a jar file and placed in the
lib-directory of the .aar service.

care
+ org
  + haschemi
  + ...
+ lib
+ XBeans-packaged.jar
+ META-INF
  + services.xml

The calling part is:

...
final AddProductRequestDocument addProductRequestDocument =
AddProductRequestDocument.Factory.newInstance();
final AddProductRequest addProductRequest =
addProductRequestDocument.addNewAddProductRequest();
final ProductType productType = addProductRequest.addNewProduct();
final MilkType milkType = (MilkType) productType.changeType(MilkType.type);
milkType.setFillingQuantity(44.44f);
...

In the generated Skeleton I put the following lines:

public org.haschemi.sale.common.AddProductResponseDocument addProduct(
            org.haschemi.sale.common.AddProductRequestDocument param0) {
        final AddProductRequest addProductRequest =
param0.getAddProductRequest();

        for (ProductType productType :
addProductRequest.getProductArray()) {
            final MilkType milkType = (MilkType)
productType.changeType(MilkType.type);
        }
    }

I get a exception of the changeType call:
java.lang.ClassCastException: org.haschemi.sale.common.impl.ProductTypeImpl

It seems that the changeType method returns the abstract basetype
(product-type) instead of the derived one (milk-type).


BUT the strangest thing is that is works outside of axis2. I wrote a
litte Main-Class and I call the Skeleton manually and everything goes ok.

So I think that this can be a Axis2 Bug. Something with the classloader?



I'm sorry for the long e-mail.

Thanks a lot,

Siamak Haschemi









--
Ajith Ranabahu



Reply via email to