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

  • SEARCH
  • Home
  • 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 9179461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:48:08+00:00 2026-06-17T17:48:08+00:00

I have to select specific node from the WCF request OperationContext.Current.RequestContext.RequestMessage.ToString() The problem is

  • 0

I have to select specific node from the WCF request OperationContext.Current.RequestContext.RequestMessage.ToString()

The problem is that namespaces are changeing prefixes between requests:

So once it is:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <s:Body>
  </s:Body>
</s:Envelope>

and other time it is:

<soapenv:Envelope xmlns:mes="MessageContracts" xmlns:req="RequestMessages" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
  </soapenv:Body>
</soapenv:Envelope>

How can I assure that I always get Body node correctly?

  • 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-17T17:48:10+00:00Added an answer on June 17, 2026 at 5:48 pm

    It doesn’t matter what the prefixes are as long as the nodes are using the same namespace consistently (which they are in your example). You just need to make sure that you create a prefix->namespace mapping for the namespace correctly when you do your selection:

    The following code should work as-is for both of your example xmls:

    // assuming XmlDocument doc has already been loaded with the XML response
    XmlNamespaceManager nsm = new XmlNamespaceManager(doc.NameTable);
    nsm.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/");
    XmlNode body = doc.SelectSingleNode("/soap:Envelope/soap:Body", nsm);
    

    Working ideone example

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having the problem that I cannot select a specific XML node which
I have a problem in MySQL when trying to select specific entry from table
I want to use the if statement to select specific pages that have <body
Why I have to use Object[] to print the list if I select specific
Let's say we have: SELECT * FROM Pictures JOIN Categories ON Categories.CategoryId = Pictures.CategoryId
Let's say I have SELECT name FROM table which gives me something like foo
suppose I have SELECT * FROM table t GROUP BY j HAVING condition_one OR
From my previous question for selecting specific html text, I have gone through this
I have a rather specific question perhaps.. I have a user that will enter
I have an XPath query that's trying to grab the parent of a specific

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.