Taleo SOAP request not returning any data in PHP
I am trying to build a script to download open job roles from Taleo. I have this working in SOAP UI. I send my request and the response has all the data I requested in it.
Request:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find"
xmlns:ns2="http://itk.taleo.com/ws/query">
<SOAP-ENV:Body>
<ns1:findPartialEntities>
<ns1:mappingVersion>http://www.taleo.com/ws/art750/2006/12</ns1:mappingVersion>
<ns1:query>
<ns2:query projectedClass="Requisition" alias="Find Open and Posted Requisitions">
<ns2:subQueries/>
<ns2:projections>
<ns2:projection alias="Ref">
<ns2:field path="Requisition,ContestNumber"/>
</ns2:projection>
</ns2:projections>
</ns2:query>
</ns1:query>
<ns1:attributes>
<ns1:entry>
<ns1:key>pageindex</ns1:key>
<ns1:value>1</ns1:value>
</ns1:entry>
<ns1:entry>
<ns1:key>pagingsize</ns1:key>
<ns1:value>2</ns1:value>
</ns1:entry>
</ns1:attributes>
</ns1:findPartialEntities>
</SOAP-ENV:Body>
Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<ns1:findPartialEntitiesResponse xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find">
<root:Entities pageIndex="1" pageCount="585" pagingSize="2" entityCount="1169" xmlns:root="http://www.taleo.com/ws/tee800/2009/01/find" xmlns:e="http://www.taleo.com/ws/art750/2006/12" xmlns="http://www.taleo.com/ws/integration/toolkit/2005/07">
<e:Entity xsi:type="e:Requisition"/>
<e:Entity xsi:type="e:Requisition">
<e:ContestNumber>1500000L</e:ContestNumber>
</e:Entity>
</root:Entities>
</ns1:findPartialEntitiesResponse>
</soap:Body>
</soap:Envelope>
So I have tried to translate this to a PHP script. I can see the job roles in the response however they are empty objects. I am not sure how to access the data. Here is my script.
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('soap.wsdl_cache_enabled', 0);
ini_set('soap.wsdl_cache_ttl', 900);
ini_set('default_socket_timeout', 15);
ini_set('use_soap_error_handler', true);
error_reporting(E_ALL);
date_default_timezone_set('UCT');
class taleo_test{
private $url = 'https://URL&wsdl';
private $username = '******';
private $password = '********';
public function __construct(){
}
public function connect(){
$options = array(
'login' => $this->username,
'password' => $this->password,
'trace' => 1,
'cache_wsdl' => WSDL_CACHE_NONE,
'soap_version'=>SOAP_1_1
);
$query = [
'query' => [
'projectedClass' => "Requisition",
'alias' => "Find Open and Posted Requisitions",
'subQueries' => '',
'projections' => [
'projection' => [
'alias' => "Ref",
'field' => [
'path' => 'Requisition,ContestNumber'
]
]
]
]
];
$attributes = [
"entry" => [
['key' => 'pageindex', 'value' => '1'],
['key' => 'pagingsize', 'value' => '5']
]
];
try {
$client = new SoapClient($this->url, $options);
$arguments = array(
'mappingVersion' => 'http://www.taleo.com/ws/art750/2006/12',
'query' => $query,
'attributes' => $attributes
);
$results = $client->__soapCall("findPartialEntities", array($arguments));
echo "REQUEST:n" . $client->__getLastRequest() . "nn";
echo "RESPONSE:n" . $client->__getLastResponse() . "nn";
var_dump($results);
} catch (Exception $e) {
echo '<pre>';
echo $e->getMessage();
echo '<hr>';
echo $e->getTraceAsString();
echo htmlentities($client->__getLastRequest());
echo '<br>@@<hr><br>';
echo htmlentities($client->__getLastResponse());
echo '</pre>';
}
}
}
$taleo = new taleo_test;
$data = $taleo->connect();
The echo of $client->__getLastResponse() shows me the data that PHP will not show me.
Here is the PHP files result:
<hr>REQUEST:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find" xmlns:ns2="http://itk.taleo.com/ws/query"><SOAP-ENV:Body> <ns1:findPartialEntities><ns1:mappingVersion>http://www.taleo.com/ws/art750/2006/12</ns1:mappingVersion><ns1:query><ns2:query projectedClass="Requisition" alias="Find Open and Posted Requisitions"><ns2:subQueries/><ns2:projections><ns2:projection alias="Ref"><ns2:field path="Requisition,ContestNumber"/></ns2:projection></ns2:projections></ns2:query></ns1:query><ns1:attributes><ns1:entry><ns1:key>pageindex</ns1:key><ns1:value>1</ns1:value></ns1:entry><ns1:entry><ns1:key>pagingsize</ns1:key><ns1:value>5</ns1:value></ns1:entry></ns1:attributes></ns1:findPartialEntities></SOAP-ENV:Body></SOAP-ENV:Envelope>
RESPONSE:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body> <ns1:findPartialEntitiesResponse xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find"><root:Entities xmlns:root="http://www.taleo.com/ws/tee800/2009/01/find" xmlns:e="http://www.taleo.com/ws/art750/2006/12" xmlns="http://www.taleo.com/ws/integration/toolkit/2005/07" pageIndex="1" pageCount="234" pagingSize="5" entityCount="1169"><e:Entity xsi:type="e:Requisition"/><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000L</e:ContestNumber></e:Entity><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000N</e:ContestNumber></e:Entity><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000M</e:ContestNumber></e:Entity><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000S</e:ContestNumber></e:Entity></root:Entities></ns1:findPartialEntitiesResponse></soap:Body></soap:Envelope>
object(stdClass)#3 (1) {
["Entities"]=>
object(stdClass)#4 (5) {
["Entity"]=>
array(5) {
[0]=>
object(stdClass)#5 (0) {
}
[1]=>
object(stdClass)#6 (0) {
}
[2]=>
object(stdClass)#7 (0) {
}
[3]=>
object(stdClass)#8 (0) {
}
[4]=>
object(stdClass)#9 (0) {
}
}
["pageIndex"]=>
string(1) "1"
["pageCount"]=>
string(3) "234"
["pagingSize"]=>
string(1) "5"
["entityCount"]=>
string(4) "1169"
}
}
I said read comments saying that it might be a namespace issue however not sure how to amend or if that's not the issue then how to get the data I need (without havent to resort to using the debugging SOAP response and parsing that into XML).
Any help would be greatly appreciated.
thanks
php soap soapui soap-client taleo
add a comment |
I am trying to build a script to download open job roles from Taleo. I have this working in SOAP UI. I send my request and the response has all the data I requested in it.
Request:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find"
xmlns:ns2="http://itk.taleo.com/ws/query">
<SOAP-ENV:Body>
<ns1:findPartialEntities>
<ns1:mappingVersion>http://www.taleo.com/ws/art750/2006/12</ns1:mappingVersion>
<ns1:query>
<ns2:query projectedClass="Requisition" alias="Find Open and Posted Requisitions">
<ns2:subQueries/>
<ns2:projections>
<ns2:projection alias="Ref">
<ns2:field path="Requisition,ContestNumber"/>
</ns2:projection>
</ns2:projections>
</ns2:query>
</ns1:query>
<ns1:attributes>
<ns1:entry>
<ns1:key>pageindex</ns1:key>
<ns1:value>1</ns1:value>
</ns1:entry>
<ns1:entry>
<ns1:key>pagingsize</ns1:key>
<ns1:value>2</ns1:value>
</ns1:entry>
</ns1:attributes>
</ns1:findPartialEntities>
</SOAP-ENV:Body>
Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<ns1:findPartialEntitiesResponse xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find">
<root:Entities pageIndex="1" pageCount="585" pagingSize="2" entityCount="1169" xmlns:root="http://www.taleo.com/ws/tee800/2009/01/find" xmlns:e="http://www.taleo.com/ws/art750/2006/12" xmlns="http://www.taleo.com/ws/integration/toolkit/2005/07">
<e:Entity xsi:type="e:Requisition"/>
<e:Entity xsi:type="e:Requisition">
<e:ContestNumber>1500000L</e:ContestNumber>
</e:Entity>
</root:Entities>
</ns1:findPartialEntitiesResponse>
</soap:Body>
</soap:Envelope>
So I have tried to translate this to a PHP script. I can see the job roles in the response however they are empty objects. I am not sure how to access the data. Here is my script.
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('soap.wsdl_cache_enabled', 0);
ini_set('soap.wsdl_cache_ttl', 900);
ini_set('default_socket_timeout', 15);
ini_set('use_soap_error_handler', true);
error_reporting(E_ALL);
date_default_timezone_set('UCT');
class taleo_test{
private $url = 'https://URL&wsdl';
private $username = '******';
private $password = '********';
public function __construct(){
}
public function connect(){
$options = array(
'login' => $this->username,
'password' => $this->password,
'trace' => 1,
'cache_wsdl' => WSDL_CACHE_NONE,
'soap_version'=>SOAP_1_1
);
$query = [
'query' => [
'projectedClass' => "Requisition",
'alias' => "Find Open and Posted Requisitions",
'subQueries' => '',
'projections' => [
'projection' => [
'alias' => "Ref",
'field' => [
'path' => 'Requisition,ContestNumber'
]
]
]
]
];
$attributes = [
"entry" => [
['key' => 'pageindex', 'value' => '1'],
['key' => 'pagingsize', 'value' => '5']
]
];
try {
$client = new SoapClient($this->url, $options);
$arguments = array(
'mappingVersion' => 'http://www.taleo.com/ws/art750/2006/12',
'query' => $query,
'attributes' => $attributes
);
$results = $client->__soapCall("findPartialEntities", array($arguments));
echo "REQUEST:n" . $client->__getLastRequest() . "nn";
echo "RESPONSE:n" . $client->__getLastResponse() . "nn";
var_dump($results);
} catch (Exception $e) {
echo '<pre>';
echo $e->getMessage();
echo '<hr>';
echo $e->getTraceAsString();
echo htmlentities($client->__getLastRequest());
echo '<br>@@<hr><br>';
echo htmlentities($client->__getLastResponse());
echo '</pre>';
}
}
}
$taleo = new taleo_test;
$data = $taleo->connect();
The echo of $client->__getLastResponse() shows me the data that PHP will not show me.
Here is the PHP files result:
<hr>REQUEST:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find" xmlns:ns2="http://itk.taleo.com/ws/query"><SOAP-ENV:Body> <ns1:findPartialEntities><ns1:mappingVersion>http://www.taleo.com/ws/art750/2006/12</ns1:mappingVersion><ns1:query><ns2:query projectedClass="Requisition" alias="Find Open and Posted Requisitions"><ns2:subQueries/><ns2:projections><ns2:projection alias="Ref"><ns2:field path="Requisition,ContestNumber"/></ns2:projection></ns2:projections></ns2:query></ns1:query><ns1:attributes><ns1:entry><ns1:key>pageindex</ns1:key><ns1:value>1</ns1:value></ns1:entry><ns1:entry><ns1:key>pagingsize</ns1:key><ns1:value>5</ns1:value></ns1:entry></ns1:attributes></ns1:findPartialEntities></SOAP-ENV:Body></SOAP-ENV:Envelope>
RESPONSE:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body> <ns1:findPartialEntitiesResponse xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find"><root:Entities xmlns:root="http://www.taleo.com/ws/tee800/2009/01/find" xmlns:e="http://www.taleo.com/ws/art750/2006/12" xmlns="http://www.taleo.com/ws/integration/toolkit/2005/07" pageIndex="1" pageCount="234" pagingSize="5" entityCount="1169"><e:Entity xsi:type="e:Requisition"/><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000L</e:ContestNumber></e:Entity><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000N</e:ContestNumber></e:Entity><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000M</e:ContestNumber></e:Entity><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000S</e:ContestNumber></e:Entity></root:Entities></ns1:findPartialEntitiesResponse></soap:Body></soap:Envelope>
object(stdClass)#3 (1) {
["Entities"]=>
object(stdClass)#4 (5) {
["Entity"]=>
array(5) {
[0]=>
object(stdClass)#5 (0) {
}
[1]=>
object(stdClass)#6 (0) {
}
[2]=>
object(stdClass)#7 (0) {
}
[3]=>
object(stdClass)#8 (0) {
}
[4]=>
object(stdClass)#9 (0) {
}
}
["pageIndex"]=>
string(1) "1"
["pageCount"]=>
string(3) "234"
["pagingSize"]=>
string(1) "5"
["entityCount"]=>
string(4) "1169"
}
}
I said read comments saying that it might be a namespace issue however not sure how to amend or if that's not the issue then how to get the data I need (without havent to resort to using the debugging SOAP response and parsing that into XML).
Any help would be greatly appreciated.
thanks
php soap soapui soap-client taleo
For anyone that comes across the same issue... I gave up. switched the php to a CURL request, converted the query to XML and it works fine.
– Pedge
Dec 5 '18 at 9:50
add a comment |
I am trying to build a script to download open job roles from Taleo. I have this working in SOAP UI. I send my request and the response has all the data I requested in it.
Request:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find"
xmlns:ns2="http://itk.taleo.com/ws/query">
<SOAP-ENV:Body>
<ns1:findPartialEntities>
<ns1:mappingVersion>http://www.taleo.com/ws/art750/2006/12</ns1:mappingVersion>
<ns1:query>
<ns2:query projectedClass="Requisition" alias="Find Open and Posted Requisitions">
<ns2:subQueries/>
<ns2:projections>
<ns2:projection alias="Ref">
<ns2:field path="Requisition,ContestNumber"/>
</ns2:projection>
</ns2:projections>
</ns2:query>
</ns1:query>
<ns1:attributes>
<ns1:entry>
<ns1:key>pageindex</ns1:key>
<ns1:value>1</ns1:value>
</ns1:entry>
<ns1:entry>
<ns1:key>pagingsize</ns1:key>
<ns1:value>2</ns1:value>
</ns1:entry>
</ns1:attributes>
</ns1:findPartialEntities>
</SOAP-ENV:Body>
Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<ns1:findPartialEntitiesResponse xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find">
<root:Entities pageIndex="1" pageCount="585" pagingSize="2" entityCount="1169" xmlns:root="http://www.taleo.com/ws/tee800/2009/01/find" xmlns:e="http://www.taleo.com/ws/art750/2006/12" xmlns="http://www.taleo.com/ws/integration/toolkit/2005/07">
<e:Entity xsi:type="e:Requisition"/>
<e:Entity xsi:type="e:Requisition">
<e:ContestNumber>1500000L</e:ContestNumber>
</e:Entity>
</root:Entities>
</ns1:findPartialEntitiesResponse>
</soap:Body>
</soap:Envelope>
So I have tried to translate this to a PHP script. I can see the job roles in the response however they are empty objects. I am not sure how to access the data. Here is my script.
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('soap.wsdl_cache_enabled', 0);
ini_set('soap.wsdl_cache_ttl', 900);
ini_set('default_socket_timeout', 15);
ini_set('use_soap_error_handler', true);
error_reporting(E_ALL);
date_default_timezone_set('UCT');
class taleo_test{
private $url = 'https://URL&wsdl';
private $username = '******';
private $password = '********';
public function __construct(){
}
public function connect(){
$options = array(
'login' => $this->username,
'password' => $this->password,
'trace' => 1,
'cache_wsdl' => WSDL_CACHE_NONE,
'soap_version'=>SOAP_1_1
);
$query = [
'query' => [
'projectedClass' => "Requisition",
'alias' => "Find Open and Posted Requisitions",
'subQueries' => '',
'projections' => [
'projection' => [
'alias' => "Ref",
'field' => [
'path' => 'Requisition,ContestNumber'
]
]
]
]
];
$attributes = [
"entry" => [
['key' => 'pageindex', 'value' => '1'],
['key' => 'pagingsize', 'value' => '5']
]
];
try {
$client = new SoapClient($this->url, $options);
$arguments = array(
'mappingVersion' => 'http://www.taleo.com/ws/art750/2006/12',
'query' => $query,
'attributes' => $attributes
);
$results = $client->__soapCall("findPartialEntities", array($arguments));
echo "REQUEST:n" . $client->__getLastRequest() . "nn";
echo "RESPONSE:n" . $client->__getLastResponse() . "nn";
var_dump($results);
} catch (Exception $e) {
echo '<pre>';
echo $e->getMessage();
echo '<hr>';
echo $e->getTraceAsString();
echo htmlentities($client->__getLastRequest());
echo '<br>@@<hr><br>';
echo htmlentities($client->__getLastResponse());
echo '</pre>';
}
}
}
$taleo = new taleo_test;
$data = $taleo->connect();
The echo of $client->__getLastResponse() shows me the data that PHP will not show me.
Here is the PHP files result:
<hr>REQUEST:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find" xmlns:ns2="http://itk.taleo.com/ws/query"><SOAP-ENV:Body> <ns1:findPartialEntities><ns1:mappingVersion>http://www.taleo.com/ws/art750/2006/12</ns1:mappingVersion><ns1:query><ns2:query projectedClass="Requisition" alias="Find Open and Posted Requisitions"><ns2:subQueries/><ns2:projections><ns2:projection alias="Ref"><ns2:field path="Requisition,ContestNumber"/></ns2:projection></ns2:projections></ns2:query></ns1:query><ns1:attributes><ns1:entry><ns1:key>pageindex</ns1:key><ns1:value>1</ns1:value></ns1:entry><ns1:entry><ns1:key>pagingsize</ns1:key><ns1:value>5</ns1:value></ns1:entry></ns1:attributes></ns1:findPartialEntities></SOAP-ENV:Body></SOAP-ENV:Envelope>
RESPONSE:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body> <ns1:findPartialEntitiesResponse xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find"><root:Entities xmlns:root="http://www.taleo.com/ws/tee800/2009/01/find" xmlns:e="http://www.taleo.com/ws/art750/2006/12" xmlns="http://www.taleo.com/ws/integration/toolkit/2005/07" pageIndex="1" pageCount="234" pagingSize="5" entityCount="1169"><e:Entity xsi:type="e:Requisition"/><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000L</e:ContestNumber></e:Entity><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000N</e:ContestNumber></e:Entity><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000M</e:ContestNumber></e:Entity><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000S</e:ContestNumber></e:Entity></root:Entities></ns1:findPartialEntitiesResponse></soap:Body></soap:Envelope>
object(stdClass)#3 (1) {
["Entities"]=>
object(stdClass)#4 (5) {
["Entity"]=>
array(5) {
[0]=>
object(stdClass)#5 (0) {
}
[1]=>
object(stdClass)#6 (0) {
}
[2]=>
object(stdClass)#7 (0) {
}
[3]=>
object(stdClass)#8 (0) {
}
[4]=>
object(stdClass)#9 (0) {
}
}
["pageIndex"]=>
string(1) "1"
["pageCount"]=>
string(3) "234"
["pagingSize"]=>
string(1) "5"
["entityCount"]=>
string(4) "1169"
}
}
I said read comments saying that it might be a namespace issue however not sure how to amend or if that's not the issue then how to get the data I need (without havent to resort to using the debugging SOAP response and parsing that into XML).
Any help would be greatly appreciated.
thanks
php soap soapui soap-client taleo
I am trying to build a script to download open job roles from Taleo. I have this working in SOAP UI. I send my request and the response has all the data I requested in it.
Request:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find"
xmlns:ns2="http://itk.taleo.com/ws/query">
<SOAP-ENV:Body>
<ns1:findPartialEntities>
<ns1:mappingVersion>http://www.taleo.com/ws/art750/2006/12</ns1:mappingVersion>
<ns1:query>
<ns2:query projectedClass="Requisition" alias="Find Open and Posted Requisitions">
<ns2:subQueries/>
<ns2:projections>
<ns2:projection alias="Ref">
<ns2:field path="Requisition,ContestNumber"/>
</ns2:projection>
</ns2:projections>
</ns2:query>
</ns1:query>
<ns1:attributes>
<ns1:entry>
<ns1:key>pageindex</ns1:key>
<ns1:value>1</ns1:value>
</ns1:entry>
<ns1:entry>
<ns1:key>pagingsize</ns1:key>
<ns1:value>2</ns1:value>
</ns1:entry>
</ns1:attributes>
</ns1:findPartialEntities>
</SOAP-ENV:Body>
Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<ns1:findPartialEntitiesResponse xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find">
<root:Entities pageIndex="1" pageCount="585" pagingSize="2" entityCount="1169" xmlns:root="http://www.taleo.com/ws/tee800/2009/01/find" xmlns:e="http://www.taleo.com/ws/art750/2006/12" xmlns="http://www.taleo.com/ws/integration/toolkit/2005/07">
<e:Entity xsi:type="e:Requisition"/>
<e:Entity xsi:type="e:Requisition">
<e:ContestNumber>1500000L</e:ContestNumber>
</e:Entity>
</root:Entities>
</ns1:findPartialEntitiesResponse>
</soap:Body>
</soap:Envelope>
So I have tried to translate this to a PHP script. I can see the job roles in the response however they are empty objects. I am not sure how to access the data. Here is my script.
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('soap.wsdl_cache_enabled', 0);
ini_set('soap.wsdl_cache_ttl', 900);
ini_set('default_socket_timeout', 15);
ini_set('use_soap_error_handler', true);
error_reporting(E_ALL);
date_default_timezone_set('UCT');
class taleo_test{
private $url = 'https://URL&wsdl';
private $username = '******';
private $password = '********';
public function __construct(){
}
public function connect(){
$options = array(
'login' => $this->username,
'password' => $this->password,
'trace' => 1,
'cache_wsdl' => WSDL_CACHE_NONE,
'soap_version'=>SOAP_1_1
);
$query = [
'query' => [
'projectedClass' => "Requisition",
'alias' => "Find Open and Posted Requisitions",
'subQueries' => '',
'projections' => [
'projection' => [
'alias' => "Ref",
'field' => [
'path' => 'Requisition,ContestNumber'
]
]
]
]
];
$attributes = [
"entry" => [
['key' => 'pageindex', 'value' => '1'],
['key' => 'pagingsize', 'value' => '5']
]
];
try {
$client = new SoapClient($this->url, $options);
$arguments = array(
'mappingVersion' => 'http://www.taleo.com/ws/art750/2006/12',
'query' => $query,
'attributes' => $attributes
);
$results = $client->__soapCall("findPartialEntities", array($arguments));
echo "REQUEST:n" . $client->__getLastRequest() . "nn";
echo "RESPONSE:n" . $client->__getLastResponse() . "nn";
var_dump($results);
} catch (Exception $e) {
echo '<pre>';
echo $e->getMessage();
echo '<hr>';
echo $e->getTraceAsString();
echo htmlentities($client->__getLastRequest());
echo '<br>@@<hr><br>';
echo htmlentities($client->__getLastResponse());
echo '</pre>';
}
}
}
$taleo = new taleo_test;
$data = $taleo->connect();
The echo of $client->__getLastResponse() shows me the data that PHP will not show me.
Here is the PHP files result:
<hr>REQUEST:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find" xmlns:ns2="http://itk.taleo.com/ws/query"><SOAP-ENV:Body> <ns1:findPartialEntities><ns1:mappingVersion>http://www.taleo.com/ws/art750/2006/12</ns1:mappingVersion><ns1:query><ns2:query projectedClass="Requisition" alias="Find Open and Posted Requisitions"><ns2:subQueries/><ns2:projections><ns2:projection alias="Ref"><ns2:field path="Requisition,ContestNumber"/></ns2:projection></ns2:projections></ns2:query></ns1:query><ns1:attributes><ns1:entry><ns1:key>pageindex</ns1:key><ns1:value>1</ns1:value></ns1:entry><ns1:entry><ns1:key>pagingsize</ns1:key><ns1:value>5</ns1:value></ns1:entry></ns1:attributes></ns1:findPartialEntities></SOAP-ENV:Body></SOAP-ENV:Envelope>
RESPONSE:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body> <ns1:findPartialEntitiesResponse xmlns:ns1="http://www.taleo.com/ws/tee800/2009/01/find"><root:Entities xmlns:root="http://www.taleo.com/ws/tee800/2009/01/find" xmlns:e="http://www.taleo.com/ws/art750/2006/12" xmlns="http://www.taleo.com/ws/integration/toolkit/2005/07" pageIndex="1" pageCount="234" pagingSize="5" entityCount="1169"><e:Entity xsi:type="e:Requisition"/><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000L</e:ContestNumber></e:Entity><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000N</e:ContestNumber></e:Entity><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000M</e:ContestNumber></e:Entity><e:Entity xsi:type="e:Requisition"><e:ContestNumber>1500000S</e:ContestNumber></e:Entity></root:Entities></ns1:findPartialEntitiesResponse></soap:Body></soap:Envelope>
object(stdClass)#3 (1) {
["Entities"]=>
object(stdClass)#4 (5) {
["Entity"]=>
array(5) {
[0]=>
object(stdClass)#5 (0) {
}
[1]=>
object(stdClass)#6 (0) {
}
[2]=>
object(stdClass)#7 (0) {
}
[3]=>
object(stdClass)#8 (0) {
}
[4]=>
object(stdClass)#9 (0) {
}
}
["pageIndex"]=>
string(1) "1"
["pageCount"]=>
string(3) "234"
["pagingSize"]=>
string(1) "5"
["entityCount"]=>
string(4) "1169"
}
}
I said read comments saying that it might be a namespace issue however not sure how to amend or if that's not the issue then how to get the data I need (without havent to resort to using the debugging SOAP response and parsing that into XML).
Any help would be greatly appreciated.
thanks
php soap soapui soap-client taleo
php soap soapui soap-client taleo
asked Nov 21 '18 at 17:07
PedgePedge
11
11
For anyone that comes across the same issue... I gave up. switched the php to a CURL request, converted the query to XML and it works fine.
– Pedge
Dec 5 '18 at 9:50
add a comment |
For anyone that comes across the same issue... I gave up. switched the php to a CURL request, converted the query to XML and it works fine.
– Pedge
Dec 5 '18 at 9:50
For anyone that comes across the same issue... I gave up. switched the php to a CURL request, converted the query to XML and it works fine.
– Pedge
Dec 5 '18 at 9:50
For anyone that comes across the same issue... I gave up. switched the php to a CURL request, converted the query to XML and it works fine.
– Pedge
Dec 5 '18 at 9:50
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53417244%2ftaleo-soap-request-not-returning-any-data-in-php%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53417244%2ftaleo-soap-request-not-returning-any-data-in-php%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
For anyone that comes across the same issue... I gave up. switched the php to a CURL request, converted the query to XML and it works fine.
– Pedge
Dec 5 '18 at 9:50