Skip to content
Advertisement

How to parametrize a PHP Soap call – Taleo

I need to get the entities list from Taleo WS. I got a working soap xml example but I don’t know how to parametrize the php soap call. Can anyone give me a hint?

The request is the following

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:find="http://www.taleo.com/ws/tee800/2009/01/find">
   <soapenv:Header/>
   <soapenv:Body>
      <find:findPartialEntities>
         <find:mappingVersion>http://www.taleo.com/ws/tee800/2009/01</find:mappingVersion>
         <find:query>
            <query:query alias="Find Open and Posted Requisitions" projectedClass="SourcingRequest" xmlns:query="http://itk.taleo.com/ws/query">
               <query:projections>
                  <query:projection>
                     <query:field  path="Requisition,ContestNumber"/>
                  </query:projection>
                  <query:projection>
                    <query:field locales="it" path="Requisition,JobInformation,Title" localeFiltering="customLocales"/>
                  </query:projection>
                  <query:projection>
                     <query:field locales = "it" path="Requisition,JobInformation,DescriptionExternalHTML" localeFiltering="customLocales"/>
                  </query:projection>
                   <query:projection>
                     <query:field locales = "it" path="Requisition,JobInformation,DescriptionInternalHTML" localeFiltering="customLocales"/>
                  </query:projection>
                  <query:projection>
                     <query:field path="Requisition,Number"/>
                  </query:projection>
                  <query:projection>
                     <query:field path="Requisition,State,Description"/>
                  </query:projection>
                  <query:projection>
                     <query:field locales="it" path="Requisition,JobInformation,JobField,Name" localeFiltering="customLocales"/>
                  </query:projection>
                  <query:projection>
                     <query:field locales="it" path="Requisition,JobInformation,Organization,Name" localeFiltering="customLocales"/>
                  </query:projection>
                  <query:projection>
                     <query:field locales="it" path="Requisition,JobInformation,Location,PrimaryLocation,Name" localeFiltering="customLocales"/>
                  </query:projection>
                  <query:projection>
                     <query:field locales="it" path="SourcingRequestStatus,Description" localeFiltering="customLocales"/>
                  </query:projection>
               </query:projections>
               <query:filterings>
                  <query:filtering>
                     <query:equal>
                        <query:field locales="it" path="SourcingRequestStatus,Description" localeFiltering="customLocales"/>
                        <query:string>Pubblicata</query:string>
                     </query:equal>
                  </query:filtering>
               </query:filterings>
               <query:sortings>
                  <query:sorting>
                     <query:field path="Requisition,ContestNumber"/>
                  </query:sorting>
               </query:sortings>
            </query:query>
         </find:query>
         <find:attributes/>
      </find:findPartialEntities>
   </soapenv:Body>
</soapenv:Envelope>

So far I produced this code

$wsdlUrl = 'https://s01iit.taleo.net/enterprise/soap?ServiceName=FindService&wsdl';

$options = array(
  'login' => 'myUsername',
  'password' => 'myPassword'
);
        
        
try {
    $client = new SoapClient($wsdlUrl, $options);
    
    $params = array(
                    "mappingVersion"=>"http://www.taleo.com/ws/tee800/2009/01",
                    "query" => "",
                    "attributes" => ""
                    );	
       
		$result = $client->findPartialEntities($params);
		
    die(var_dump($result));

I get a “Not enough message parts were received for the operation.” error as a response.

Thanks

Advertisement

Answer

Its little bit tricky since taleo soap documentation is poor. I spend few days investigating it and still have a lot to do. Here is one basic example that can help:

$query = [
  'query' => [
    'projectedClass' => "Requisition",
    'alias' => "Find Open and Posted Requisitions a",
    'subQueries' => '',
    'projections' => [
      'projection' => [
        'field' => [
          'path' => 'JobInformation,Title'
        ]
      ]
    ]

  ]
];

$attributes = [
  "entry" => [
    ['key' => 'pageindex', 'value' => '1'],
    ['key' => 'pagingsize', 'value' => '10']
  ]
];


try {
  $client = new SoapClient($findServiceWSDL, $options);
  $arguments = array('mappingVersion' => 'http://www.taleo.com/ws/art750/2006/12', 'query' => $query, 'attributes' => $attributes);
} catch (Exception $e) {

  echo $e->getMessage();
  echo '<br>';
  echo $e->getTraceAsString();
  echo htmlentities($client->__getLastRequest());
  echo '<br><br><br>';
  echo htmlentities($client->__getLastResponse());
}

I hope this will help you.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement