Oracle says "no changes happened" from their end in Siebel.
Google translator api have 2 different ways to invoke. (1. GET, 2. POST).
GET is causing the problem now while accessing google api. But POST method in Siebel will do encode before calling google api, so i modified my code like given below:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
if(MethodName == "Test"){
var googleRest = TheApplication().GetService("EAI HTTP Transport");
var googleReq = "https://www.googleapis.com/language/translate/v2?source=ja&target=en&key=UNIQUE_KEY";
var Req = TheApplication().NewPropertySet ();
var Resp = TheApplication().NewPropertySet ();
var question = "q";
var totran = "こんにちは";
var pt = "{";
pt = pt + '"' + question + '"' + ":" + '"' + totran + '"';
pt = pt + "}";
Req.SetProperty("HTTPRequestURLTemplate", googleReq);
Req.SetProperty("HTTPRequestMethod", "POST");
Req.SetProperty("HDR.Authorization", "key UNIQUE_KEY");
Req.SetProperty("HTTPAccept", "application/json");
// Req.SetValue(pt);
Req.SetProperty("HTTPRequestBodyTemplate",pt);
Req.SetProperty("Content-Type", "application/json");
Req.SetProperty("HTTPContentType", "application/json");
googleRest.InvokeMethod("SendReceive", Req, Resp);
var oTransService = TheApplication().GetService("Transcode Service");
var oTransOutputs = TheApplication().NewPropertySet();
Resp.SetProperty("ConversionMode", "EncodingToString");
Resp.SetProperty("SourceEncoding", "UTF-8");
oTransService.InvokeMethod("Convert", Resp, oTransOutputs);
var temp = oTransOutputs.GetValue();
Outputs.SetProperty("googleOutput",temp);
return (CancelOperation);
}
return (ContinueOperation);
}
_____________________________________________________________________________________________________________________-
above call returns this error: status code - 400 (SBL-EAI-04117)
As per oracle:
I see you are receiving HTTP 400 - Bad request.
Can you please get in touch with Google support and see if any changes have been made on their side ?
_____________________________________________________________________________________________________________________
Found below lines from my log file:
-- Log File -- File Name or Source ------------------------- siebel.log Description -------------- Siebel log generated during POST call Relevant Information Collection --------------------------------------- EAITransport EAITransportDebug 4 0000000259783c58:0 2017-07-26 05:09:59 *** HTTP Transport Parameters: EAITransport EAITransportDebug 4 0000000259783c58:0 2017-07-26 05:09:59 Request URL = https://www.googleapis.com/language/translate/v2?source=ja&target=en&key=UNIQUE_KEYEAITransport EAITransportDebug 4 0000000259783c58:0 2017-07-26 05:09:59 Request Method = POST EAITransport EAITransportDebug 4 0000000259783c58:0 2017-07-26 05:09:59 Timeout secs = 1800000 EAITransportPerf EAITransportPerf 5 0000000259783c58:0 2017-07-26 05:09:59 Created Request Connection|31 EAITransport EAITransportGeneric 3 0000000259783c58:0 2017-07-26 05:09:59 Sending Request EAITransport EAITransportDebug 4 0000000259783c58:0 2017-07-26 05:09:59 *** HTTP request Headers for Data Send Request: HTTPContentType: text/xml
User-Agent: Mozilla/4.0
Accept: */*
Connection: close
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
EAITransport EAITransportDebug 4 0000000259783c58:0 2017-07-26 05:10:01 *** HTTP response Headers from Data Send request: HTTP/1.1 400 Bad Request Vary: X-Origin Vary: Referer Content-Type: application/json; charset=UTF-8 Date: Wed, 26 Jul 2017 12:10:01 GMT Server: ESF Cache-Control: private X-XSS-Protection: 1; mode=block X-Frame-Options: SAMEORIGIN X-Content-Type-Options: nosniff Alt-Svc: quic=":443"; ma=2592000; v="39,38,37,36,35" Accept-Ranges: none Vary: Origin,Accept-Encoding Connection: close Relevance to the Issue --------------------------- HTTP/1.1 400 Bad Request
|
_____________________________________________________________________________________________________________________
Can you help me out why Google returns "Bad request" for my POST call?
also could you please share the Siebel code snippet to invoke google translate api using POST method?