I’m trying to send SOAP request using PHP injection a variable as parameter in xml ,my variable called $response1 and I’m inject on token part but always i get that the token is empty and I’m sure is not what i missed ?
$requestXML2 = <<<XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:agen="http://www.nortel.com/soa/oi/cct/types/AgentService" xmlns:typ="http://www.nortel.com/soa/oi/cct/types">
<soapenv:Header/>
<soapenv:Body>
<agen:SetStaticVoiceTerminalRequest>
<agen:ssoToken>
<!--Optional:-->
<typ:token>{$response1}</typ:token>
</agen:ssoToken>
<agen:agent>
<typ:agentLoginId>{$user_agentLoginId}</typ:agentLoginId>
<typ:userName>?</typ:userName>
<typ:agentType>?</typ:agentType>
</agen:agent>
<agen:terminal>
<typ:terminalName>{$user_terminalName}</typ:terminalName>
<typ:terminalType>AGENT</typ:terminalType>
<typ:provider>
<typ:providerName>Passive</typ:providerName>
</typ:provider>
<!--Optional:-->
<typ:status>?</typ:status>
</agen:terminal>
</agen:SetStaticVoiceTerminalRequest>
</soapenv:Body>
</soapenv:Envelope>
XML;
// SOAP service URL for the second service
$serviceURL2 = "http://10.16.9.10:9080/SOAOICCT/services/AgentService";
// Define SOAP headers for the second service
$headers2 = [
'Content-Type: text/xml',
'SOAPAction: ""'
];
// Initialize the SOAP client for the second service
$client2 = new SoapClient(null, array(
'location' => $serviceURL2,
'uri' => "http://tempuri.org/",
'trace' => 1,
'stream_context' => stream_context_create(array(
'http' => array(
'header' => $headers2,
'method' => 'POST',
'content' => $requestXML2,
),
)),
));
try {
// Call the SOAP method for the second service
$response2 = $client2->__doRequest($requestXML2, $serviceURL2, '', SOAP_1_1);
// echo 'Response2 is : ' . $response2 . "nn";
// Print the SOAP response for the second service
// echo "Response from second service:n";
echo $response2;
} catch (SoapFault $e) {
// Handle SOAP errors
echo "Error: " . $e->getMessage();
}`
I have the token but he can take it from the variable ::