4 Replies Latest reply: Oct 8, 2012 9:49 AM by 814541 RSS

    WebLogic does not validate minOccurs=“1” in webservices

    814541
      Hello,

      My WebService is deployed on WebLogic 10.3.3.

      WSDL/XSD describes input parameter number as mandatory:

      <xs:element minOccurs="1" maxOccurs="1" name="number" type="xs:int"/>

      MinOccurs="1" means that XML message must contain <number> tag, isn't it?

      I expect WebLogic has to validate all requests and server error response should be thrown when request is invalid.

      Unfortunatelly, my SOAP client is able to send SOAP request without <number> tag and my webservice implementation receives such an invalid request.

      Could you tell me please, is it correct behavior or is it defect in WebLogic?

      Should my webservice perform it's own XML validation?
        • 1. Re: WebLogic does not validate minOccurs=“1” in webservices
          Vijaya Moderator -Oracle
          Hi ,

          Did you try testing your web service application in the weblogic test client which is installed by default?
          The webservice test client built by Oracle parses the WSDL that is associated with the XSD schema.

          Please check and confirm if it throws any error.

          Thanks,
          Vijaya
          • 2. Re: WebLogic does not validate minOccurs=“1” in webservices
            814541
            Hi Vijaya

            I open webservice test client here: /wls_utc/?wsdlUrl=<my wsdl>

            There is a text field 'number' on the page.
            I leave the field empty and press button to send request.

            Next page is /wls_utc/callOperation.do and I can see empty <number /> tag in the SOAP request.

            It is not my case, because I need request without <number /> tag at all.
            • 3. Re: WebLogic does not validate minOccurs=“1” in webservices
              user696
              By default, SOAP messages are not validated against their XML schemas. You can enable XML schema validation for document-literal Web Services on the server or client, as described in the following sections.

              please check below documentation
              http://docs.oracle.com/cd/E13222_01/wls/docs103/webserv/jws.html#wp283432

              And try this option for jax-ws it should work

              Regards,
              Sunil P
              • 4. Re: WebLogic does not validate minOccurs=“1” in webservices
                814541
                I added @SchemaValidation in my Java class, recompiled it and redeployed.
                Server was restarted and cache and tmp folders were deleted.

                Unfortunately, it does not work.

                Scheme validation works without @SchemaValidation if add <validate-request>true</validate-request> into weblogic-webservices.xml.
                My soap client received SOAP Fault and 500 Internal Server Error for request without mandatory tag.
                But I use weblogic.wsee.tools.anttasks.JwscTask and it generate weblogic-webservices.xml without <validate-request>.

                Therefore @SchemaValidation is the best solution for me.

                Which reasons @SchemaValidation doesn't work?