PHP CURL üzerinden SOAP yöntemi çağırmak, çağrı istemci kimlik doğrulaması

0 Cevap php

GENEL BAKIŞ:

The code is about making call to the escreen web service using SOAP and Curl with client authentication required. Currently I am not getting any result only HTTP 403 and 500 errors. The call requires client authenticate cert to be on the callng site.

KOD:

$content = "<TicketRequest>
  <Version>1.0</Version>
  <Mode>Test</Mode>
  <CommitAction></CommitAction>
  <PartnerInfo>
  <UserName>xxxxxxxxxx</UserName>
  <Password>xxxxxxxxxxx</Password>
  </ PartnerInfo>
  <RequestorOrderID></RequestorOrderID>
  <CustomerIdentification>
    <IPAddress></IPAddress>
    <ClientAccount>xxxxxxxxxx</ClientAccount>
    <ClientSubAccount>xxxxxxxxxx</ClientSubAccount>
    <InternalAccount></InternalAccount>
    <ElectronicClientID></ElectronicClientID>
  </CustomerIdentification>
  <TicketAction>
    <Type></Type>
    <Params>
      <Param>
      <ID>4646</ID>
      <Value></Value>
      </Param>
    </Params>
  </TicketAction>
</TicketRequest>";

$wsdl  = "https://services.escreen.com/SingleSignOnStage/SingleSignOn.asmx";

$headers = array(  "Content-type: text/xml;charset=\"utf-8\"", 
     "Accept: text/xml", 
     "Cache-Control: no-cache", 
     "Pragma: no-cache", 
  //   "SOAPAction: \"\"", 
     "Content-length: ".strlen($content),
    ); 


$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $wsdl); 
curl_setopt($ch, CURLOPT_HEADER, 1); 
curl_setopt($ch, CURLOPT_VERBOSE, '1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $content); 

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, '1');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, '1');
//curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 
//curl_setopt($ch, CURLOPT_HTTPHEADER, array('SOAPAction: ""')); 
curl_setopt($ch, CURLOPT_CAPATH, '/home/pps/');
curl_setopt($ch, CURLOPT_CAINFO,  '/home/pps/authority.pem');
curl_setopt($ch, CURLOPT_SSLCERT, 'PROTPLUSSOL_SSO.pem');
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, 'xxxxxxxxxxxx');

$output = curl_exec($ch);

// Check if any error occured
if(curl_errno($ch))
{
    echo 'Error no : '.curl_errno($ch).' Curl error: ' . curl_error($ch);
}

print_r($output);

SORULAR:

  1. I need to call the RequestTicket method and pass the XML string to it. I don't know how to do it here(pass the method name to call).

  2. For client authentication they gave us three certs, one root cert, one intermediate cert and a client authentication cert PROTPLUSSOL_SSOpem(it was a .pfx file). Since we are on linux we converted them to pem . In curl calls I could not find way to how to include both the root cert and the intermediate cert ,so I combined them by making a new pem file and copying the intermediate cert and them the root cert and naming it authority.pem . I am not sure whether it works or not and would like your opinion.

  3. For the current code Iam getting the error Error no : 77 Curl error: error setting certificate verify locations: CAfile: /home/pps/authority.pem CApath: /home/pps/

    Ben kıvırmak hata mesajı devre dışı bırakırsanız, ben sayfa başlığı 403 ile boş bir sayfa alıyorum - Yasak. Erişim engellendi.

    Ben CURLOPT_CAINFO ve CURLOPT_CAPATH satırları ise HTTP içerik olarak mesajı ile 500 hata sayfası verir ve üstünde şu.

    HTTP/1.1 500 Internal Server Error. Cache-Control: Özel Content-Type: text / html Sunucu: Microsoft-IIS/7.5 X-aspnet-Version: 1.1.4322 X-Powered-By: ASP.NET Tarih: Thu, 2 Eylül 2010 14:46:38 GMT Content-Length: 1208

Ben yukarıda açıklama ve aynı zamanda CURLOPT_SSLCERT ve CURLOPT_SSLCERTPASSWD eğer içerik olarak mesajı ile 403 hatası veriyor.

Yani geçerli kod ile ne yanlış işaret ederek bana yardım etmenizi rica ediyorum.

Teşekkür ederim.

0 Cevap