3 Replies Latest reply on Jul 24, 2006 1:29 PM by Estrella Richardson

    A class as a parameter in a webservice

    Nx Lp Newbie

      Hi! i have this bean that is a webservice:

      // standard JSR181 annotations
      @WebService(name = "EndpointInterface", targetNamespace = "http://org.jboss.ws/samples/jsr181ejb", serviceName = "EJB3Service")
      // @SOAPBinding(style = SOAPBinding.Style.RPC)
      
      @SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
       use = SOAPBinding.Use.LITERAL ,
       parameterStyle=SOAPBinding.ParameterStyle.BARE)
      
      
      // standard EJB3 annotations
      @Remote(EJB3RemoteInterface.class)
      // @RolesAllowed("friend")
      @Stateless
      
      // jboss propriatary annotations
      @RemoteBinding(jndiBinding = "/ejb3/EJB3EndpointInterface")
      @PortComponent(authMethod="BASIC", transportGuarantee="NONE")
      @SecurityDomain("JBossWS")
      public class EJB3Bean01 implements EJB3RemoteInterface
      {
      
       @WebMethod
       public String echo(@WebParam( name="elLibro" )libro input)
       {
       return "Lo que recibí es " + input;
       }
      }


      As you can see, the parameter is not a standard type. i have the class "libro" like this:

      public class libro {
      
       String Nombre;
       String Autor;
       int edicion;
       String[] compradores;
      
       public libro () {
       }
      }


      i want to generate the wsdl file, but when i do it, the class "libro" is not specified:

      <complexType name="libro">
      <sequence/>
      </complexType>


      what sould i do to obtain something like this?

      <complexType name="libro">
       <sequence>
       <s:element name="Nombre" type="s:string"/>
       <s:element name="Autor" type="s:string"/>
       ...
       </sequence>
      </complexType>


      THANKS!!!

        • 2. Re: A class as a parameter in a webservice
          Pablo Javier Santa Cruz Cosp Newbie

          How are you "generating" the WSDL?

          As far as I can tell by your annotations, you are using JBossWS. You don't need to generate WSDLs yourself. Just deploy your application into a JBoss-4.0.4.GA with JBossWS upgraded to JBossWS-1.0.1.GA and WSDL will be correctly generated with your class "Libro".

          Don't forget to include the class "Libro" in your package.

          GL.

          • 3. Re: A class as a parameter in a webservice
            Estrella Richardson Newbie

            Actually,
            I think what you need to do is to add getter/setter methods to your class. Make it comply with the Java beans rules and when you run WSTools, it will give the specifics of your libro class.

            Example:
            import java.io.Serializable;
            public class InfoObj implements Serializable {

            private static final long serialVersionUID = 0;

            private String contactName = null;
            private String address = null;
            private String city = null;
            private String state = null;
            private String zip = null;

            public void setContactName(String name){
            contactName = name;
            }
            public void setAddress(String addr){
            address = addr;
            }
            public void setCity(String iCity){
            city = iCity;
            }
            public void setState(String st){
            state = st;
            }
            public void setZip(String iZip){
            zip = iZip;
            }

            public String getContactName(){
            return contactName;
            }
            public String getAddress(){
            return address;
            }
            public String getCity(){
            return city;
            }
            public String getState(){
            return state;
            }
            public String getZip(){
            return zip;
            }