Wie kan mij helpen? Ik ben bezig aan een integratie en moet daarvoor een SOAP request doen met een p12 certificaat erbij.
Het lukt me met Soapui, daar krijg ik respons maar het lukt me niet in PHP...
Voorbeelden van een werkend systeem is ook welkom.
Heb je al wat in PHP geprobeerd? En zo ja, waar loop je precies op vast?
Dit heb ik reeds geprobeerd (is simulatie-omgeving), maar heb dus geen idee hoe dit werkt en ik krijg een foutmelding terug: wst:RequestFailed
<?php
$soap_request = '<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header/>
<soap:Body>
<wst:RequestSecurityToken Context="abc" xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512">
<wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</wst:TokenType>
<wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</wst:RequestType>
<wst:Claims Dialect="http://schemas.xmlsoap.org/ws/2006/12/authorization/authclaims">
<auth:ClaimType Uri="urn:be:smals:expeditor:number" xmlns:auth="http://schemas.xmlsoap.org/ws/2006/12/authorization">
<auth:Value>XXXXXX</auth:Value>
</auth:ClaimType>
</wst:Claims>
</wst:RequestSecurityToken>
</soap:Body>
</soap:Envelope>';

$headers = array(
"Content-type: text/xml",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
"SOAPAction: https://services-sim.socialsecurity.be/SecurityTokenService/v1";,
"Content-length: ".strlen($soap_request),
);
$url = "https://services-sim.socialsecurity.be/SecurityTokenService/v1";
$ch = curl_init($url);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_CAINFO, __DIR__.'/cafile.pem');
curl_setopt($ch, CURLOPT_CAPATH, __DIR__.'/cafile.pem');

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $soap_request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_TIMEOUT,10);

$output = curl_exec($ch);

curl_close($ch);

var_dump($output);
echo("
RESPONSE FROM SERVER :
" .htmlspecialchars($output) . "
");
?>
Ik heb dit ooit (lang geleden) opgelost met de WSO2/WSF PHP oplossing. Dat was toen al een beetje klungelen (bugs oplossen in C code en opnieuw compileren ...), en zo te zien is er sindsdien niet heel veel meer gebeurd: https://github.com/wso2-attic/wsf (in de meeste gevallen is de laatste wijziging van 10 jaar terug - dat zal ook zo'n beetje de tijd zijn geweest wanneer ik ermee zat te stoeien). Kortom: ik zou hier maar vanaf blijven, maar misschien kan het wel een startpunt zijn bij je zoektocht naar een "kant en klare" oplossing (misschien is iemand anders er mee doorgegaan, een fork, of een frisse start ...).

Reageren