We help IT Professionals succeed at work.
Get Started

soapclient result all in one object

columbusace
columbusace asked
on
634 Views
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

Robert!


$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' => '' ));
print_r($result);

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:complexType>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="Table">
            <xs:complexType>
              <xs:sequence>
                <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" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  <Table>
    <Code>7</Code>
    <Start_x0020_Date>2011-01-01T00:00:00+01:00</Start_x0020_Date>
    <End_x0020_Date>2013-01-01T00:00:00+01:00</End_x0020_Date>
    <Company>MySolution FLEX</Company>
    <Responsibility_x0020_Center>UTRECHT</Responsibility_x0020_Center>
    <Request_x0020_No_>U-A00033</Request_x0020_No_>
    <Description>Recruiter MySolution Nieuw</Description>
    <Function>Demonstratieteam</Function>
    <Co-Worker />
    <City>Amsterdam</City>
    <Territory>West-Nederland</Territory>
    <Country>Nederland</Country>
    <Characteristic>Gewenste functie</Characteristic>
    <Char_Value />
    <Char__x0020_Entry_x0020_No_>0</Char__x0020_Entry_x0020_No_>
  </Table>
  <Table>
    <Code>36</Code>
    <Start_x0020_Date>2011-01-01T00:00:00+01:00</Start_x0020_Date>
    <End_x0020_Date>2011-12-30T00:00:00+01:00</End_x0020_Date>
    <Company>MySolution FLEX</Company>
    <Responsibility_x0020_Center>UTRECHT</Responsibility_x0020_Center>
    <Request_x0020_No_>U-Z00011</Request_x0020_No_>
    <Description>Petrochemie</Description>
    <Function />
    <Co-Worker>Arno de Haan</Co-Worker>
    <City>Nieuwegein</City>
    <Territory />
    <Country>Nederland</Country>
    <Characteristic>Gewenste functie</Characteristic>
    <Char_Value />
    <Char__x0020_Entry_x0020_No_>0</Char__x0020_Entry_x0020_No_>
  </Table>
  <Table>
    <Code>35</Code>
    <Start_x0020_Date>2011-07-10T00:00:00+02:00</Start_x0020_Date>
    <End_x0020_Date>2011-12-10T00:00:00+01:00</End_x0020_Date>
    <Company>MySolution FLEX</Company>
    <Responsibility_x0020_Center>UTRECHT</Responsibility_x0020_Center>
    <Request_x0020_No_>U-A00011</Request_x0020_No_>
    <Description>Monteur speciaal werk GTI</Description>
    <Function>Monteur</Function>
    <Co-Worker>Arno de Haan</Co-Worker>
    <City>Schiedam</City>
    <Territory />
    <Country>Nederland</Country>
    <Characteristic>Gewenste functie</Characteristic>
    <Char_Value />
    <Char__x0020_Entry_x0020_No_>0</Char__x0020_Entry_x0020_No_>
  </Table>
</NewDataSet>
)

Open in new window

Comment
Watch Question
Most Valuable Expert 2011
Author of the Year 2014
Commented:
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