Solved

Help selecting a particular XML Node from a Soap Request

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Suggested Courses

630 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