Solved

Help selecting a particular XML Node from a Soap Request

Posted on 2010-08-18
2
746 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sql for Oracle views 8 49
report returning null 21 81
VB.Net - Oracle BulkCopy from CSV Date Format 7 47
Use of Exception to end a Loop 3 19
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…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to recover a database from a user managed backup

867 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

18 Experts available now in Live!

Get 1:1 Help Now