REST minOccurs wsdl optional element
------------------------------------

                 Key: AXIS2-3201
                 URL: https://issues.apache.org/jira/browse/AXIS2-3201
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: kernel
    Affects Versions: 1.3
         Environment: JDK 1.4.1 tomcat 4.1.34 axis2-1.3
            Reporter: Willy ANTOINE
            Priority: Critical


It seem's that  REST support in axis doesn't honor minOccurs="0" in WSDL file

I have the foloowing  wsdl file in my <myservice>/META-INF/:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/";
        xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/";
        xmlns:tns="urn:interop" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"; name="http-binding"
        targetNamespace="urn:interop"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";>
        <wsdl:types>
                <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
                        targetNamespace="urn:interop">
                        <xsd:element name="testOperationResponse">
                                <xsd:complexType>
                                        <xsd:sequence>
                                                <xsd:element 
name="testOperationReturn"
                                                        
type="tns:TestOperationReturn" />
                                        </xsd:sequence>
                                </xsd:complexType>
                        </xsd:element>
                        <xsd:complexType name="TestOperationReturn">
                                <xsd:sequence>
                                        <xsd:element name="param1" 
type="xsd:string">
                                        </xsd:element>
                                        <xsd:element name="param2" 
type="xsd:int">
                                        </xsd:element>
                                        <xsd:element name="param3" 
type="xsd:date" maxOccurs="1" minOccurs="0" >
                                        </xsd:element>
                                </xsd:sequence>
                        </xsd:complexType>
                        <xsd:element name="testOperation"
                                type="tns:TestOperationReturn">
                        </xsd:element>
                </xsd:schema>
        </wsdl:types>
        <wsdl:message name="testOperationRequest">
                <wsdl:part name="testOperationRequest"
                        element="tns:testOperation" />
                
        </wsdl:message>
        <wsdl:message name="testOperationResponse">
                <wsdl:part name="testOperationResponse"
                        element="tns:testOperationResponse" />
        </wsdl:message>
        <wsdl:portType name="interop">
                <wsdl:operation name="testOperation">
                        <wsdl:input message="tns:testOperationRequest" />
                        <wsdl:output message="tns:testOperationResponse" />
                </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="interopSoapBinding" type="tns:interop">
                <soap:binding style="document"
                        transport="http://schemas.xmlsoap.org/soap/http"; />
                <wsdl:operation name="testOperation">
                        <soap:operation soapAction="urn:interop/testOperation" 
/>
                        <wsdl:input>
                                <soap:body use="literal" />
                        </wsdl:input>
                        <wsdl:output>
                                <soap:body use="literal" />
                        </wsdl:output>
                </wsdl:operation>
        </wsdl:binding>
        <wsdl:binding name="HttpBinding" type="tns:interop">
                <http:binding verb="GET" />
                <wsdl:operation name="testOperation">
                        <http:operation location="/testOperation" />
                        <wsdl:input>
                                <http:urlEncoded />
                        </wsdl:input>
                        <wsdl:output>
                                <mime:content type="text/xml" />
                        </wsdl:output>
                </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="interopService">
                <wsdl:port name="interopSoap"
                        binding="tns:interopSoapBinding">
                        <soap:address 
location="http://www.example.org/";></soap:address>
                </wsdl:port>
                <wsdl:port name="HttpPort" binding="tns:HttpBinding">
                        <http:address location="http://www.example.org/"; />
                </wsdl:port>
        </wsdl:service>
</wsdl:definitions>

>From this wsdl with codegen, i've created the server implementation.

In my axis2.xml REST supoprt is enable.

When i call 
http://localhost:8080/webapp/services/interopService/testOperation?param1=toto&param2=2
 i have an error claiming  that the 3rd parameter is mandatory.
if i change 
<xsd:element name="param3" type="xsd:date" maxOccurs="1" minOccurs="0" > with
 <xsd:element name="param3" type="xsd:date" maxOccurs="1" minOccurs="0"  
nillable="true">
then this is working and also 
http://localhost:8080/webapp/services/interopService/testOperation?param1=toto&param2=2&param3=
 is working

When i debug, i see that  when transforming  the request from rest to soap 
message, the associated XML Schema returns minOccurs="1", perhaps this is a bug 
in xml schema.

Best regards 

Willy

-- 
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