SOAP met p12 certificaat

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Pieter Laceur

Pieter Laceur

19/08/2019 18:50:18
Quote Anchor link
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.
 
PHP hulp

PHP hulp

29/03/2024 06:28:16
 
- Ariën  -
Beheerder

- Ariën -

19/08/2019 19:25:22
Quote Anchor link
Heb je al wat in PHP geprobeerd? En zo ja, waar loop je precies op vast?
 
Pieter Laceur

Pieter Laceur

19/08/2019 19:27:57
Quote Anchor link
Dit heb ik reeds geprobeerd (is simulatie-omgeving), maar heb dus geen idee hoe dit werkt en ik krijg een foutmelding terug: wst:RequestFailed
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?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) . "
"
);
?>
 
Rob Doemaarwat

Rob Doemaarwat

19/08/2019 22:15:34
Quote Anchor link
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 ...).
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.