0

是否可以在维护 HTTP 会话的同时从 oracle 服务云发送自定义 XML 消息?

到目前为止,我已经成功地使用 cURL 发送了一条消息:

<?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 会话时,第二个 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

1

您的代码示例是自定义流程模型。CPM 不允许持久性,一旦 CPM 完成就会关闭。您可以从一个 CPM 运行多个 curl 调用,但不建议这样做;如果每个 CPM 需要多次调用,则应使用集成中间件。

As long as you're running this code from an asynchronous CPM (synchronous CPMs don't expose curl, so that should be the case here), then an error on the OSvC side is likely an issue connecting to your "local test server", which is almost always not exposed to the public internet in an enterprise environment. Therefore, your "crash" is likely a connection error.

Per @drew010, you need to include your error in the context of this question as well.

于 2016-10-11T13:22:20.367 回答