Title: Abstract classes and inheritance
Hi, my problem is, that i have representation of my abstract class SymbolType in XXXSoapBindingStub.java:
qName = new javax.xml.namespace.QName("http://www.opengis.net/sld", "SymbolType");
            cachedSerQNames.add(qName);
            cls = net.opengis.www.sld.SymbolType.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(beansf);
            cachedDeserFactories.add(beandf);
 
This representation is in method private void addBindings1()
And representation of class which inherti from her is in method private void addBindings0()
 qName = new javax.xml.namespace.QName("http://www.opengis.net/sld", ">LineSymbol");
            cachedSerQNames.add(qName);
            cls = net.opengis.www.sld.LineSymbol.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(beansf);
            cachedDeserFactories.add(beandf);
So do you have any others ideas how to solve my problem?
Tahnks
            Ales
 
 
----- Original Message -----
Sent: Tuesday, December 06, 2005 5:41 PM
Subject: AW: Abstract classes and inheritance

I didn't change wsdls, but put the method into the class that represents my webservice. After generating the stub it should occur int the XXXSoapBindingStub.java.
-----Ursprüngliche Nachricht-----
Von: Ales St [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 6. Dezember 2005 17:32
An: [email protected]
Betreff: Re: Abstract classes and inheritance

Hi Markus,
you add your  dummyMethod(Message message) in your XXXSoapBindingImpl.java or somewhere else?Or do you change a wsdl? Because in this file I have some methods for example like your dummy method :void dummyMethod(SymbolType symbol) and it still not work.
----- Original Message -----
Sent: Tuesday, December 06, 2005 3:50 PM
Subject: AW: Abstract classes and inheritance

Hi Ales,
well, of course, one cannot instantiate an abstract class. But it doesn't matter if the base class is abstract or not. It comes to the same.
Well, almost.
 
My method in the service:
Message[] getMessages()
{
     return {new DefaultMessage(), new DefaultMessage()};
}
 
You will use it with something like Message[] mes = getMessages() and expect instances of DefaultMessage.
 
If the base class is abstract, you will get an array of null members (because the stub cannot create the base class).
If it is not, then your array members will be instances of Message, althought the service returned instances of DefaultMessages.
The SOAPMonitor shows that service sends the message as expected (instance of DefaultMessage, with its members).
That's because the stub doesn't know that there's supposed to be an inheriting class (see my description below).
 
It would work, if DefaultMessage did not contain any bean members.
But usually it does, and here we come to your exception.
The stub wants to create an instance of the base class, but get's an unknown bean member from soap message (because the stub doesn't know the inheriting class)
 
My (not fine but working solution) is to add a dummy method to the service which makes the stub know the inheriting class:
For example:
void dummyMethod(Message message)
{
}
 
