1 Reply Latest reply on Jul 5, 2007 6:35 AM by pixel

    JBoss 4.2.0 web service not exposing getters

    pixel

      Hi,

      I have what I hope is a fairly simple problem, and I suspect I am just missing something obvious. I have a web service with a method which returns a POJO containing Strings, longs and booleans. I can access the variables directly if I set @XmlAccessorType(XmlAccessType.FIELD), but I can't get the service to expose the getters. Is this possible, as I want some logic in the getters.

      Web Service

      @Stateless
      @WebContext(contextRoot="/web-services", secureWSDLAccess=false)
      @WebService(name="MobileUpdate", serviceName = "MobileUpdate")
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      public class MobileUpdateService {
       @WebMethod
       public MobileConfigResponse getConfig( String msisdn ) {
       return new MobileConfigAction().act( msisdn );
       }
      }
      


      Returned POJOs
      @XmlAccessorType(XmlAccessType.FIELD)
      public class MobileConfigResponse {
      
       protected String[] errors;
       protected String config;
       protected long id;
      
       MobileConfigResponse() {}
      
       public MobileConfigResponse( String[] _errors, String _config, long _id ) {
       errors = _errors;
       config = _config;
       id = _id;
       }
      
       public String[] getErrors){
       return errors;
       }
      
       public boolean isError() {
       return errors != null && errors.length > 0
       }
      
       public String getConfig() {
       return config;
       }
      
       public long getId() {
       return id;
       }
      
      }
      


        • 1. Re: JBoss 4.2.0 web service not exposing getters
          pixel

          Update - I have found that I can expose the getters by having matching setters, but I don't want a redundant setter for isError:

          public boolean isIsError() {
           return errors != null && errors.length > 0;
          }
          public void setIsError( boolean _notUsed ) {
          }
          


          I'm sure that we didn't need to have setters like this when we were using JBoss3 with JBoss.Net