We help IT Professionals succeed at work.
Get Started

soapclient result all in one object

columbusace asked
Last Modified: 2012-05-12
I just recently began accessing webservices (wsdl) through php and soap.

in the first code snipped you can see how I make a new soapclient and acces the GetJobOpenings service in order  to get all the jobopenings from the company named 'MySolution FLEX' and where the country is 'Nederland'

the result from the print_r is the following:

stdClass Object ( [GetJobOpeningsResult] => 7 2011-01-01T00:00:00+01:00 2013-01-01T00:00:00+01:00 MySolution FLEX UTRECHT U-A00033 Recruiter MySolution Nieuw Demonstratieteam Amsterdam West-Nederland Nederland Gewenste functie 0  36 2011-01-01T00:00:00+01:00 2011-12-30T00:00:00+01:00 MySolution FLEX UTRECHT U-Z00011 Petrochemie Arno de Haan Nieuwegein Nederland Gewenste functie 0  35 2011-07-10T00:00:00+02:00 2011-12-10T00:00:00+01:00 MySolution FLEX UTRECHT U-A00011 Monteur speciaal werk GTI Monteur Arno de Haan Schiedam Nederland Gewenste functie 0  )

So it does as promised and returns the jobopenings I wanted. However they are al in one and t he same object, making looping through them impossible. same goes for accessing seperate data like eg the function or territory.

If I look at the source code in my browser it shows the structure shown in the second snippet. Where I do get the idea that the jobopenings are stored in different sections.

So, how can I get them in an array or ..... so that I can loop through them, and use their values ?

Thnx in advance


$client = new SoapClient("http://R01.ws.mysolutionflex.nl/JobOpeningservice.asmx?wsdl");
$result = $client->GetJobOpenings(array('features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'company' => 'MySolution FLEX', 'responsibilitycenter' => '', 'function' => '', 'city' => '', 'territory' => '', 'country' => 'Nederland', 'keyword' => '' ));

Open in new window

stdClass Object
    [GetJobOpeningsResult] => <NewDataSet>
  <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="Table">
                <xs:element name="Code" type="xs:int" minOccurs="0" />
                <xs:element name="Start_x0020_Date" type="xs:dateTime" minOccurs="0" />
                <xs:element name="End_x0020_Date" type="xs:dateTime" minOccurs="0" />
                <xs:element name="Company" type="xs:string" minOccurs="0" />
                <xs:element name="Responsibility_x0020_Center" type="xs:string" minOccurs="0" />
                <xs:element name="Request_x0020_No_" type="xs:string" minOccurs="0" />
                <xs:element name="Description" type="xs:string" minOccurs="0" />
                <xs:element name="Function" type="xs:string" minOccurs="0" />
                <xs:element name="Co-Worker" type="xs:string" minOccurs="0" />
                <xs:element name="City" type="xs:string" minOccurs="0" />
                <xs:element name="Territory" type="xs:string" minOccurs="0" />
                <xs:element name="Country" type="xs:string" minOccurs="0" />
                <xs:element name="Characteristic" type="xs:string" minOccurs="0" />
                <xs:element name="Char_Value" type="xs:string" minOccurs="0" />
                <xs:element name="Char__x0020_Entry_x0020_No_" type="xs:int" minOccurs="0" />
    <Company>MySolution FLEX</Company>
    <Description>Recruiter MySolution Nieuw</Description>
    <Co-Worker />
    <Characteristic>Gewenste functie</Characteristic>
    <Char_Value />
    <Company>MySolution FLEX</Company>
    <Function />
    <Co-Worker>Arno de Haan</Co-Worker>
    <Territory />
    <Characteristic>Gewenste functie</Characteristic>
    <Char_Value />
    <Company>MySolution FLEX</Company>
    <Description>Monteur speciaal werk GTI</Description>
    <Co-Worker>Arno de Haan</Co-Worker>
    <Territory />
    <Characteristic>Gewenste functie</Characteristic>
    <Char_Value />

Open in new window

Watch Question
Most Valuable Expert 2011
Author of the Year 2014
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE