Wsdl axis generation

I use Axis to simulate a WebService sample. Now I'm trying to understand what are the limitations of automatically creating wsdl and code.

Now for some server side code:

this is the skeleton of an example web service:

public class TestWebService {
  public AbstractAttribute[] testCall( AbstractAttribute someAttribute ) {
    ....

and my data classes: public abstract class AbstractAttribute {String name;

  /*get/set for name*/
  public abstract T getValue();
  public abstract void setValue(T value);
}

public class IntAttribute extends AbstractAttribute<Integer> {
  Integer value;
  public Integer getValue(){ return value; }
  public void setValue(Integer value){ this.value = value; }
}

public class StringAttribute extends AbstractAttribute<String> {
  String value;
  /* ok, you got the point, get/set for value field */
}

The eclipse tool for Axis2 is happy to generate wsdl from these sources, including a schema for attribute classes that:

<xs:complexType name="AbstractAttribute">
    <xs:sequence>
        <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
        <xs:element minOccurs="0" name="value" nillable="true" type="xs:anyType"/>
    </xs:sequence>
</xs:complexType>
<xs:complexType name="IntAttribute">
    <xs:complexContent>
        <xs:extension base="xsd:AbstractAttribute">
            <xs:sequence>
                <xs:element minOccurs="0" name="value" nillable="true" type="xs:int"/>
            </xs:sequence>
        </xs:extension>
    </xs:complexContent>
</xs:complexType>
<xs:complexType name="StringAttribute">
    <xs:complexContent>
        <xs:extension base="xsd:AbstractAttribute">
            <xs:sequence>
                <xs:element minOccurs="0" name="value" nillable="true" type="xs:string"/>
            </xs:sequence>
        </xs:extension>
    </xs:complexContent>
</xs:complexType>

now, if you see something strange here, AbstractAttribute does not have the attribute ** abstract = "true" ** and defines an element of the value anyType, which is rewritten in IntAttribute and StirngAttribute. I don’t even know if this is a legal scheme (by the way, I do not consider it legal).

, wsdl ( eclipse), , AbstractAttribute

Object localValue;

Int/String

int localValue;

String localValue;

.. "" ( , ), , AbstractAttribute ( InstantiationException).

, : , - XML ?

+3
1

, , , Axis .

Axis - - java... , , . , , .

, InstantiationExceptions, . Axis wsdl, , , "anyType".

: , , Axis. :

  • , , -
  • , -. . -. Axis.
  • / . , ( Axis ) BeanUtils.copyProperites, .

, .

+4

Source: https://habr.com/ru/post/1703187/


All Articles