Hope this helps,
Markus
 
 
-----Ursprüngliche Nachricht-----
Von: Ales St [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 6. Dezember 2005 15:22
An: [email protected]
Betreff: Re: Abstract classes and inheritance

Hi
I have dot a similar problem, you can find it on http://marc.theaimsgroup.com/?l=axis-user&m=113377937503146&w=2 . And to your problem I have got some questions:
I thing that your metod getMessage() must return instance of 'DefaultMessage'.Because you can not get instance of  'Message' class.And you write:"The 'stubt version' of getMessages() returns instances of 'Message', not of 'DefaultMessage' "
I thing that this: "Message getMessage()" what you write mean something like this: Message mes=getMessage();
And can you please see my problem, and write me if it is similar or if it is something other.And how can I solve it if you will have some idea.
Thank you
            Ales
 
----- Original Message -----
Sent: Tuesday, December 06, 2005 1:48 PM
Subject: AW: Abstract classes and inheritance

Ok,
finally I solved this issue.
First I want to mention that I'm using Axis 1.2.1
 
The major problem was, that while creating the stub, the inheriting class had not been produced.
(It was there, but only because I have two services in the same stub (or two stubs in the same package) and it was produced by the other one, which I haven't used, yet. That's why I didn't recognize the problem.)
But there was definiteley no entry in the XXXSoapBindingStub.java, so the stub didn't know the class.
On the other hand, the abstract class had been produced.
So why did that happen?
I found out the following:
In the service I did not use the the inheriting class in a method and I only used the abstract one as an array, like:
Message[] getMessage()
In this case, the inheriting class is not generated. It's different if you mention the abstract class somewhere in the service like this:
Message getMessage()
Then the inheriting class will be generated, too, and there will definiteley be an entry in the XXXSoapBindingStub.java
Now everything works fine! :-)
 
Well, I'm a newbie in Webservices and maybe I did something wrong that's supposed to be very simple,
but perhaps this helps other novices not to fall into the same trap.
 
Markus
 
 
-----Ursprüngliche Nachricht-----
Von: Knötzinger Markus [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 1. Dezember 2005 10:30
An: '[email protected]'
Betreff: AW: Abstract classes and inheritance

Hi,
I'm sorry, I have not got the hang of it, yet.
Markus
 
-----Ursprüngliche Nachricht-----
Von: Ales St [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 1. Dezember 2005 10:24
An: [email protected]
Betreff: Re: Abstract classes and inheritance

Hi,
do you solved your problem? Because I have got a similar problem, and I don't know how to solve it. If you selve it, write me please.
Thank you
                Ales 
----- Original Message -----
Sent: Wednesday, November 30, 2005 4:05 PM
Subject: Abstract classes and inheritance

Hello everyone,

I got stuck with a problem concerning abstract classes.
I've got an abstract class called 'Message' and a concrete one called 'DefaultMessage' which does inherit 'Message'.
I've got a method getMessages() of return type Message[].
On the server implementation the method returns an array of type 'Message', but each member references to an instance of 'DefaultMessage'.

On the client side I get an array with proper length but null values. If I do not declare 'Message' as abstract it works only if 'DefaultMessage' does not contain any bean members.

The 'stubt version' of getMessages() returns instances of 'Message', not of 'DefaultMessage' which should be the case.
If I add a bean member (like 'defaultValue') to 'DefaultMessage' I get an Exception from the stub:

org.xml.sax.SAXException: Invalid element in test.messenger.service.Message - defaultValue

org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
org.apache.axis.client.Call.invoke(Call.java:2451)
org.apache.axis.client.Call.invoke(Call.java:2347)
org.apache.axis.client.Call.invoke(Call.java:1804)
test.messenger.service.MessengerUserSoapBindingStub.getActiveMessages(MessengerUserSoapBindingStub.java:362)
test.messenger.gui.model.ServiceManager.getNewMessages(ServiceManager.java:57)
....

The SOAP message looks ok.
It contains 'defaultValue' and defines the array elements as 'DefaultMessage'.

Any ideas?

Thanks a lot,
Markus


Here's my wsdd:

  <service name="MessengerUser" provider="java:RPC" >
     <!--  add SoapMonitor -->
      <requestFlow>
        <handler type="soapmonitor"/>
      </requestFlow>

      <responseFlow>
        <handler type="soapmonitor"/>
      </responseFlow>   



      <parameter name="className"           value="test.messenger.service.MessageUserService"/>
      <parameter name="wsdlPortType"        value="MessengerUser"/>
      <parameter name="allowedMethods"      value="*"/>
      <parameter name="scope"               value="Application"/>
      <parameter name="wsdlTargetNamespace" value="http://service.messenger.test"/>


      <!-- Complex data structures: -->
      <beanMapping qname="myNS:Message"
                   xmlns:myNS="http://messenger.test"
                   languageSpecificType="java:test.messenger.Message"/>
      <beanMapping qname="myNS:Response"
                   xmlns:myNS="http://messenger.test"
                   languageSpecificType="java:test.messenger.Response"/>
      <beanMapping qname="myNS:DefaultMessage"
                   xmlns:myNS="http://messenger.test"
                   languageSpecificType="javatest.messenger.DefaultMessage"/>
      <beanMapping qname="myNS:DefaultResponse"
                   xmlns:myNS="http://messenger.test"
                   languageSpecificType="java:test.messenger.DefaultResponse"/>


      <!-- Exceptions: -->
      <beanMapping qname="myNS:MessengerException"
                   xmlns:myNS="http://messenger.test"
                   languageSpecificType="java:test.MessengerException"/>
      <beanMapping qname="myNS:MessageNotExistsException"
                   xmlns:myNS="http://messenger.test"
                   languageSpecificType="java:test.messenger.MessageNotExistsException"/>

  </service>

</deployment>



 

###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.F-Secure.com/

###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.F-Secure.com/

###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.F-Secure.com/

###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.F-Secure.com/

###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.F-Secure.com/

Reply via email to