Solved

Help selecting a particular XML Node from a Soap Request

Posted on 2010-08-18
2
745 Views
Last Modified: 2013-12-19
XML is this...
<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"
               xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
  <soap:Header>
    <MyHeader xmlns="http://v1x1.identityheader.wbxml.ts.xx.net/">
      <SenderID>X434150</SenderID>
    </MyHeader>
    <MyRequestHeader xmlns="http://v1x1.requestheader.wbxml.ts.xx.net/">
      <SendingTimeStamp>2010-08-18T10:36:59.6925796-04:00</SendingTimeStamp>      
    </MyRequestHeader>
    <wsa:Action>AddCustomer</wsa:Action>
  </soap:Header>
  <soap:Body>
    <AddCustomerRequest xmlns="http://v1x5.addcustomer.message.retail.xx.net/">
    </AddCustomerRequest>
  </soap:Body>
</soap:Envelope>


I need to select the SenderID, SendingTimeStamp and wsa:Action.

I have tried...

select extractvalue(xmltype('<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"
               xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
  <soap:Header>
    <MyHeader xmlns="http://v1x1.identityheader.wbxml.ts.xx.net/">
      <SenderID>X434150</SenderID>
    </MyHeader>
    <MyRequestHeader xmlns="http://v1x1.requestheader.wbxml.ts.xx.net/">
      <SendingTimeStamp>2010-08-18T10:36:59.6925796-04:00</SendingTimeStamp>      
    </MyRequestHeader>
    <wsa:Action>AddCustomer</wsa:Action>
  </soap:Header>
  <soap:Body>
    <AddCustomerRequest xmlns="http://v1x5.addcustomer.message.retail.xx.net/">
    </AddCustomerRequest>
  </soap:Body>
</soap:Envelope>'),'//Envelope/Header/MyRequestHeader/SendingTimeStamp') a from dual

but this returns null...

Thanks for your help...

G
0
Comment
Question by:gswitz
2 Comments
 
LVL 73

Accepted Solution

by:
sdstuber earned 500 total points
ID: 33466277
you need to include the namespaces in your extraction
SELECT EXTRACTVALUE(

           xml,

           '//SenderID',

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

               xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"

               xmlns="http://v1x1.identityheader.wbxml.ts.xx.net/"'

       )

           senderid,

       EXTRACTVALUE(

           xml,

           '//SendingTimeStamp',

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

               xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"

               xmlns="http://v1x1.requestheader.wbxml.ts.xx.net/"'

       )

           sendingtimestamp,

       EXTRACTVALUE(

           xml,

           '//wsa:Action',

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

               xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"

               xmlns="http://v1x1.identityheader.wbxml.ts.xx.net/"'

       )

           action

FROM (SELECT xmltype(

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

               xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">

  <soap:Header>

    <MyHeader xmlns="http://v1x1.identityheader.wbxml.ts.xx.net/">

      <SenderID>X434150</SenderID>

    </MyHeader>

    <MyRequestHeader xmlns="http://v1x1.requestheader.wbxml.ts.xx.net/">

      <SendingTimeStamp>2010-08-18T10:36:59.6925796-04:00</SendingTimeStamp>      

    </MyRequestHeader>

    <wsa:Action>AddCustomer</wsa:Action>

  </soap:Header>

  <soap:Body>

    <AddCustomerRequest xmlns="http://v1x5.addcustomer.message.retail.xx.net/">

    </AddCustomerRequest>

  </soap:Body>

</soap:Envelope>'

             )

                 xml

      FROM DUAL)

Open in new window

0
 

Author Closing Comment

by:gswitz
ID: 33466425
Thanks!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now