How to drop null values with a native Oracle XML DB Web Service?

Posted by gfjr on Stack Overflow See other posts from Stack Overflow or by gfjr
Published on 2012-06-21T14:41:17Z Indexed on 2012/09/11 15:38 UTC
Read the original article Hit count: 290

Filed under:
|
|
|

I am using native Oracle XML DB Web Services (using a PL/SQL function with a web service). I want to drop null values (put nothing in the output (no XML element)). It's working with Oracle 11.2.0.1.0 but not with Oracle 11.2.0.3.0.

Just to clarify... I don't want to consume a webservice with PL/SQL, I want to publish my PL/SQL packages/procedures/functions as a web service!

Hope someone can help me. Thank you.

In this example is the column "country" null.

Oracle 11.2.0.1.0 (this is what I want):

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
  <GET_PERSONOutput xmlns="http://xmlns.oracle.com/orawsv/TESTSTUFF/GET_PERSON">
        <RETURN>
          <PERSON>
          <PERSON_ID>3</PERSON_ID>
          <FIRST_NAME>Harry</FIRST_NAME>
          <LAST_NAME>Potter</LAST_NAME>
        </PERSON>
      </RETURN>
    </GET_PERSONOutput>
  </soap:Body>
</soap:Envelope>

Oracle 11.2.0.3.0:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GET_PERSONOutput xmlns="http://xmlns.oracle.com/orawsv/TESTSTUFF/GET_PERSON">
     <RETURN>
        <PERSON>
           <PERSON_ID>3</PERSON_ID>
           <FIRST_NAME>Harry</FIRST_NAME>
           <LAST_NAME>Potter</LAST_NAME>
           <COUNTRY/>
        </PERSON>
     </RETURN>
    </GET_PERSONOutput>
  </soap:Body>
</soap:Envelope>

© Stack Overflow or respective owner

Related posts about Xml

Related posts about web-services