This discussion is archived
2 Replies Latest reply: Jun 26, 2012 8:18 AM by 344384 RSS

Extract Method

344384 Newbie
Currently Being Moderated
Hi

I call a webservice and get a response like this
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <ServiceRequest_CreateResponse xmlns="http://ABC/">
      <ServiceRequest_CreateResult xsi:type="xsd:string">&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;ServiceRequest_CreateResult xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; 
xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;
  &lt;Error 
xmlns=&quot;http://www.systems.com/ServiceRequestCreateResponse.xsd&quot;&gt;
    &lt;Description&gt;Object Property ExternalReference has not been 
provided&lt;/Description&gt;
  &lt;/Error&gt;
&lt;/ServiceRequest_CreateResult&gt;</ServiceRequest_CreateResult>
    </ServiceRequest_CreateResponse>
  </soap:Body>
</soap:Envelope>
In the above XML the i get tags as gt and lt and not as actual symbols, so i m extracting and then doing a entity_decode,

my extract stmt is like this
SOAP_RESPOND :=XMLTYPE(SOAP_RESPOND).EXTRACT('/soap:Envelope/soap:Body/ServiceRequest_CreateResponse/ServiceRequest_CreateResult/text()','xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/",xmlns="http://ABC/"').GETCLOBVAL();
and i m getting method method dispatch on NULL SELF argument is disallowed and I cant see where i m going wrong.

then i want to decode like this
Xml_Result :=XMLTYPE(DBMS_XMLGEN.CONVERT (SOAP_RESPOND, DBMS_XMLGEN.ENTITY_DECODE));
so that i get the actual XML tags instead of the lt and gt characters.

Can some one point me what is wrong in my extract statement.

Thanks

S
  • 1. Re: Extract Method
    odie_63 Guru
    Currently Being Moderated
    Hi,

    Looks like one of those old (and weird) bugs related to the namespace mapping string :)
    I'm still reproducing the issue on 11.2.

    Try adding a whitespace in between the namespace declarations :
      soap_respond := XMLTYPE(soap_respond).extract(
                        '/soap:Envelope/soap:Body/ServiceRequest_CreateResponse/ServiceRequest_CreateResult/text()'
                      , 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/", xmlns="http://ABC/"'
                                                                    /*          ^
                                                                                here */
                      ).getclobval();
  • 2. Re: Extract Method
    344384 Newbie
    Currently Being Moderated
    Thanks Odie, I was breaking my head since afternoon, why its not working and I really culdnt figure it out.

    Never knew that the space matters.

    Thanks very much

    S

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points