1 Reply Latest reply: May 27, 2013 9:25 PM by 1006234 RSS

    Error in generated Client-Artifacts classes of JAX-WS if 'nillable=true'

    1006234
      I have a difficult issues about Client-Artifacts of JAX-WS.
      Pre-Condition:
      my webservice files from my EJB3.1 Stateless SessionBean.
      eg:
      @Stateless(mappedName = "TestBean")
      @WebService
      public class TestBean implements Test
      {
      public int getTestAFunction(long[] ukey, boolean isSuper, int rank)
      {
           ......
           return ...
      }
                     
      public int[] getTestBFunction()
      {
           .......
           return ...
      }
      }

      @Remote
      @WebService(name="TestRemote", targetNamespace="test.services.common.com")
      public interface Test
      {
           @WebMethod
           public int getTestAFunction(long[] ukey, boolean isSuper, int rank);
                     
           @WebMethod
           public int[] getTestBFunction();
      }
      Now, I use 'JWSC' to generate WSDL files and *.xsd files, Method interface file, I only list problematical files, as following:
      -----TestBeanService_schema1.xsd
      -----com/aaa/bbb/jaxws/GetTestBFunctionResponse.java
      In these files, I find attribute 'nillable=true' of '@XmlElement', as following:
      TestBeanService_schema1.xsd :
      <xsd:complexType name="getTestAFunction">
      <xsd:sequence>
      <xsd:element name="arg0" type="xsd:long" maxOccurs="unbounded" nillable="true"/>
      <xsd:element name="arg1" type="xsd:boolean"/>
      <xsd:element name="arg2" type="xsd:int" />
      </xsd:sequence>
      </xsd:complexType>

      com/aaa/bbb/jaxws/GetTestBFunctionResponse.java :
      @XmlElement(name = "return", namespace = "", nillable = true)
      private int[] _return;

      Next, I use 'Clientgen' to generate Client-Artifacts files, I find that the signature of the method was changed in generated files. I means that the arg data type of method was boxed, return value too. for example:
      ===================================
      @WebMethod
      @WebResult(...)
      @RequestWrapper(...)
      @ResponseWrapper(...)
      @Action(...)
      public int getTestAFunction(
      @WebParam(name = "arg0", targetNamespace = "")
      Long[] arg0,
      @WebParam(name = "arg1", targetNamespace = "")
      boolean arg1,
      @WebParam(name = "arg2", targetNamespace = "")
      int arg2);

      @WebMethod
      @WebResult(...)
      @RequestWrapper(...)
      @ResponseWrapper(...)
      @Action(...)     
      public Integer[] getTestBFunction();
      ===================================
      Java primitive data type array(such as int[], long[]) was mapped to the equivalent object wrapper type(such as Integer[], Long[]).
      For my business logic in EJB, this result is very bad. If 'nillable=true', it will caused this problem, now I manually delete this attribute in above files to solve this issue, But I don't want to use this stiff method.

      For this issue, I want to get a better solution from you. Who have a good solution? Please tell me.

      thanks a million,
      Wade

      Edited by: 1003231 on Apr 29, 2013 8:33 PM