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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:10:15+00:00 2026-06-11T23:10:15+00:00

I’m taking my response from a Soap Request, and passing it into a new

  • 0

I’m taking my response from a Soap Request, and passing it into a new SimpleXML construct.

$response = $this->client->$method(array("Request" => $this->params));
$response_string = $this->client->__getLastResponse();
$this->response = new Classes_Result(new SimpleXMLElement($result));

If I echo the $response_string, it outputs a proper xml string. Here is a snippet as it’s quite long.

<?xml version="1.0" encoding="utf-8"?>
<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><GetClassesResponse xmlns="http://clients.mindbodyonline.com/api/0_5">      
    <GetClassesResult>
     <Status>Success</Status>
     <XMLDetail>Full</XMLDetail>
     <ResultCount>6</ResultCount>
     <CurrentPageIndex>0</CurrentPageIndex>
     <TotalPageCount>1</TotalPageCount>
     <Classes>
      <Class>
       <ClassScheduleID>4</ClassScheduleID>
       <Location>
        <SiteID>20853</SiteID>
  ....</soap:Envelope>

Hoever, when I try to work with this object, I get errors or if I dump the object it outputs:

object(SimpleXMLElement)#51 (0)

Any ideas why this might be happening?

  • 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-11T23:10:16+00:00Added an answer on June 11, 2026 at 11:10 pm

    You are not actually using $response_string, and you have not set $result anywhere, which you have passed to new SimpleXMLElement($result).

    Perhaps you intend to build a SimpleXML object with the $response_string string via simplexml_load_string()?

    $response = $this->client->$method(array("Request" => $this->params));
    $response_string = $this->client->__getLastResponse();
    // Load XML via simplexml_load_string()
    $this->response = new Classes_Result(simplexml_load_string($response_string));
    
    // Or if you do expect a SimpleXMLElement(), pass in the string
    $this->response = new Classes_Result(new SimpleXMLElement($response_string));
    

    The <soap:Body> element of your SOAP response is namespaced with (soap). To loop over it with SimpleXML, you must provide the correct namespace:

    // After creating new SimpleXMLElement()
    var_dump($this->response->children("http://schemas.xmlsoap.org/soap/envelope/"));
    
    // class SimpleXMLElement#2 (1) {
    //   public $Body =>
    //   class SimpleXMLElement#4 (0) {
    //  }
    // }
    

    To loop over the body:

    foreach ($this->response->children("http://schemas.xmlsoap.org/soap/envelope/") as $b) {
      $body_nodes = $b->children();
      // Get somethign specific
      foreach ($body_nodes->GetClassesResponse->GetClassesResult as $bn) {
        echo $bn->ResultCount . ", ";
        echo $bn->TotalPageCount;
      }
    }
    // 6, 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a view passing on information from a database: def serve_article(request, id): served_article
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I want to show the soap response to UIWebview.. my soap response is, <p><img
Does anyone know how can I replace this 2 symbol below from the string
I am currently running into a problem where an element is coming back from
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.