1

I am retrieving data from MySql database as list.My code is When I passed table name it gives list of data based on table name. Now how to create WSDL file to my class.

Below is My code:

@WebService
public class GetEmployeeImpl implements GetEmployee {
EntityManager entityManager = EntityManagerUtil.getEmf().createEntityManager();
@Override
public List getEmployee(String tableName) {

    String tableName1=tableName;
    Query query = entityManager.createNativeQuery("select name,age from "+tableName1);
    List userList =new ArrayList();
    try{
        userList= query.getResultList();            
    }
    catch(Exception e){
        e.printStackTrace();
    }
    return userList;
}

}

1 Answer 1

1

There's no special Array-like element in WSDL. WSDL describes XML structure, and in XML any child element can appear many times, so to differ between single elements/array you specify the maxOccurs as more than 1:

<xsd:element name="messages" type="xsd:string" maxOccurs="unbounded" minOccurs="0"></xsd:element>

More about creating contract-first services: Writing Contract-First Web Services

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.