1 Reply Latest reply on Oct 6, 2006 7:28 AM by Kristof Taveirne

    help in generating WSDL

    Marco Novice

      hi all,
      can anyone help me out in how to generate WSDL for my EJB?

      i have this very simple EJB3 that i want to expose a s a webService

      here's the interface

      /**
       * Copyright @ 2006
       * By Marco Mistroni
       */
      package com.mm.j2me.ejb;
      
      
      import java.rmi.RemoteException;
      
      import javax.ejb.*;
      import javax.jws.WebService;
      import javax.jws.soap.SOAPBinding;
      
      import org.jboss.ws.annotation.PortComponent;
      
      
      import com.mm.j2me.core.Agency;
      import com.mm.j2me.core.WSFacade;
      
      @WebService (name="WSFacade",
       targetNamespace="http://org.jboss.ws/samples/jsr181ejb",
       serviceName="WSFacade",
       endpointInterface="com.mm.j2me.ejb.WSRemoteSEI")
      @SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
       use = SOAPBinding.Use.LITERAL,
       parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
      @PortComponent(transportGuarantee="NONE",
       contextRoot = "/",
       urlPattern="/v1/soap/WSFacade")
      public interface WSRemoteSEI extends Remote {
      
       public String[] testWebServiceMethod() throws RemoteException;
      
      }
      


      here' smy simple EJB3
      
      @WebService (name="WSFacade",
       serviceName="WSFacade",
       endpointInterface="com.mm.j2me.ejb.WSRemoteSEI")
      @SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
       use = SOAPBinding.Use.LITERAL,
       parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
      
      @Stateless
      @Remote (WSFacade.class)
      @RemoteBinding( jndiBinding="/ejb3/WSRemoteSEI")
      
      public class TestFacade implements WSFacade{
      
       @PersistenceContext
       EntityManager em;
      
       public void deleteAgency(Agency agency) {
       // TODO Auto-generated method stub
       Query query = getQuery("findAgencyById");
       query.setParameter("id", agency.getId());
       Agency agencyToDelete = (Agency)query.getSingleResult();
       em.remove(agencyToDelete);
       }
      
       public void deleteJobApplication(JobApplication app) {
       Query query = getQuery("findJAById");
       query.setParameter("id", app.getId());
       JobApplication jaToDelete = (JobApplication)query.getSingleResult();
       em.remove(jaToDelete);
      
       }
      
       public void deleteOpportunity(Opportunity opp) {
       Query query = getQuery("findOpportunityById");
       query.setParameter("id", opp.getId());
       Opportunity oppToDelete = (Opportunity)query.getSingleResult();
       em.remove(oppToDelete);
      
       }
      
       public Agency[] getAllAgencies() {
       // TODO Auto-generated method stub
       Query query = getQuery("findAllAgencies");
       List<Agency> list = query.getResultList();
       Agency[] agencies = new Agency[list.size()];
       return (Agency[])(list.toArray(agencies));
       }
      
       public JobApplication[] getAllJobApplications() {
       return new JobApplication[]{};
       }
      
       public Opportunity[] getAllOpportunities() {
       //Query query = getQuery("findAllOpportunities");
       //return query.getResultList();
       return new Opportunity[]{};
       }
      
       public void insertAgency(Agency agency) {
       // TODO Auto-generated method stub
       em.persist(agency);
       }
      
       public void insertJobApplication(JobApplication app) {
       em.persist(app);
      
       }
      
       public void insertOpportunity(Opportunity opp) {
       em.persist(opp);
      
       }
      
       public User login(String username) {
       // TODO Auto-generated method stub
       return null;
       }
      
       private Query getQuery(String name) {
       return em.createNamedQuery(name);
       }
      
       @WebMethod
       public String testWebServiceMethod() {
       String[] agencies = {"agency1;job1;", "agency2;job2"};
       }
      
      }
      


      i m runnign wstools with this cnfig file

      <?xml version="1.0" encoding="UTF-8"?>
      <configuration xmlns="http://www.jboss.org/jbossws-tools"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
      
       <wsdl-java file="http://localhost:9080//v1/soap/WSFacade?wsdl">
       <mapping file="jaxrpc-mapping-client.xml" />
       </wsdl-java>
      
      </configuration>
      


      and all i got is plenty, plenty of generated classes:
      Annotation, AnnotationType, AnnotationTypeResponse, Certificat, CertPath, Class, Classloader, CodeSigner

      thing is that some classes does not even compile...
      why does it generate all extra classes ? i need only 2 of them WSFacade_PortType adn WSFacade_Service

      why do i have all those extra classes?
      anyone could recommend me the easiest wayt ogenerate wsdl from java for jbossws?

      thanks in advance and regards
      marco