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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:47:49+00:00 2026-05-28T05:47:49+00:00

I was not able to find same problem, for that reason I decided to

  • 0

I was not able to find same problem, for that reason I decided to open new.
I’ve stuck with an issue below.
The target is to show xml attributes values on UI using soap message.
PHP code looks like:

$client = new SoapClient("https://domain.com/xml/listener.asmx?WSDL");
$results = $client->ProductDescription(array('Username' => "anyuser", 'Password' => "anypassword", 'code' => "1108324"));
print_r($results);

As a result i get following message

stdClass Object ( [ProductDescriptionResult] => stdClass Object ( [any] => Imagehttp://catalog2.elkogroup.com/pictures/prDesc/large/1108324_425_0_425NULL.jpgDescription<h1 class="tagline"><span style="font-size: small">Quality surround audio for music, movies and games</span></h1> <p>&nbsp;Sound Blaster 5.1 VX is the absolute choice for those looking for better quality audio solutions basic motherboard audio can not deliver.</p>Vendor Homepagehttp://en.europe.creative.com/products/productarchive.asp?category=1&subcategory=873&product=17510&nav=Description2CREATIVE 5.1 VX (SB1071) OEMAudio-InInput/Output connectors1Audio-OutInput/Output connectors1MicrophoneInput/Output connectors1Included AccessoriesQuick start Guide; User Guide (on CD); Installation CDUnit Brutto Volumecubm0.001555Unit Net Weightkg0.13Unit Gross Weightkg0.157 ) )

The xml I get from soap ui using same request has different structure

<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>
      <ProductDescriptionResponse xmlns="https://ecom.elko.lv/xml">
         <ProductDescriptionResult>
            <NewDataSet xmlns="">
               <Product>
                  <Criteria>Image</Criteria>
                  <Value>http://test/</Value>
               </Product>
               ...
               ...
            </NewDataSet>
        </ProductDescriptionResult>
      </ProductDescriptionResponse>
    </soap:Body>
</soap:Envelope>

I was trying to read Criteria and Value argument values using different approaches, for example

a)

foreach($Envelope->Body->ProductDescriptionResponse->ProductDescriptionResult->NewDataSet->Product as $p)
        {
            echo $p->Criteria."<br>";
            echo $p->Value."<br>";
        }

Error message was “Undefined variable: Envelope…”

b)

foreach ($results->xpath('//soap:Envelope[1]/soap:Body[1]/ProductDescriptionResponse[1]/ProductDescriptionResult[1]/NewDataSet[1]/Product/*') as $item) 
        { print_r($item);} 

Error message was Call to undefined method stdClass::xpath()

c)
Also tried to register namespace

$xml = simplexml_load_string($results);
$xml->registerXPathNamespace('envoy', 'https://ecom.elko.lv/xml');

…

But it says me that simplexml_load_string() expects parameter 1 to be string

etc…

Could you please help to figure out?

  • 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-28T05:47:49+00:00Added an answer on May 28, 2026 at 5:47 am

    Take it from the response element (ProductDescriptionResult), which is what the SOAPClient would give you:

    echo $results->ProductDescriptionResult->NewDataSet->Product[1]->Criteria;
    

    Keep in mind you don’t have XML here anymore, the SOAPClient converted it to a nice tree of objects for you already. It could be that at any point the above trail doesn’t exist (I just guessed it based on the XML), in that case, just do a var_dump from get_object_vars to see what’s in the current node. Oh, and don’t look at the HTML output in a browser, view the source, a lot of < and >s in your debug output can ‘hide’ content if you look at is as HTML.


    edit: this works here

    <?php
    class S extends SoapClient {
            function __doRequest(){
                    return  <<<XML
    <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>
          <ProductDescriptionResponse xmlns="https://ecom.elko.lv/xml">
             <ProductDescriptionResult>
                <NewDataSet xmlns="">
                   <Product>
                      <Criteria>Image1</Criteria>
                      <Value>http://test/1</Value>
                   </Product>
                   <Product>
                      <Criteria>Image2</Criteria>
                      <Value>http://test/2</Value>
                   </Product>
                </NewDataSet>
            </ProductDescriptionResult>
          </ProductDescriptionResponse>
        </soap:Body>
    </soap:Envelope>
    XML;
            }
    }
    $d = new S(null,array('uri' => 'localhost','location' => 'localhost'));
    $result = $d->somerequest();
    echo $result->NewDataSet->Product[0]->Criteria;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried rectifying the code below. But I am not able to find
I've got a pretty simple problem that has a solution I'm not able to
I am not able to find a way to set TransactionIsolation in ejb. Can
It is a simple question to which I am not able to find the
I am trying to create a customized UISearchBar. I am not able to find
Not being able to find the answer, and also not being able to do
I have not been able to find a way to cancel/terminate asynchronous read operation
I have not been able to find any definitive answers to this question: Can
I've not been able to find a whole lot on this anywhere. Let me
I've searched and not been able to find the right way of doing what

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.