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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:50:00+00:00 2026-05-26T18:50:00+00:00

How do I read the error_code from this SOAP reply Envelope? My PHP version

  • 0

How do I read the error_code from this SOAP reply Envelope? My PHP version is: 5.2.0.

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
 <soap:Body>
  <Response xmlns="http://xxx.gateway.xxx.abcd.com">
   <return>
      <transaction_id>1234567</transaction_id>
      <error_code>109</error_code>    
   </return>
  </Response>
 </soap:Body>
</soap:Envelope>

I just need to read the value of error_code tag.here the value is :109

I am using nusoap. I used the below code but not working properly:

$response=htmlspecialchars($client->response, ENT_QUOTES);
$xml = simplexml_load_string($response); 
$ns = $xml->getNamespaces(true); 
$soap = $xml->children($ns['soap']); 
$error_code = $soap->body->children($ns['error_code']);
  • 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-26T18:50:00+00:00Added an answer on May 26, 2026 at 6:50 pm
    <?php 
    
    $string = <<<XML
    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
     <soap:Body>
      <Response xmlns="http://xxx.gateway.xxx.abcd.com">
       <return>
          <transaction_id>1234567</transaction_id>
          <error_code>109</error_code>    
       </return>
      </Response>
     </soap:Body>
    </soap:Envelope>
    XML;
    
    $xml = new SimpleXMLElement($string); 
    $xml->registerXPathNamespace("soap", "http://www.w3.org/2003/05/soap-envelope");
    $body = $xml->xpath("//soap:Body");
    $error_code = (string)$body[0]->Response->return->error_code;
    print_r($error_code); 
    ?> 
    

    OR

     $xml = simplexml_load_string($string); 
     $error_code = (string)$xml->children('soap', true)
                                ->Body
                                ->children()
                                ->Response
                                ->return
                                ->error_code;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need to read from json like this: {error_message:Only post requests are allowed,reservations:null,error_code:1} and
I got this from a Soap client request: Exception: SoapFault exception: [soap:Client] Server was
I’m trying to read the HTTP response code from a remote server but am
I read this code from my book: class B extends A {...} class G<E>
I've tried this code from David Walsh Blog : <?php /* connect to gmail
I have just compiled this code: http://www.win32developer.com/tutorial/winsock/winsock_tutorial_2.shtm I have added some codes so it
There's example HTTP Client at http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/example/http/client/async_client.cpp Please help me to change maximum buffer size
I have the following code: $body = <SOAP-ENV:Envelope>.$data.</SOAP-ENV:Envelope>; $ch = curl_init($FD_Add); curl_setopt($ch, CURLOPT_POST, 1);
I want to read and save some data from this rss feed to in
Puppy meta data gets read in from config file using (General::Config) and creates this

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.