[ 
https://issues.apache.org/jira/browse/AXIS2-4053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Samisa Abeysinghe updated AXIS2-4053:
-------------------------------------

    Component/s:     (was: wsdl)
                 codegen

> Problem with restricted numeric elements
> ----------------------------------------
>
>                 Key: AXIS2-4053
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4053
>             Project: Axis2
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.4
>         Environment: Windows XP
>            Reporter: Tom Trader
>
> The code generated by wsdl2java for the adb data binding fails when it 
> involved a XML schema that includes the deserialization of a restricted group 
> that restricts out a numeric type.
> In the sample wsdl below the element A (short) is restricted out of the 
> response. When the response is deserialized the factory for parsing the 
> RestrictedGroup is attempting to set the element A if present (which it isn't 
> as it was restricted out) and the else clause (if element not present) for 
> numeric types has the property set it to a minimum value which causes the 
> throwing of a runtime error.
> The code at fault is:
> if (reader.isStartElement() && new 
> javax.xml.namespace.QName("","A").equals(reader.getName())){
>                                 
>                                     java.lang.String content = 
> reader.getElementText();
>                                     
>                                               object.setA(
>                                                     
> org.apache.axis2.databinding.utils.ConverterUtil.convertToShort(content));
>                                               
>                                         reader.next();
>                                     
>                               }  // End of if for expected property start 
> element
>                                 
>                                     else {
>                                         
>                                                
> object.setA(java.lang.Short.MIN_VALUE); // Code at fault as A property has 
> been restricted out !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>                                            
>                                     }
> WSDL
> =====
> <?xml version="1.0" encoding="UTF-8"?>
> <definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
> xmlns:tns="ns://Sample/SampleService" 
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/"; 
> xmlns="http://schemas.xmlsoap.org/wsdl/"; 
> xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"; 
> xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"; 
> xmlns:ns="http://schemas.xmlsoap.org/soap/encoding/"; name="SampleService" 
> targetNamespace="ns://Sample/SampleService">
>       <documentation xmlns="http://schemas.xmlsoap.org/wsdl/"/>
>       <types>
>               <xsd:schema targetNamespace="ns://Sample/SampleService" 
> xmlns:tns="ns://Sample/SampleService" elementFormDefault="unqualified" 
> attributeFormDefault="unqualified">
>                       <xsd:element name="FullGroup" type="tns:FullGroupType"/>
>                       <xsd:complexType name="FullGroupType">
>                               <xsd:sequence>
>                                       <xsd:element name="A" type="xsd:short" 
> minOccurs="0"/>
>                                       <xsd:element name="B" 
> type="xsd:string"/>
>                               </xsd:sequence>
>                       </xsd:complexType>
>                       <xsd:element name="RestrictedGroup" 
> type="tns:RestrictedGroupType"/>
>                       <xsd:complexType name="RestrictedGroupType">
>                               <xsd:complexContent>
>                                       <xsd:restriction 
> base="tns:FullGroupType">
>                                               <xsd:sequence>
>                                                       <xsd:element name="B" 
> type="xsd:string"/>
>                                               </xsd:sequence>
>                                       </xsd:restriction>
>                               </xsd:complexContent>
>                       </xsd:complexType>
>               </xsd:schema>
>       </types>
>       <message name="someOperationIn">
>               <documentation xmlns="http://schemas.xmlsoap.org/wsdl/"/>
>               <part name="SomeOperationRequestMsg" element="tns:FullGroup"/>
>       </message>
>       <message name="someOperationOut">
>               <documentation xmlns="http://schemas.xmlsoap.org/wsdl/"/>
>               <part name="SomeOperationResponseMsg" 
> element="tns:RestrictedGroup"/>
>       </message>
>       <portType name="SomeHTTPInterface">
>               <documentation xmlns="http://schemas.xmlsoap.org/wsdl/"/>
>               <operation name="SomeOperation">
>                       <documentation 
> xmlns="http://schemas.xmlsoap.org/wsdl/"/>
>                       <input message="tns:someOperationIn"/>
>                       <output message="tns:someOperationOut"/>
>               </operation>
>       </portType>
>       <binding name="SomeHTTPBinding" type="tns:SomeHTTPInterface">
>               <soap:binding style="document" 
> transport="http://schemas.xmlsoap.org/soap/http"/>
>               <operation name="SomeOperation">
>                       <soap:operation 
> soapAction="ns://Sample/SampleService/SomeHTTPInterface/SomeOperationRequest" 
> soapActionRequired="true" style="document"/>
>                       <input>
>                               <soap:body parts="SomeOperationRequestMsg" 
> use="literal"/>
>                       </input>
>                       <output>
>                               <soap:body parts="SomeOperationResponseMsg" 
> use="literal"/>
>                       </output>
>               </operation>
>       </binding>
>       <service name="SampleService">
>               <port name="SampleServiceSomeHTTPSOAP" 
> binding="tns:SomeHTTPBinding">
>                       <soap:address 
> location="https://localhost/SampleService"/>
>               </port>
>       </service>
> </definitions>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to