【问题标题】:Siebel > HTTP Post request is not being received properlySiebel > 未正确接收 HTTP Post 请求
【发布时间】:2018-03-25 21:51:07
【问题描述】:

从 Siebel 我使用客户端业务服务向 Oracle RightNow 发送 HTTP Post 请求。在请求中,我将 XML 作为字符串发送到 RightNow,但未正确接收。当我使用“二进制”选项从 Postman 发送时,相同的 XML 可以正常工作。邮递员请求如下:

但是当我从 Siebel 发送请求时,我只能在 RightNow php 脚本中获取这些字符:

??

在 RightNow 方面,我将在字段中设置它时获得的值转储以了解即将发生的情况。从 Postman 请求中,该字段显示具有正确值的完整 XML,但从 Siebel 请求中,我只是得到上述字符。

Siebel 业务服务代码:

function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
 if(MethodName == "Create")
 {
     var bs = TheApplication().GetService("EAI HTTP Transport");
     var inp = TheApplication().NewPropertySet();
     var outputs1 = TheApplication().NewPropertySet(); 

     inp.SetProperty("HTTPRequestMethod","POST");
     inp.SetProperty("HTTPContentType", "text/html; charset=UTF-8");
     inp.SetProperty("HTTPRequestURLTemplate","http://<REMOVED>.rightnowdemo.com/cgi-bin/<REMOVED>.cfg/php/custom/REMOVED.php");

    var reqVal = '<?xml version="1.0" encoding="utf-8" ?> '+
    '<request> '+
    '  <head> '+
    '    <auth> '+
    '      <account>CompanyName</account> '+
    '     <user>userName</user> '+
    '    <pass>Pass</pass> '+
    '</auth> '+
    '      <action>sendsms</action> '+
    '  </head> '+
    ' <body> '+
    '   <addr> '+
    '     <from>039535640</from> '+
    '    <to> '+
    '      <cli>97254545450</cli> '+
    '  </to> '+
    '</addr> '+
    '<data> '+
    '  <msgtype>text</msgtype> '+
    '   <text>This is SMS message text</text> '+
    ' </data> '+
    '  <billing> '+
    '      <port>0</port> '+
    '    </billing> '+
    '  </body> '+
    '</request>';

    inp.SetProperty("HTTPRequestBodyTemplate",reqVal);

    bs.InvokeMethod("SendReceive",inp,Outputs);

  return (CancelOperation);
 }
 return (ContinueOperation);
}

RightNow PHP 脚本:

<?php
ini_set('display_errors', 1);
header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1.
header("Pragma: no-cache"); // HTTP 1.0.
header("Expires: 0"); // Proxies.
require_once( get_cfg_var("doc_root")."/ConnectPHP/Connect_init.php");
use RightNow\Connect\v1_2 as RNCPHP;

$response = file_get_contents('php://input'); //file_get_contents('http://www.google.com');//
        $p = xml_parser_create();
        //xml_parser_set_option( $p, XML_OPTION_CASE_FOLDING, 0 );
        //xml_parser_set_option( $p, XML_OPTION_SKIP_WHITE, 1 );
        xml_parse_into_struct( $p, $response, $index );
        xml_parser_free( $p );

        foreach ($index as $tag) 
        {
            if($tag["type"]=="complete")
            {
                $temparr = array($tag['tag'] => $tag['value']);             
            }
        }   

$username="<REMOVED>";
$password="<REMOVED>";


//Checking authentication
try 
{
    initConnectAPI($username, $password);
    $testVar= RNCPHP\Incident::fetch(2620);
} catch (Exception $e) {
    echo "Authentication failed.";
    die;
}

$incident->CustomFields->c->Onsitegoissuedescription=$response;

更新

在 chrome 中,我跟踪了 header 并发现了以下内容:

POST http://desktop-i7nrnuh/start.swe 接受:/ 来源: http://desktop-i7nrnuh X-Requested-With: XMLHttpRequest User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, 像壁虎)Chrome/64.0.3282.186 Safari/537.36 内容类型: application/x-www-form-urlencoded 推荐人: http://desktop-i7nrnuh/start.swe?SWECmd=GotoView&SWEView=Business+Service+Test+View&SWERF=1&SWEHo=desktop-i7nrnuh&SWEBU=1 接受编码:gzip,放气接受语言: en-GB,en-US;q=0.9,en;q=0.8

我正在寻找“接受编码”广告。它是否发送压缩请求?

更新 我使用 Fiddler 跟踪请求,发现如下:

发布 http://.rightnowdemo.com/cgi-bin/.cfg/php/custom/.php HTTP/1.1 用户代理:Mozilla/4.0 接受:text/* 内容类型:text/xml 主机:.rightnowdemo.com 内容长度:910 编译指示: 无缓存

ÿþ
C o m p a n y N a m e a c c o u n t >
u s e r N a m e u s e r > P a s s p a s s > a u t h > s e n d s m s a c t i o n > h e a d > 0 3 9 5 3 5 6 4 0 f r o m >
9 7 2 5 4 5 4 5 4 5 0 c l i >
t o > a d d r > t e x t T h i s i s S M S m e s s a g e t e x t t e x t > d a t a > 0 p o r t > b i l l i n g > b o d y > r e q u e s t >

我不确定这两个 (ÿþ) 字符从哪里开始?

【问题讨论】:

    标签: siebel rightnow-crm oracle-service-cloud


    【解决方案1】:

    从日志中可以清楚地看到问题。 Siebel 现在正在发送 UTF-16 消息,这就是您在每个字符和前导垃圾字符之间看到空格的原因。这是 Siebel escript 中的默认功能。为了解决这个问题,您必须使用转码服务消息到 UTF-8,以便立即接受它。

    【讨论】:

      【解决方案2】:

      解决方案是,我们必须将 xml 作为二进制发送,该二进制文件位于 HTTP 传输业务服务中 '' 的输入参数中。我知道此参数未在输入中定义,但这将被视为 Siebel OOTB,并且将发送正确的数据。 因此,如上所述,您使用的是 escript 还是工作流并不重要。您只需在 '' 中设置 xml,然后将其作为输入参数传递。

      【讨论】:

        猜你喜欢
        • 2016-07-03
        • 2017-12-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-12-30
        • 1970-01-01
        • 2018-05-26
        相关资源
        最近更新 更多