Japanese to English translator REST API is resulting junk values

359 views
Skip to first unread message

Gokulnath K

unread,
Aug 10, 2017, 9:02:55 AM8/10/17
to Google Cloud Translation API
Hi,

We have a requirement to call google translator REST Api for translating "Japanese to English". We have been using below service since 2013: 

https://www.googleapis.com/language/translate/v2?source=ja&model=nmt&q=JAPANESE TEXT&target=en&key=UNIQUE_KEY 

We have a custom webservice which invokes above REST service by substituting Japanese text to the "q" and unique authentication key to "key" parameters in above header, by using the BS "EAI HTTP Transport" and "SendReceive" method. It was working fine till this Jan 2017. 

But it started returning junk values now, after doing detailed analysis I found that, it's an Unicode/encoding issue. While passing Japanese characters in URL from siebel to Google, Japanese characters are encoded with different values which google can't understand. Other programming languages uses "urlencode" function to encode this Japanese characters before adding it in URL. Siebel don't have any functions other than escape for this purpose. 

2 issues: 
1) How to resolve this encoding issue in siebel? 
2) How it was working for last 3 years or any recent change in Siebel release causing this? 

It's a production issue, so let me know if you need any other details from our side and address it ASAP. 


Thanks & Regards
Gokulnath K

George (Cloud Platform Support)

unread,
Aug 10, 2017, 1:26:45 PM8/10/17
to Google Cloud Translation API
Hello Gokulnath, 

For Siebel-specific issues such as these, you are surely best informed by Siebel support directly. 

1) Oracle covers your encoding issue in a dedicated document: "About Siebel EAI and Unicode Support". This might solve your issue by itself. 
2) Siebel released an update with "Innovation Pack 2017" in February this year. This period seems to map well onto the start of your Unicode-related issues. It may be worthwhile to contact Siebel support and inquire about possible side-effects of the February update. 

If the above information does not cover all your issues or you have more specific questions, you are welcome to return with more detail. 

Gokulnath K

unread,
Aug 31, 2017, 3:01:44 AM8/31/17
to Google Cloud Translation API
Hello George,

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_KEY

EAITransport 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?

Gokulnath K

unread,
Oct 10, 2017, 7:46:57 AM10/10/17
to Google Cloud Translation API
Hi George,

Did you get a chance to look into this issue?
Reply all
Reply to author
Forward
0 new messages