Solved

Help selecting a particular XML Node from a Soap Request

Posted on 2010-08-18
2
750 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 74

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

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…
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 explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

729 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