wrapper classes of java primitive type aren't well processed by Axis when they are passed as methode parameter

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

wrapper classes of java primitive type aren't well processed by Axis when they are passed as methode parameter

THIBAULT Joseph
Tool java2WSDL doesn't work fine when we have wrapper class like
java.lang.Boolean as method parameter. java2WSDL doesn't generate for
this parameter the attribute nillable="true".
And even if we add by hand this attribut, the tool WSDL2Java doesn't
generate a wrapper for the parameter but a primitive type, then, it's
impossible to send null value to the service.

This bug is true only when we use wrapper for method parameters, but
when we use wrapper for attribut of beans used as parameter, this work fine.

An example that show the bug. Like we can see in the generated wsdl, we
have a nillable="true" for the attrBWrapped attribut of the bean but not
for the bWrapper parameter of the methode :

##########My interface test.TestInterface ##########
package test;

import test.sdd.Bean;

public interface TestInterface
{
  public void methodeTest(Boolean bWrapper, boolean b, Bean bean);
}

########## The test.sdd.Bean class ##########
package test.sdd;

public class Bean
{

  Boolean attrBWrapper;
  boolean attrB;  

  public Bean() {}

  public Bean(boolean pAttrB, Boolean pAttrBWrapper) {
    this.attrB = pAttrB;
    this.attrBWrapper = pAttrBWrapper;
  }
 
  public boolean isAttrB()
  {
    return attrB;
  }

  public void setAttrB(boolean attrB)
  {
    this.attrB = attrB;
  }

  public Boolean getAttrBWrapper()
  {
    return attrBWrapper;
  }

  public void setAttrBWrapper(Boolean attrBWrapper)
  {
    this.attrBWrapper = attrBWrapper;
  }

########## The generated wsdl by Java2WSDL ##########
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://test.sib.fr"
xmlns:impl="http://test.sib.fr" xmlns:intf="http://test.sib.fr"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns1="http://sdd.test" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<!--WSDL created by Apache Axis version: 1.2
Built on May 03, 2005 (02:20:24 EDT)-->
 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://test.sib.fr" elementFormDefault="qualified">
   <import namespace="http://sdd.test"/>
   <element name="methodeTest">
    <complexType>
     <sequence>
      <element name="bWrapper" type="xsd:boolean"/>
      <element name="b" type="xsd:boolean"/>
      <element name="bean" type="tns1:Bean"/>
     </sequence>
    </complexType>
   </element>
   <element name="methodeTestResponse">
    <complexType/>
   </element>
  </schema>
  <schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://sdd.test" elementFormDefault="qualified">
   <complexType name="Bean">
    <sequence>
     <element name="attrB" type="xsd:boolean"/>
     <element name="attrBWrapper" nillable="true" type="xsd:boolean"/>
    </sequence>
   </complexType>
  </schema>
 </wsdl:types>

   <wsdl:message name="methodeTestRequest">

      <wsdl:part name="parameters" element="impl:methodeTest"/>

   </wsdl:message>

   <wsdl:message name="methodeTestResponse">

      <wsdl:part name="parameters" element="impl:methodeTestResponse"/>

   </wsdl:message>

   <wsdl:portType name="TestInterface">

      <wsdl:operation name="methodeTest">

         <wsdl:input name="methodeTestRequest"
message="impl:methodeTestRequest"/>

         <wsdl:output name="methodeTestResponse"
message="impl:methodeTestResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="testSoapBinding" type="impl:TestInterface">

      <wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="methodeTest">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="methodeTestRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="methodeTestResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="TestInterfaceService">

      <wsdl:port name="test" binding="impl:testSoapBinding">

         <wsdlsoap:address
location="http://localhost:8086/axis/services/test"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>