Problem extracting SOAP XML payload using pl/sql

Hi,
I was wondering if I could get some help on extracting the address matches that are returned from the Web Service I am consuming. This is the first time I have dealt with XML and web services. I'm using Oracle 10.2.0.1.
The response I’m getting back returns 4 address matches (shown below against n2, n4, n6 and n8) which is:
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header/><soapenv:Body><searchResponse
xmlns="http://ws.aplt.msi.com"><searchReturn>&lt;?xml version=&quot;1.0&quot;
encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
&lt;GetAddressSearchResponse
xmlns=&quot;http://aplt.nzpost.co.nz/schemas/search&quot;&gt;
&lt;ns1:ResponseHeader
xmlns:ns1=&quot;http://aplt.nzpost.co.nz/schemas/common&quot;&gt;
&lt;ns1:Errors/&gt;
&lt;/ns1:ResponseHeader&gt;
&lt;SearchResults SearchType=&quot;StreetAddress&quot;&gt;
&lt;ResultRecord Type=&quot;URBAN&quot;&gt;
&lt;ns2:AddressDetails
xmlns:ns2=&quot;urn:nzpost:schemas:xAL:3.0&quot;&gt;
&lt;ns2:Locality&gt;
&lt;ns2:Name&gt;LOWER HUTT&lt;/ns2:Name&gt;
&lt;ns2:DependentLocality&gt;
&lt;ns2:Name&gt;WAINUIOMATA&lt;/ns2:Name&gt;
&lt;/ns2:DependentLocality&gt;
&lt;/ns2:Locality&gt;
&lt;ns2:Thoroughfare&gt;
&lt;ns2:Name&gt;MAIN ROAD&lt;/ns2:Name&gt;
&lt;ns2:Number&gt;
&lt;ns2:Number Type=&quot;number&quot;&gt;111&lt;/ns2:Number&gt;
&lt;/ns2:Number&gt;
&lt;/ns2:Thoroughfare&gt;
&lt;ns2:Postal&gt;
&lt;ns2:PostalCode&gt;
&lt;ns2:Number&gt;
&lt;ns2:Number&gt;5014&lt;/ns2:Number&gt;
&lt;/ns2:Number&gt;
&lt;/ns2:PostalCode&gt;
&lt;/ns2:Postal&gt;
&lt;/ns2:AddressDetails&gt;
&lt;DPID&gt;494852&lt;/DPID&gt;
&lt;Geospatial&gt;
&lt;ns3:Point
xmlns:ns3=&quot;http://aplt.nzpost.co.nz/schemas/common&quot;&gt;
&lt;ns3:Coordinate&gt;174.953883,-41.271187&lt;/ns3:Coordinate&gt;
&lt;/ns3:Point&gt;
&lt;/Geospatial&gt;
&lt;/ResultRecord&gt;
&lt;ResultRecord Type=&quot;URBAN&quot;&gt;
&lt;ns4:AddressDetails
xmlns:ns4=&quot;urn:nzpost:schemas:xAL:3.0&quot;&gt;
&lt;ns4:Locality&gt;
&lt;ns4:Name&gt;UPPER HUTT&lt;/ns4:Name&gt;
&lt;/ns4:Locality&gt;
&lt;ns4:Thoroughfare&gt;
&lt;ns4:Name&gt;MAIN STREET&lt;/ns4:Name&gt;
&lt;ns4:Number&gt;
&lt;ns4:Number
Type=&quot;number&quot;&gt;111&lt;/ns4:Number&gt;
&lt;ns4:Number
Type=&quot;alpha&quot;&gt;A&lt;/ns4:Number&gt;
&lt;/ns4:Number&gt;
&lt;/ns4:Thoroughfare&gt;
&lt;ns4:Postal&gt;
&lt;ns4:PostalCode&gt;
&lt;ns4:Number&gt;
&lt;ns4:Number&gt;5018&lt;/ns4:Number&gt;
&lt;/ns4:Number&gt;
&lt;/ns4:PostalCode&gt;
&lt;/ns4:Postal&gt;
&lt;/ns4:AddressDetails&gt;
&lt;DPID&gt;2697192&lt;/DPID&gt;
&lt;Geospatial&gt;
&lt;ns5:Point
xmlns:ns5=&quot;http://aplt.nzpost.co.nz/schemas/common&quot;&gt;
&lt;ns5:Coordinate&gt;175.070066,-41.124317&lt;/ns5:Coordinate&gt;
&lt;/ns5:Point&gt;
&lt;/Geospatial&gt;
&lt;/ResultRecord&gt;
&lt;ResultRecord Type=&quot;URBAN&quot;&gt;
&lt;ns6:AddressDetails
xmlns:ns6=&quot;urn:nzpost:schemas:xAL:3.0&quot;&gt;
&lt;ns6:Locality&gt;
&lt;ns6:Name&gt;WELLINGTON&lt;/ns6:Name&gt;
&lt;ns6:DependentLocality&gt;
&lt;ns6:Name&gt;TAWA&lt;/ns6:Name&gt;
&lt;/ns6:DependentLocality&gt;
&lt;/ns6:Locality&gt;
&lt;ns6:Thoroughfare&gt;
&lt;ns6:Name&gt;MAIN ROAD&lt;/ns6:Name&gt;
&lt;ns6:Number&gt;
&lt;ns6:Number Type=&quot;number&quot;&gt;111&lt;/ns6:Number&gt;
&lt;/ns6:Number&gt;
&lt;/ns6:Thoroughfare&gt;
&lt;ns6:Postal&gt;
&lt;ns6:PostalCode&gt;
&lt;ns6:Number&gt;
&lt;ns6:Number&gt;5028&lt;/ns6:Number&gt;
&lt;/ns6:Number&gt;
&lt;/ns6:PostalCode&gt;
&lt;/ns6:Postal&gt;
&lt;/ns6:AddressDetails&gt;
&lt;DPID&gt;1066466&lt;/DPID&gt;
&lt;Geospatial&gt;
&lt;ns7:Point
xmlns:ns7=&quot;http://aplt.nzpost.co.nz/schemas/common&quot;&gt;
&lt;ns7:Coordinate&gt;174.824326,-41.174181&lt;/ns7:Coordinate&gt;
&lt;/ns7:Point&gt;
&lt;/Geospatial&gt;
&lt;/ResultRecord&gt;
&lt;ResultRecord Type=&quot;URBAN&quot;&gt;
&lt;ns8:AddressDetails
xmlns:ns8=&quot;urn:nzpost:schemas:xAL:3.0&quot;&gt;
&lt;ns8:Locality&gt;
&lt;ns8:Name&gt;WELLINGTON&lt;/ns8:Name&gt;
&lt;ns8:DependentLocality&gt;
&lt;ns8:Name&gt;KARORI&lt;/ns8:Name&gt;
&lt;/ns8:DependentLocality&gt;
&lt;/ns8:Locality&gt;
&lt;ns8:Thoroughfare&gt;
&lt;ns8:Name&gt;MAKARA ROAD&lt;/ns8:Name&gt;
&lt;ns8:Number&gt;
&lt;ns8:Number Type=&quot;number&quot;&gt;111&lt;/ns8:Number&gt;
&lt;/ns8:Number&gt;
&lt;/ns8:Thoroughfare&gt;
&lt;ns8:Postal&gt;
&lt;ns8:PostalCode&gt;
&lt;ns8:Number&gt;
&lt;ns8:Number&gt;6012&lt;/ns8:Number&gt;
&lt;/ns8:Number&gt;
&lt;/ns8:PostalCode&gt;
&lt;/ns8:Postal&gt;
&lt;/ns8:AddressDetails&gt;
&lt;Geospatial&gt;
&lt;ns9:Point
xmlns:ns9=&quot;http://aplt.nzpost.co.nz/schemas/common&quot;&gt;
&lt;ns9:Coordinate&gt;174.717753 , -41.284415&lt;/ns9:Coordinate&gt;
&lt;/ns9:Point&gt;
&lt;/Geospatial&gt;
&lt;/ResultRecord&gt;
&lt;/SearchResults&gt;
&lt;/GetAddressSearchResponse&gt;
</searchReturn></searchResponse></soapenv:
Body></soapenv:Envelope>
My cursor that gets any errors returned appears ok. This is:
CURSOR c_xml_err(i_xml IN XMLType, i_xmlns IN VARCHAR2) IS
SELECT extract(value(xmlseq), '/Errors' , i_xmlns) vi_errors
,extract(value(xmlseq), '/Warnings' , i_xmlns) vi_warnings
FROM TABLE(xmlSequence(extract(i_xml, '/GetAddressSearchResponse/ns1:ResponseHeader' , i_xmlns))) xmlseq;
i_xml that is passed in is an XMLType converted from a CLOB which is the response from the web service:
v_xml_response := XMLType(i_response);
i_response is the SOAP package above with the following done on it:
-- Strip the unnecessary SOAP XML envelope from the response
v_xml_resp := XMLType.createXml(o_response);
i_response := v_xml_resp.extract('/soap:Envelope/soap:Body/child::node()'
,'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"').getClobVal();
i_response is defined with a type of CLOB.
i_xmlns that is passed in is: 'xmlns:ns1="' || i_xml_namespace || '"' where i_xml_namespace is: http://aplt.nzpost.co.nz/schemas/search
My cursor that tries to get the address details returned is:
CURSOR c_xml(i_xml IN XMLType, i_xmlns IN VARCHAR2) IS
SELECT extract(value(xmlseq), '/ResultRecord/AddressDetails/Postal.PostBox.Number/text()' , i_xmlns).getNumberVal() box#
,extract(value(xmlseq), '/ResultRecord/AddressDetails/Thoroughfare.Number/text()' , i_xmlns).getStringVal() street_number
,extract(value(xmlseq), '/ResultRecord/AddressDetails/Thoroughfare.Name/text()' , i_xmlns).getStringVal() street_name
,extract(value(xmlseq), '/ResultRecord/AddressDetails/Locality.DependentLocality.Name/text()' , i_xmlns).getStringVal() suburb
,extract(value(xmlseq), '/ResultRecord/AddressDetails/Locality.Name/text()' , i_xmlns).getStringVal() town_city
,extract(value(xmlseq), '/ResultRecord/AddressDetails/Postal.PostalCode.Number/text()' , i_xmlns).getStringVal() post_code
,extract(value(xmlseq), '/ResultRecord/AddressDetails/Postal.PostOffice.Name/text()' , i_xmlns).getStringVal() box_lobby_name
,extract(value(xmlseq), '/ResultRecord/AddressDetails/Postal.PostRoute.Name/text()' , i_xmlns).getStringVal() rd_number
FROM TABLE(xmlSequence(extract(i_xml, '/GetAddressSearchResponse/SearchResults' , i_xmlns))) xmlseq;
This is not correct because it doesn’t select anything. The i_xml parameter passed in is the same as above however the i_xmlns parameter that is passed into this cursor is different. It’s currently passed in as:
'xmlns:ns2="urn:nzpost:schemas:xAL:3.0"'
Which matches what is returned in the soap message (first the first address match returned):
&lt;ResultRecord Type=&quot;URBAN&quot;&gt;
&lt;ns2:AddressDetails
xmlns:ns2=&quot;urn:nzpost:schemas:xAL:3.0&quot;&gt;
I'm calling this cursor in loop as follows:
for r_cu in c_xml(v_xml_response, v_xml_namespace)
loop
dbms_output.put_line('***** test12 - ws_avs_clients - IN LOOP - delete/insert nzp23_address');
Nothing gets returned.
Firstly, I’m not sure how to cater for n2, n3, n4, n5, etc which are the namespaces returned and incremented for each address match.
I’m also wondering if my cursor should be changed to something like:
CURSOR c_xml(i_xml IN XMLType, i_xmlns IN VARCHAR2) IS
SELECT extract(value(xmlseq), '/Postal.PostBox.Number/text()' , i_xmlns).getNumberVal() box#
,extract(value(xmlseq), '/Thoroughfare.Number/text()' , i_xmlns).getStringVal() street_number
,extract(value(xmlseq), '/Thoroughfare.Name/text()' , i_xmlns).getStringVal() street_name
,extract(value(xmlseq), '/Locality.DependentLocality.Name/text()' , i_xmlns).getStringVal() suburb
,extract(value(xmlseq), '/Locality.Name/text()' , i_xmlns).getStringVal() town_city
,extract(value(xmlseq), '/Postal.PostalCode.Number/text()' , i_xmlns).getStringVal() post_code
,extract(value(xmlseq), '/Postal.PostOffice.Name/text()' , i_xmlns).getStringVal() box_lobby_name
,extract(value(xmlseq), '/Postal.PostRoute.Name/text()' , i_xmlns).getStringVal() rd_number
FROM TABLE(xmlSequence(extract(i_xml, '/GetAddressSearchResponse/SearchResults/ResultRecord/ns2:AddressDetails' , i_xmlns))) xmlseq;
However I couldn’t have the ns2: before “AddressDetails” because this gets incremented. I don’t think I can also have the i_xmlns namespace parameter passed in as 'xmlns:ns2="urn:nzpost:schemas:xAL:3.0"'
because the ns2 gets incremented for each address.
I'm looking for any examples of pl/sql code that extracts the addresses from the SOAP message returned like I’m trying to do?
Any help would be much appreciated.
Thanks,
Brad

