0

HTTPセッションを維持しながら、Oracle Service CloudからカスタムXMLメッセージを送信できますか?

これまでのところ、cURL を使用して 1 つのメッセージを送信できました。

<?php

use \Rightnow\Connect\v1_2 as RNCPHP;
use \Rightnow\CPM\v1 as RNCPM;

    $url1 = "";
    $startInterviewHeaders = array("SOAPAction: http://oracle");
    $startInterview;

    // session

    //$strCookie = 'PHPSESSID=' . $_COOKIE['PHPSESSID'] . '; path=/'; 

    if(!function_exists("\curl_init")){
        \load_curl();
        echo "curl loaded";
    } else {
        echo "curl already exists   ";
    }
    $ch = curl_init();

    curl_setopt( $ch, CURLOPT_COOKIE, $strCookie );
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_URL, $url1);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $startInterview);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $startInterviewHeaders);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

    $startInterviewresponse = curl_exec($ch);
    //echo $response;

    $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $curl_errno= curl_errno($ch);
    echo "</br> HTTP status: " . $http_status . "</br> cURL error: " .$curl_errno . "</br>";
    curl_close($ch); //  close cURL
    echo $startInterviewresponse;


?>

編集: 上記のコードは単一のメッセージを送信して応答を取得しますが、CURLOPT_COOKIEJAR と CURLOPT_COOKIEFILE を使用して HTTP セッションを維持しようとすると、2 番目の cURL メッセージ応答でアクティブなセッションがないと不平を言います。

sessions.com.oracle.determinations.server.exceptions.NoActiveInterviewExceptionaction "Investigate" can not be performed without an active interview

セッションを維持するために使用したコード (Rightnow 環境外でテストするときに機能しました)

curl_setopt($ch,CURLOPT_USERAGENT, $useragent);
    curl_setopt($ch, CURLOPT_COOKIESESSION, true);
    curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie-name');  //could be empty, but cause problems on some hosts
    curl_setopt($ch, CURLOPT_COOKIEFILE, '/var/www/ip4.x/file/tmp');  //could be empty, but cause problems

ありがとう!

4

1 に答える 1