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 790119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:38:00+00:00 2026-05-14T21:38:00+00:00

I am trying to get the values for faultcode, faultstring, and OrderNumber from the

  • 0

I am trying to get the values for faultcode, faultstring, and OrderNumber from the SOAP below

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP:Body>
        <faultcode>1234</faultcode> 
        <faultstring>SaveOrder:SetrsOrderMain:Cannot change OrderDate if GLPeriod is closed, new OrderDate is 3/2/2010:Ln:1053</faultstring>               
        <detail>
           <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
           <SOAP:Body UserGUID="test">
           <m:SaveOrder xmlns:m="http://www.test.com/software/schema/" UserGUID="test">
                <Order OrderNumber="1234-1234-123" Caller="" OrderStatus="A" xmlns="http://www.test.com/software/schema/">

Here is my code in C#

XDocument doc = XDocument.Load(HttpContext.Current.Server.MapPath("XMLexample.xml"));

var errorDetail = new EcourierErrorDetail
{
   FaultCode = from fc in doc.Descendants("faultcode")
               select fc.Value,
   FaultString = from fs in c.Descendants("faultstring")
                 select fs.Value,
   OrderNumber = from o in    
                 doc.Descendants("detail").Elements("Order").Attributes("OrderNumber")
                 select o.Value
};
return errorDetail;

I am able to get the values for both faultcode and faultstring but not the OrderNumber. I am getting “Enumeration yielded no results.” Can anyone help? Thanks.

  • 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-05-14T21:38:00+00:00Added an answer on May 14, 2026 at 9:38 pm

    Yes, you’re ignoring the XML namespace when selecting:

    <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
       .....
       <m:SaveOrder xmlns:m="http://www.test.com/software/schema/" UserGUID="test">
         <Order OrderNumber="1234-1234-123" Caller="" OrderStatus="A" xmlns="http://www.test.com/software/schema/">
    

    The <Order> tag is inside the <m:SaveOrder> tag which uses the XML namespace prefixed by the m: prefix.

    Also, you’re trying to select the “detail” and then you skip to the “Order” node directly (using .Elements()) – you missed the <m:SaveOrder> node in between.

    You need to take that into account when selecting:

    XDocument doc = XDocument.Load(HttpContext.Current.Server.MapPath("XMLexample.xml"));
    
    XNamespace xmlns = "http://www.test.com/software/schema/";
    
    var orderNode = doc.Descendants(xmlns + "SaveOrder").Elements(xmlns + "Order");
    
    var value = from o in orderNode.Attributes("OrderNumber")
                select o.Value;
    

    Does that give you a result??

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

Sidebar

Related Questions

I'm trying get values from a GridView using the following code: foreach (GridViewRow row
I'm trying to get all property names / values from an Outlook item. I
Trying to get this example working from http://www.munna.shatkotha.com/blog/post/2008/10/26/Light-box-effect-with-WPF.aspx However, I can't seem to get
I'm trying to get values from xml, and I have problem with empty value.
I'm trying to get some aggregate values from different tables, but my problem is
Here's an ASPX code snippet from when I was trying to get multiple values
I'm trying to get a query working that takes the values (sometimes just the
I am trying to get key-value-observing to work for an NSMutableArray. Below is the
im trying to get the values of all the checked checkboxes and post those
I'm trying to get the values of dynamically generated FileUpload controls that I add

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.