Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8062135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:34:02+00:00 2026-06-05T10:34:02+00:00

I have been trying to process this SOAP XML return using T-SQL but all

  • 0

I have been trying to process this SOAP XML return using T-SQL but all I get is NULL or nothing at all. I have tried different ways and pasted them all below.

Declare @xmlMsg xml;

Set @xmlMsg = 
'<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">
  <soap:Body>
    <SendWarrantyEmailResponse xmlns="http://Web.Services.Warranty/">
      <SendWarrantyEmailResult xmlns="http://Web.Services.SendWarrantyResult">
        <WarrantyNumber>120405000000015</WarrantyNumber>
        <Result>Cannot Send Email to anonymous account!</Result>
        <HasError>true</HasError>
        <MsgUtcTime>2012-06-07T01:11:36.8665126Z</MsgUtcTime>
      </SendWarrantyEmailResult>
    </SendWarrantyEmailResponse>
  </soap:Body>
</soap:Envelope>';

declare @table table (data xml);
insert into @table values (@xmlMsg);

select data from @table;

WITH xmlnamespaces ('http://schemas.xmlsoap.org/soap/envelope/' as [soap], 'http://Web.Services.Warranty' as SendWarrantyEmailResponse, 'http://Web.Services.SendWarrantyResult' as SendWarrantyEmailResult)
SELECT Data.value('(/soap:Envelope[1]/soap:Body[1]/SendWarrantyEmailResponse[1]/SendWarrantyEmailResult[1]/WarrantyNumber[1])[1]','VARCHAR(500)') AS WarrantyNumber
FROM @Table ;

;with xmlnamespaces('http://schemas.xmlsoap.org/soap/envelope/' as [soap],'http://Web.Services.Warranty' as SendWarrantyEmailResponse,'http://Web.Services.SendWarrantyResult' as SendWarrantyEmailResult)
--select @xmlMsg.value('(/soap:Envelope/soap:Body/SendWarrantyEmailResponse/SendWarrantyEmailResult/WarrantyNumber)[0]', 'nvarchar(max)')
--select T.N.value('.', 'nvarchar(max)') from @xmlMsg.nodes('/soap:Envelope/soap:Body/SendWarrantyEmailResponse/SendWarrantyEmailResult') as T(N)
select @xmlMsg.value('(/soap:Envelope/soap:Body/SendWarrantyEmailResponse/SendWarrantyEmailResult/HasError)[1]','bit') as test

;with xmlnamespaces('http://schemas.xmlsoap.org/soap/envelope/' as [soap],'http://Web.Services.Warranty' as [SendWarrantyEmailResponse],'http://Web.Services.SendWarrantyResult' as [SendWarrantyEmailResult])
SELECT
 SendWarrantyEmailResult.value('WarrantyNumber[1]','varchar(max)') AS WarrantyNumber,
 SendWarrantyEmailResult.value('Result[1]','varchar(max)') AS Result,
 SendWarrantyEmailResult.value('HasError[1]','bit') AS HasError,
 SendWarrantyEmailResult.value('MsgUtcTime[1]','datetime') AS MsgUtcTime
FROM @xmlMsg.nodes('/soap:Envelope/soap:Body/SendWarrantyEmailResponse/SendWarrantyEmailResult') SendWarrantyEmailResults(SendWarrantyEmailResult)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T10:34:03+00:00Added an answer on June 5, 2026 at 10:34 am

    Well I had a moment to rethink, and I came up with the answer, so i’m sure someone out there will be looking for this.

    Take a close look at the abbreviation of the namespace that’s the magic that makes it all work. Hope this helps someone out there

    Declare @xmlMsg xml;
    
    Set @xmlMsg = 
    '<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">
      <soap:Body>
        <SendWarrantyEmailResponse xmlns="http://Web.Services.Warranty/">
          <SendWarrantyEmailResult xmlns="http://Web.Services.SendWarrantyResult">
            <WarrantyNumber>120405000000015</WarrantyNumber>
            <Result>Cannot Send Email to anonymous account!</Result>
            <HasError>true</HasError>
            <MsgUtcTime>2012-06-07T01:11:36.8665126Z</MsgUtcTime>
          </SendWarrantyEmailResult>
        </SendWarrantyEmailResponse>
      </soap:Body>
    </soap:Envelope>';
    
    declare @table table (data xml);
    insert into @table values (@xmlMsg);
    
    select data from @table;
    
    WITH xmlnamespaces (
    'http://schemas.xmlsoap.org/soap/envelope/' as [soap], 
    'http://Web.Services.Warranty/' as Resp, 
    'http://Web.Services.SendWarrantyResult' as Res)
    SELECT Data.value('(/soap:Envelope/soap:Body/Resp:SendWarrantyEmailResponse/Res:SendWarrantyEmailResult/Res:WarrantyNumber)[1]','VARCHAR(500)') AS WarrantyNumber
    FROM @Table ;
    
    ;with xmlnamespaces(
    'http://schemas.xmlsoap.org/soap/envelope/' as [soap],
    'http://Web.Services.Warranty/' as Resp,
    'http://Web.Services.SendWarrantyResult' as Res)
    select @xmlMsg.value('(/soap:Envelope/soap:Body/Resp:SendWarrantyEmailResponse/Res:SendWarrantyEmailResult/Res:WarrantyNumber)[1]', 'nvarchar(max)')
    --select T.N.value('.', 'nvarchar(max)') from @xmlMsg.nodes('/soap:Envelope/soap:Body/SendWarrantyEmailResponse/SendWarrantyEmailResult:SendWarrantyEmailResult') as T(N)
    --select @xmlMsg.value('(/soap:Envelope/soap:Body/SendWarrantyEmailResponse/SendWarrantyEmailResult/SendWarrantyEmailResult:HasError)[1]','bit') as test
    
    ;with xmlnamespaces(
    'http://schemas.xmlsoap.org/soap/envelope/' as [soap],
    'http://Web.Services.Warranty/' as Resp,
    'http://Web.Services.SendWarrantyResult' as Res)
    SELECT
     SendWarrantyEmailResult.value('Res:WarrantyNumber[1]','varchar(max)') AS WarrantyNumber,
     SendWarrantyEmailResult.value('Res:Result[1]','varchar(max)') AS Result,
     SendWarrantyEmailResult.value('Res:HasError[1]','bit') AS HasError,
     SendWarrantyEmailResult.value('Res:MsgUtcTime[1]','datetime') AS MsgUtcTime
    FROM @xmlMsg.nodes('/soap:Envelope/soap:Body/Resp:SendWarrantyEmailResponse/Res:SendWarrantyEmailResult') SendWarrantyEmailResults(SendWarrantyEmailResult)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to get this to work with several tutorials/answers here, but
I have been trying all afternoon to get the jQuery Sifr Plugin ( http://jquery.thewikies.com/sifr/
I have been trying to figure out a solution but nothing has really presented
I have been trying to get my EditText box to word wrap, but can't
I would really appreciate your help in this. I have been trying to get
I have been trying to get ruby 1.8.6 to connect to a MS SQL
I have been trying to figure out why this PL/SQL purge script runs slowly
Have have been trying to make a validator for my xml files. I have
I have been trying to write a bare-bones ping scanner using Perl for internal
I have been trying to understand the way ActionScript's events are implemented, but I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.