You can find some examples in both the {forum:id=34} and {forum:id=75} forums. Just search on soap:Envelope or soap:Body and you should get some hits back.
Since you are using 10.2, you will want to use XMLTable instead of TABLE(xmlSequence(extract as XMLTable is the direction Oracle is going. As for ns2:, ns4: it doesn't matter what namespace prefix you use in your XPath statement as long as all the prefixes resolve to the same namespace.
Here is a starter piece of code that puts all that together for you.
SELECT town_city, peeking
  FROM XMLTABLE(XMLNamespaces(default 'http://aplt.nzpost.co.nz/schemas/search',
                              'urn:nzpost:schemas:xAL:3.0' as "adns"),
                '/GetAddressSearchResponse/SearchResults/ResultRecord/adns:AddressDetails'
                PASSING XMLTYPE('<GetAddressSearchResponse xmlns="http://aplt.nzpost.co.nz/schemas/search">
   <SearchResults SearchType="StreetAddress">
      <ResultRecord Type="URBAN">
         <ns2:AddressDetails xmlns:ns2="urn:nzpost:schemas:xAL:3.0">
            <ns2:Locality>
               <ns2:Name>LOWER HUTT</ns2:Name>
            </ns2:Locality>
         </ns2:AddressDetails>
          </ResultRecord>
          <ResultRecord Type="URBAN">
               <ns4:AddressDetails xmlns:ns4="urn:nzpost:schemas:xAL:3.0">
                    <ns4:Locality>
                         <ns4:Name>UPPER HUTT</ns4:Name>
                    </ns4:Locality>
               </ns4:AddressDetails>
          </ResultRecord>
     </SearchResults>
</GetAddressSearchResponse>')
                -- The above XMLType would be your variable instead of what is hard-coded
                COLUMNS
                town_city   VARCHAR2(30)  PATH '/adns:AddressDetails/adns:Locality/adns:Name',
                peeking     XMLTYPE       PATH '.');  -- This var is just to show you what each iteration is working with.You can also assign a namespace prefix to one of the default namespaces if your XPath goes across multiple "default" namespaces.
SELECT town_city, peeking
  FROM XMLTABLE(XMLNamespaces('http://aplt.nzpost.co.nz/schemas/search' as "def",  -- made up this prefix
                              'urn:nzpost:schemas:xAL:3.0' as "adns"),
                '/def:GetAddressSearchResponse/def:SearchResults/def:ResultRecord/adns:AddressDetails'
                PASSING XMLTYPE('<GetAddressSearchResponse xmlns="http://aplt.nzpost.co.nz/schemas/search">
   <SearchResults SearchType="StreetAddress">
      <ResultRecord Type="URBAN">
         <ns2:AddressDetails xmlns:ns2="urn:nzpost:schemas:xAL:3.0">
            <ns2:Locality>
               <ns2:Name>LOWER HUTT</ns2:Name>
            </ns2:Locality>
         </ns2:AddressDetails>
          </ResultRecord>
          <ResultRecord Type="URBAN">
               <ns4:AddressDetails xmlns:ns4="urn:nzpost:schemas:xAL:3.0">
                    <ns4:Locality>
                         <ns4:Name>UPPER HUTT</ns4:Name>
                    </ns4:Locality>
               </ns4:AddressDetails>
          </ResultRecord>
     </SearchResults>
</GetAddressSearchResponse>')
                -- The above XMLType would be your variable instead of what is hard-coded
                COLUMNS
                town_city   VARCHAR2(30)  PATH '/adns:AddressDetails/adns:Locality/adns:Name',
                peeking     XMLTYPE       PATH '.');  -- This var is just to show you what each iteration is working with.Hope that helps as a starter to working on your problem.
If you follow the FAQ link in the above right, you will see how to use the { code } tag (without spaces) to wrap the examples and retain formatting as shown above.

Similar Messages

  • "Error while parsing SOAP XML payload: no element found" received when invoking Web Service

    Running PB 12.1 Build 7000.  Using Easysoap.  Error ""Error while parsing SOAP XML payload: no element found" received when invoking Web Service".  This error does not appear to be coming from the application code.  Noticed that there were some erroneous characters showing up within the header portion of the XML ("&Quot;").  Not sure where these are coming from.  When I do a find within the PB code for ""&quot;" it gets located within two objects, whereas they both reference a "temp_xml_letter".  Not sure where or what temp_xml_letter resides???   The developer of this is no longer with us and my exposure to WSDL and Web Services is rather limited.  Need to get this resolved...please.
    This is the result of the search.  Notice the extraneous characters ("&quot;"):
    dar1main.pbl(d_as400_mq_xml)
    darlettr.pbl(d_email_xml)
    ---------- Search: Searching Target darwin for 'temp_xml'    (9:52:41 AM)
    ---------- 2 Matches Found On "temp_xml":
    dar1main.pbl(d_as400_mq_xml).d_as400_mq_xml:  export.xml(usetemplate="temp_xml_letter" headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0  template=(comment="" encoding="UTF-8" name="temp_xml_letter" xml="<?xml version=~"1.0~" encoding=~"UTF-16LE~" standalone=~"yes~"?><EmailServiceTransaction xmlns=~"http://xml.xxnamespace.com/Utility/Email/EmailService" ~" xmlns:imc=~"http://xml.xxnamespace.com/IMC~" xmlns:xsi=~"http://www.w3.org/2001/XMLSchema-instance~" xmlns:root=~"http://xml.xxnamespace.com/RootTypes~" xmlns:email=~"http://xml.xxnamespace.com/Utility/Email~" xsi:schemaLocation=~"http://xml.xxnamespace.com/Utility/Email/EmailService http://dev.xxnamespace.com/Utility/Email/EmailService/V10-TRX-EmailService.xsd~"><EmailServiceInformation><EmailServiceDetail __pbband=~"detail~"><ApplicationIdentifier> applicationidentifier </ApplicationIdentifier><AddresseeInformation><AddresseeDetail><Number> number </Number></AddresseeDetail></AddresseeInformation><EmailMessageInformation><Ema
    darlettr.pbl(d_email_xml).d_email_xml:  export.xml(usetemplate="temp_xml_letter" headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0  template=(comment="" encoding="UTF-8" name="temp_xml_letter" xml="<?xml version=~"1.0~" encoding=~"UTF-16LE~" standalone=~"yes~"?><EmailServiceTransaction xmlns=~"http://xml.xxnamespace.com/Utility/Email/EmailService" ~" xmlns:imc=~"http://xml.xxnamespace.com/IMC~" xmlns:xsi=~"http://www.w3.org/2001/XMLSchema-instance~" xmlns:root=~"http://xml.xxnamespace.com/RootTypes~" xmlns:email=~"http://xml.xxnamespace.com/Utility/Email~" xsi:schemaLocation=~"http://xml.xxnamespace.com/Utility/Email/EmailService http://dev.xxnamespace.com/Utility/Email/EmailService/V10-TRX-EmailService.xsd~"><EmailServiceInformation><EmailServiceDetail __pbband=~"detail~"><ApplicationIdentifier> applicationidentifier </ApplicationIdentifier><AddresseeInformation><AddresseeDetail><Number> imcnumber </Number></AddresseeDetail></AddresseeInformation><EmailMessageInformation><Ema
    ---------- Done 2 Matches Found On "temp_xml":
    ---------- Finished Searching Target darwin for 'temp_xml'    (9:52:41 AM)

    Maybe "extraneous" is an incorrect term.  Apparantly, based upon the writeup within Wiki, the parser I am using does not interpret the "&quot;"?  How do I find which parser is being utilized and how to control it?
    <<<
    If the document is read by an XML parser that does not or cannot read external entities, then only the five built-in XML character entities (see above) can safely be used, although other entities may be used if they are declared in the internal DTD subset.
    If the document is read by an XML parser that does read external entities, then the five built-in XML character entities can safely be used. The other 248 HTML character entities can be used as long as the XHTML DTD is accessible to the parser at the time the document is read. Other entities may also be used if they are declared in the internal DTD subset.
    >>>

  • Read XML File Using PL/SQL

    Hi,
    I have to read a XML file using PL/SQL. I am new to this so please explain in easy steps.
    Regards,
    SF

    STEP - 2
    SQL>
    SQL> DECLARE
      2    l_ctx dbms_xmlsave.ctxType ;
      3    l_xml CLOB :=
      4  '<?xml version="1.0" encoding="UTF-8" ?>
      5  <NewDataSet>
      6      <ROW>
      7          <DEPARTMENT>BA52</DEPARTMENT>
      8          <PCS_CONTRACT_TAG>MD-3GSM</PCS_CONTRACT_TAG>
      9          <LOCATION>Australia</LOCATION>
    10          <MAY_2006>21668</MAY_2006>
    11      </ROW>
    12      <ROW>
    13          <DEPARTMENT>BA501</DEPARTMENT>
    14          <PCS_CONTRACT_TAG>MD-3GSM</PCS_CONTRACT_TAG>
    15          <LOCATION>China</LOCATION>
    16          <MAY_2006>8166</MAY_2006>
    17      </ROW>
    18      <ROW>
    19          <DEPARTMENT>BA522</DEPARTMENT>
    20          <PCS_CONTRACT_TAG>MD-3GSM</PCS_CONTRACT_TAG>
    21          <LOCATION>Australia</LOCATION>
    22          <MAY_2006>21668</MAY_2006>
    23      </ROW>
    24  </NewDataSet>' ;
    25  BEGIN
    26      l_ctx := dbms_xmlsave.newContext(targetTable => 'XML_INSERT');
    27      dbms_output.put_line(dbms_xmlsave.insertXML(ctxHdl => l_ctx,
    28                                                  xDoc   => l_xml) ||
    29                           ' rows inserted.');
    30      dbms_xmlsave.closeContext(l_ctx);
    31  END;
    32  /
    3 rows inserted.
    PL/SQL procedure successfully completed.Regards.
    Satyaki De.

  • Problem in retreiving string 1020 using ms sql  in BODI sql query

    I am taking a column from ms sql using select statement in bodi like
    $temp=sql('ds_stage',select x from table A where X>1);
    print('[$temp]');
    it is printing the value upto 1020 characters of my data,after that it is not showing the remaining data.
    I tried printing the sql statement directly in print statement rather than assigning it to a variable,
    I tried casting teh value in select statemet like cast(x as text) or varchar and more.. nothing works..
    no change in the result.
    is that problem with BODI ? same query give full 1500 characters in ms sql but it doesnt come in BODI
    I do not understand the problem.
    Thanks

    I assume from your message that you are attempting to
    deploy your application into OC4J - you're probably
    implicitly using the inbuilt OC4J if your using JSPs.
    If so, try placing the jdbc jars into the <JDEVHOME>\lib directory
    and referencing them from the j2ee\home\application.xml
    file:
    use lines like:
    <library path="../../../lib/msbase.jar" />
    regards, Karl

  • XML parsing problems with Oracle XML parser for PL/SQL

    I am using the Oracle XML parser for PL/SQL to transform XML into HTML usign XSL. The parser gives me sporadic errors trying to parse various XML documents. For the same XML source, the XMLPARSER will parse without errors one day and the next day will give me errors such as "invalid char in text", "Expected ';'.", or even Java null pointer exceptions.
    I have verified that the XML sources are well formed, so I am pretty certain that the problems I am having are bugs in the XMLPARSER.
    Is there going to be a XML parser for PL/SQL version 2 that will fix these bugs? If so, when??? If not, is there anything else I could do to fix these problems?
    Thanks!

    You can use the latest version.

  • Soap xml payload

    hi iam working on soap to rfc and i am using sap soap test client.
    can any one send me the xml payload to test the sap test client using the data .
    tahnks and regards
    viju

    vijendar ,
    r u telling that u need some sample WSDL file to test ur soap client??
    if so here is one WSDL....
      <?xml version="1.0" encoding="UTF-8" ?>
    <wsdl:definitions targetNamespace="http://webservices.imacination.com/distance/Distance.jws" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:intf="http://webservices.imacination.com/distance/Distance.jws" xmlns:impl="http://webservices.imacination.com/distance/Distance.jws">
    <wsdl:message name="getLongitudeResponse">
      <wsdl:part name="getLongitudeReturn" type="xsd:double" />
      </wsdl:message>
    <wsdl:message name="getLongitudeRequest">
      <wsdl:part name="zip" type="xsd:string" />
      </wsdl:message>
    <wsdl:message name="getLatitudeRequest">
      <wsdl:part name="zip" type="xsd:string" />
      </wsdl:message>
    <wsdl:message name="getLatitudeResponse">
      <wsdl:part name="getLatitudeReturn" type="xsd:double" />
      </wsdl:message>
    <wsdl:message name="getCityResponse">
      <wsdl:part name="getCityReturn" type="xsd:string" />
      </wsdl:message>
    <wsdl:message name="getCityRequest">
      <wsdl:part name="zip" type="xsd:string" />
      </wsdl:message>
    <wsdl:message name="getLocationResponse">
      <wsdl:part name="getLocationReturn" type="xsd:string" />
      </wsdl:message>
    <wsdl:message name="getStateResponse">
      <wsdl:part name="getStateReturn" type="xsd:string" />
      </wsdl:message>
    <wsdl:message name="getStateRequest">
      <wsdl:part name="zip" type="xsd:string" />
      </wsdl:message>
    <wsdl:message name="getLocationRequest">
      <wsdl:part name="zip" type="xsd:string" />
      </wsdl:message>
    <wsdl:message name="getDistanceResponse">
      <wsdl:part name="getDistanceReturn" type="xsd:double" />
      </wsdl:message>
    <wsdl:message name="getDistanceRequest">
      <wsdl:part name="fromZip" type="xsd:string" />
      <wsdl:part name="toZip" type="xsd:string" />
      </wsdl:message>
    <wsdl:portType name="Distance">
    <wsdl:operation name="getState" parameterOrder="zip">
      <wsdl:input name="getStateRequest" message="impl:getStateRequest" />
      <wsdl:output name="getStateResponse" message="impl:getStateResponse" />
      </wsdl:operation>
    <wsdl:operation name="getLocation" parameterOrder="zip">
      <wsdl:input name="getLocationRequest" message="impl:getLocationRequest" />
      <wsdl:output name="getLocationResponse" message="impl:getLocationResponse" />
      </wsdl:operation>
    <wsdl:operation name="getCity" parameterOrder="zip">
      <wsdl:input name="getCityRequest" message="impl:getCityRequest" />
      <wsdl:output name="getCityResponse" message="impl:getCityResponse" />
      </wsdl:operation>
    <wsdl:operation name="getDistance" parameterOrder="fromZip toZip">
      <wsdl:input name="getDistanceRequest" message="impl:getDistanceRequest" />
      <wsdl:output name="getDistanceResponse" message="impl:getDistanceResponse" />
      </wsdl:operation>
    <wsdl:operation name="getLatitude" parameterOrder="zip">
      <wsdl:input name="getLatitudeRequest" message="impl:getLatitudeRequest" />
      <wsdl:output name="getLatitudeResponse" message="impl:getLatitudeResponse" />
      </wsdl:operation>
    <wsdl:operation name="getLongitude" parameterOrder="zip">
      <wsdl:input name="getLongitudeRequest" message="impl:getLongitudeRequest" />
      <wsdl:output name="getLongitudeResponse" message="impl:getLongitudeResponse" />
      </wsdl:operation>
      </wsdl:portType>
    <wsdl:binding name="DistanceSoapBinding" type="impl:Distance">
      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="getState">
      <wsdlsoap:operation soapAction="" />
    <wsdl:input name="getStateRequest">
      <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" />
      </wsdl:input>
    <wsdl:output name="getStateResponse">
      <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://webservices.imacination.com/distance/Distance.jws" />
      </wsdl:output>
      </wsdl:operation>
    <wsdl:operation name="getLocation">
      <wsdlsoap:operation soapAction="" />
    <wsdl:input name="getLocationRequest">
      <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" />
      </wsdl:input>
    <wsdl:output name="getLocationResponse">
      <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://webservices.imacination.com/distance/Distance.jws" />
      </wsdl:output>
      </wsdl:operation>
    <wsdl:operation name="getCity">
      <wsdlsoap:operation soapAction="" />
    <wsdl:input name="getCityRequest">
      <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" />
      </wsdl:input>
    <wsdl:output name="getCityResponse">
      <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://webservices.imacination.com/distance/Distance.jws" />
      </wsdl:output>
      </wsdl:operation>
    <wsdl:operation name="getDistance">
      <wsdlsoap:operation soapAction="" />
    <wsdl:input name="getDistanceRequest">
      <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" />
      </wsdl:input>
    <wsdl:output name="getDistanceResponse">
      <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://webservices.imacination.com/distance/Distance.jws" />
      </wsdl:output>
      </wsdl:operation>
    <wsdl:operation name="getLatitude">
      <wsdlsoap:operation soapAction="" />
    <wsdl:input name="getLatitudeRequest">
      <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" />
      </wsdl:input>
    <wsdl:output name="getLatitudeResponse">
      <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://webservices.imacination.com/distance/Distance.jws" />
      </wsdl:output>
      </wsdl:operation>
    <wsdl:operation name="getLongitude">
      <wsdlsoap:operation soapAction="" />
    <wsdl:input name="getLongitudeRequest">
      <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" />
      </wsdl:input>
    <wsdl:output name="getLongitudeResponse">
      <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://webservices.imacination.com/distance/Distance.jws" />
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
    <wsdl:service name="DistanceService">
    <wsdl:port name="Distance" binding="impl:DistanceSoapBinding">
      <wsdlsoap:address location="http://webservices.imacination.com/distance/Distance.jws" />
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>
    regards
    BILL

  • Import xml file using pl/sql

    Hi,
    i have an oracle 8i database.
    in a few weeks i will be receiving a number of xml files on a daily basis.
    i want to import these files into my oracle database using pl/sql. However, although i know i can do this, i have been unable to find any sample code for this type of operation.
    Can someone please help.
    Thanks
    Joe

    Hi Joe,
    I have a ready solution for this problem.
    Let suppose You have an XML doc in canonical form:
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW num="1">
    <DEPARTMENT_ID>99</DEPARTMENT_ID>
    <DEPARTMENT_NAME>OKATAS</DEPARTMENT_NAME>
    <MANAGER_ID>100</MANAGER_ID>
    <LOCATION_ID>1700</LOCATION_ID>
    </ROW>
    <ROW num="2">
    <DEPARTMENT_ID>77</DEPARTMENT_ID>
    <DEPARTMENT_NAME>PERSONNEL</DEPARTMENT_NAME>
    <LOCATION_ID>1800</LOCATION_ID>
    </ROW>
    </ROWSET>
    These tag names are mandatory (ROW and ROWSET).
    1. First create an Oracle directory, for example in UNIX:
    CREATE DIRECTORY TANF_DIR AS '/home1/teach1/DEMO';
    2. Create a procedure which reads the XML file (such as DEPT.XML)
    CREATE OR REPLACE PROCEDURE XML_TO_SQL
    (dir_name VARCHAR2,file_name VARCHAR2,TNAME VARCHAR2)
    AUTHID CURRENT_USER IS
    FH UTL_FILE.FILE_TYPE;
    C CLOB;
    PUF VARCHAR2(1000);
    READ_COUNT NUMBER:=0; ERROR_COUNT NUMBER:=0;
    procedure INSERTProc(xmlDoc IN CLOB, tableName IN VARCHAR2)
    IS
    insCtx DBMS_XMLSave.ctxType;
    rows number;
    begin
    insCtx := DBMS_XMLSave.newContext(tableName); -- get the context handle
    rows := DBMS_XMLSave.insertXML(insCtx,xmlDoc); -- this inserts the document
    DBMS_XMLSave.closeContext(insCtx);
    You can save the XML document as data of XMLtype,which was introduced in Oracle 9i
    INSERT INTO xml_table(key,xml_doc)
    VALUES(xml_seq.NEXTVAL,sys.xmltype.createxml(xmldoc));
    */ -- this closes the handle
    END INSERTPROC;
    BEGIN
    DBMS_OUTPUT.ENABLE(1000000);
    FH:=UTL_FILE.FOPEN(DIR_NAME,FILE_NAME,'R');
    LOOP
    UTL_FILE.GET_LINE(FH,puf);
    READ_COUNT:=READ_COUNT+1;
    c:=c||puf;
    -- DBMS_OUTPUT.PUT_LINE(PUF);
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    DBMS_OUTPUT.PUT_LINE('FINISH '||READ_COUNT||' ROWS. ERRORS: ' ||ERROR_COUNT);
    UTL_FILE.FCLOSE(FH);
    INSERTProc(C,TNAME);
    COMMIT;
    END XML_TO_SQL;
    3. Create table NEWDEPT .. containing the column names which are in the XML ROW tag(DEPARTMENT_ID, ...)
    4. Execute the procedure:
    exec xml_to_sql('TANF_DIR','DEPT.XML','NEWDEPT')

  • XML Generation using a sql query in an efficient way -Help needed urgently

    Hi
    I am facing the following issue while generating xml using an sql query. I get the below given table using a query.
         CODE      ID      MARK
    ==================================
    1 4 2331 809
    2 4 1772 802
    3 4 2331 845
    4 5 2331 804
    5 5 2331 800
    6 5 2210 801
    I need to generate the below given xml using a query
    <data>
    <CODE>4</CODE>
    <IDS>
    <ID>2331</ID>
    <ID>1772</ID>
    </IDS>
    <MARKS>
    <MARK>809</MARK>
    <MARK>802</MARK>
    <MARK>845</MARK>
    </MARKS>
    </data>
    <data>
    <CODE>5</CODE>
    <IDS>
    <ID>2331</ID>
    <ID>2210</ID>
    </IDS>
    <MARKS>
    <MARK>804</MARK>
    <MARK>800</MARK>
    <MARK>801</MARK>
    </MARKS>
    </data>
    Can anyone help me with some idea to generate the above given CLOB message

    not sure if this is the right way to do it but
    /* Formatted on 10/12/2011 12:52:28 PM (QP5 v5.149.1003.31008) */
    WITH data AS (SELECT 4 code, 2331 id, 809 mark FROM DUAL
                  UNION
                  SELECT 4, 1772, 802 FROM DUAL
                  UNION
                  SELECT 4, 2331, 845 FROM DUAL
                  UNION
                  SELECT 5, 2331, 804 FROM DUAL
                  UNION
                  SELECT 5, 2331, 800 FROM DUAL
                  UNION
                  SELECT 5, 2210, 801 FROM DUAL)
    SELECT TO_CLOB (
                 '<DATA>'
              || listagg (xml, '</DATA><DATA>') WITHIN GROUP (ORDER BY xml)
              || '</DATA>')
              xml
      FROM (  SELECT    '<CODE>'
                     || code
                     || '</CODE><IDS><ID>'
                     || LISTAGG (id, '</ID><ID>') WITHIN GROUP (ORDER BY id)
                     || '</ID><IDS><MARKS><MARK>'
                     || LISTAGG (mark, '</MARK><MARK>') WITHIN GROUP (ORDER BY id)
                     || '</MARK></MARKS>'
                        xml
                FROM data
            GROUP BY code)

  • Creating XML report using PL/SQL Stored Procedure

    Hi Friends,
    I am working on an xml report with the xml source as PL/SQL Stored Procedure.
    I am referring the exercise shown in the following link to understand the process:
       http://orclapp.blogspot.com/2012/02/developing-xml-publisher-report-using.html
    In the example shown in the above link I could not understand the following:
    1) In the following procedure, the out parameter 'retcode' is not used at all.
       What is the importance of this parameter.
        PROCEDURE REPORT (errbuf  OUT VARCHAR2, retcode  OUT VARCHAR2, p_product_id   IN     NUMBER)
    2)  After the xml data is prepared and put to 'l_result' Clob variable, the following
        Loop is executed. I am not able to appreciate why the following loop is required.
         LOOP
             EXIT WHEN l_length = l_retrieved;
             IF (l_length - l_retrieved) < 32000
             THEN
                SELECT SUBSTR (l_result, l_retrieved + 1) INTO l_xmlstr FROM DUAL;
                l_retrieved := l_length;
                fnd_file.put_line (fnd_file.output, l_xmlstr);
             ELSE
                SELECT SUBSTR (l_result, l_retrieved + 1, l_offset)
                  INTO l_xmlstr
                  FROM DUAL;
                l_retrieved := l_retrieved + l_offset;
                fnd_file.put_line (fnd_file.output, l_xmlstr);
             END IF;
         END LOOP;
    3) In the example it is not explained how the concurrent program gets the xml data?
       I assume it is written to a file using the following line of code:
        fnd_file.put_line (fnd_file.output, l_xmlstr);
       I would appreciate if anyone can throw some light into my above queries so that I can understand the process clearly.
    Thanks & Regards
    Hawker

    Hi 32000 in the code is a 'safe' size smaller than the max available 32767, the loops purpose is to move through the entire thing in chunks that will be manageable in the limits of the data type.
    Btw; if you are in Oracle e-business suite then you can also use Oracle reports very simply to create XML output.
    If you have reports developer all you need to do is put raw sql (without any 'artifice' to create XML) in the report SQL and then set the reports output to XML in the program definition in Oracle e-business.
    best regards,
    Robert.

  • Validating XML with XML Schema using PL/SQL

    Hello,
    I have XSD file and a example XML file.
    Using pl/sql how I can validate the example XML is valid for XSD file?
    Thanks in advance.
    Bakul
    Message was edited by:
    bakulesh

    Have you looked at this documentation, Transforming and Validating XMLType Data

  • Parse an Aggregate in XML Document using PL/SQL

    Hi. I've been successful with parsing a TAG in XML Document stored in CLOB using PL/SQL XML Parser.
    However, I need help on how to get the whole aggregate in XML Document stored in CLOB.
    sample XML Doc :
    <library>
    <book>
    <title>Oracle Complete Reference</title>
    <author>Kevin</Author>
    <year>2000</year>
    </book>
    <video>
    <title>Learning C++</title>
    <length>2 hours</length>
    <video>
    </library>
    I need a function that will accept an Input which is the aggregate name and will return the aggregate value.
    With the sample XML above, say the input is 'VIDEO', the function will return :
    <video>
    <title>Learning C++</title>
    <length>2 hours</length>
    <video>
    I'll really appreciate any help.
    null

    I used such an example to parse several Varchar2 strings in a given DB session:
    BEGIN
    parser := xmlparser.newparser ;
    xmlparser.parsebuffer(parser,xmlout) ;
    domdoc := xmlparser.getDocument(parser) ;
    xmlparser.FREEPARSER(parser) ;
    parser.id := -1 ;
    nodes := xslprocessor.selectNodes(
    xmldom.makenode(domdoc),
    'Positionen/Position') ;
    for i in 1 .. xmldom.getLength(nodes) loop
    node := xmldom.item(nodes,i-1) ;
    -- do s/thing with the node
    end loop ;
    xmldom.freedocument(domdoc) ;
    RETURN(komponenten) ;
    EXCEPTION
    WHEN OTHERS THEN
    if parser.id <> -1 then xmlparser.freeparser(parser) ;
    end if ;
    if domdoc.id <> -1 then xmldom.freedocument(domdoc) ;
    end if ;
    RAISE ;
    END ;
    However, after about 2000 of nodes lists parsed, I get an ArrayIndexOutOfBoundsException from XMLNodeCover. Obviously, I should release the nodes or the nodelist, but I have not found any procedure to do this.
    Pascal

  • Extracting compressed file (zip) using PL/SQL

    Hi!
    Can anyone help me on how to extract data out of a compressed file(ZIP) using pl sql.
    Regards,
    dhekz

    user8707902 wrote:
    Can anyone help me on how to extract data out of a compressed file(ZIP) using pl sql.Bear in mind that the Lempel-Zif-Welch (LZW) compression used in zip files may still have patent issue relating to Unisys (not sure of the patent has expired now or what, it's always been somewhat confusing). So, if you already have software written to zip/unzip files you should use that as it should be licenced already. If you write your own LZW compression/decompression routine for use in any commercial software you may be required to register and submit royalties to Unisys for the privilege. As I say, I don't know the latest, so you may be ok, but it's something to be aware of and check out if you intend to write your own and it's for commercial reasons.

  • How to iterate xml elements using PL/SQL

    Hello,
    Let's say I have the following xml:
    <A>
    <B name="b1">
    </B>
    <B name="b2">
    </B>
    </A>
    I would like to iterate over the B and sub-B elements using PL/SQL?
    Any help will be appreciated.

    Hi,
    You can use 'PL/SQL DOM API for XMLType (DBMS_XMLDOM)'
    to work with XML. You can check the example present at
    http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/appdev.920/a96620/xdb08pls.htm#1041419
    to check how it does.
    The API for the package DBMS_XMLDOM is given on the same page(http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/appdev.920/a96620/xdb08pls.htm#1040676)
    You can use them for your requirement.
    Regards,
    Anupama

  • XML Parser using PL/SQL

    Hi all,
    I am new to XML. I have a text variables for example:
    v_doc_text :=
    '<emp>
    <empno no="3">1</empno>
    <fname>robert</fname>
    <lname>smith</lname>
    <sal>1000</sal>
    <job>engineer</job>
    </emp>';
    I want to parse this xml and in pl/sql variable.
    Please help me how to do it or please give me an example.
    I appreciate the help.
    Thx.

    Which version of the database are you running? Do you know whether it's got the XDK installed and enabled?
    If you are new to XML you won't understand the difference between XMLSchema and DTD. But you need to understand the principles of XML before you leap into coding it. For instance, how do you know that text file is valid? You don't, because it has not been validated against either an XMLSchema nor a DTD.
    The Oracle document is focussed on their bespoke implementation, and is not beginner-friendly. I suggest you start with this O'Reilly piece and then read about document validation.
    And if you want a good, free lightweight XML editor I recommend XML Notepad which is a Microsoft beta product (not supported, beware of downloading strange .EXE etc).
    Good luck, APC

  • Problems with deploying cmproster example using ms sql server as database

    hi to all,
    im new to ejb and i like to learn by doing the examples given in the j2ee tutorial. i want to deploy the cmproster with a bit of modification...i want to use ms sql server as the database..i have configured the data source and connection pools correctly..and when i run the Client Application there is no error. The database seems fine it was populated correctly..only some of the values become null..
    Here is the sample output from the client app:
    P7 null null 777.0
    P8 null null 65.0
    P10 null null 100.0
    P6 null null 555.0
    P9 null null 100.0
    The two columns should be strings...i look at the server.log and there where errors:
    Error while getting value from resultset at index 2 as resultType 21columnSqlType=JDO76: 12.Exception java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
    I think thats the culprit...Can anyone help me on this? tnx
    Note:
    By the way im using sun.jdbc.odbc.JdbcOdbcDriver for the jdbc driver
    Thanx
    -oyam

    Hi Michael,
    At this time SQL Server 2000 is not certified for WLCS 3.5. Since the
    schema has changed between 3.2 and 3.5, running the 3.2 scripts is not a
    good idea.
    I can tell you that certification is in progress for SQL Server 2000. Your
    best bet is to contact your Sales Representative to get an idea of when
    certification might be coming.
    I hope this helps.
    - Ginny
    "Michael Schulz" <[email protected]> wrote in message
    news:[email protected]..
    I'm using WebLogic 6.0sp1 with Commerce Server 3.5 and I've successfully
    installed the demo. I would like to create another commerce server
    installation, this time using Microsoft SQL Server 2000 as the database
    instead of Cloudscape. I've downloaded and installed the BEA jDriver
    for MS SQL 7/2000 and tested it using dbping. My question is: where are
    the db scripts for creating and populating the commerce database? I've
    found the WLCS_320_DB_DDL_1.1.zip file on the BEA downloads site, but
    I'm concerned that this schema is for Version 3.20 of Commerce Server.
    Is there a similar file for WLCS 3.50? If not, is it safe to use this
    one?
    If this is posted in the wrong place, please let me know and I'll repost
    to the appropriate newsgroup as required.
    Sincerely,
    Michael Schulz

Maybe you are looking for

  • Unable to read payload from the message object in XI

    Hello Guys, Please help me about my problem in XI version 7.0.im quite new here. im trying to test my config but error message occured. "Unable to read payload from the message object" when i checked the comm channel this is the error message : Error

  • Exporting Quicktimes from Premiere Pro

    When exporting video from Premiere pro, uncompressed or HD 1080i Quicktime settings crash my machine every time , any idea why? I'm trying to find the best export to give to a colleague working remotely on a mac using aftereffects

  • Device profile settings

    Have now done 3 tv resets to try and get this to work whilst attempting to set up cloud. Agreed to terms and conditions etc but then the screen seems to freeze when it comes to "device profile settings" . Any suggestions? Thanks in advance.

  • LMS , AAA via Radius and cisco AV pair

    We are trying to authenticate users on a Ciscoworks LMS server 2.6 using Radius. Is there a radius vendor specific attribute that can be used to make the authenticated user part of the admin groups ? Ex : a Cisco-AV-pair , ?LMS?:groups="Network Admin

  • Cant update billing address?

    I have been trying to update my billing address so I can use my Itunes account, nothing seems to be working I have tried doing it every single way and I get different errors such as the zip code being invalid to your update has been processed but it