简体   繁体   中英

Missing information in WSDL (JAX-WS runtime)

I am new to the JAX-WS, I have the following situation:

Service:

public class MyService {  
    @WebMethod()  
    public @WebResult MyBaseClass getBaseClassById(@WebParam(name="id") int id){  
    }  
}  

MyBaseClass and hierarchy:

@XmlSeeAlso({MySimpleType.class, MyComplexerType.class})
public abstract class MyBaseClass {  
    private int intField;
    public int getIntField() { return intField; }  
}

public class MySimpleType {
    private String stringField;
    public String getStringField() { return stringField; }
}

public class MyComplexerType {
    private  String[] stringArray;
    private  List<String> stringList;
    public String[] getStringArray(){ return stringArray; }
    public List<String> getStringList(){return stringList; }
}

I have the following problem, when I run the service, MySimpleType & MyBaseType are properly translated to wsdl, but MyComplexerType not. What I get is approximately the following:

For MyBaseType:

<xs:complexType abstract="true" name="myBaseType">
  <xs:sequence>
    <xs:element name="intField" type="xs:int"/>
  </xs:sequence>
</xs:complexType>

for MySimplerType:

<xs:complexType name="mySimpleType">
  <xs:complexContent>
    <xs:extension base="tns:myBaseType">
      <xs:sequence>
        <xs:element minOccurs="0" name="stringField" type="xs:string"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

for MyComplexerType:

<xs:complexType name="myComplexerType">
  <xs:complexContent>
    <xs:extension base="tns:myBaseType">
      <xs:sequence/>
    </xs:extension>
</xs:complexContent>

What am I doing wrong? How do I get my List and String[] fields into WSDL? I am using JBoss 7.1.1.Final runtime

I assume this is just a copy paste error but your getter methods for ComplexType have incorrect syntax. they are missing the (). this could have caused them to compile as fields rather than methods. if its not just a typo try fixing up the methods and removing the annotation.

Adding

@XmlElement(required=true)

annotation to the missing fields solved the problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM