tRestClient component changes HTTP method PATCH to POST when using HTTPS

Problem Description

A Job with a tRestClient component configured using HTTPS, changes PATCH method to POST.

 

Steps to Reproduce

You can reproduce the issue by performing the following steps:

  1. Deploy a Talend Job using a tRESTRequest component with PATCH method only on Karaf/Runtime.

  2. Run a test Job from Studio that uses a tRestClient component over HTTPS. The Job fails with the following error:

    javax.ws.rs.NotAllowedException: HTTP 405 Method Not Allowed
  3. Access the same web service outside of Talend and the behavior is as expected.

    http--post.jpg

     

Root Cause

The behavior is considered to be a bug in the product. The PATCH method is being replaced by POST in the tRestClient component. The following error was captured in the tesb.log:

--------------------------------------
08:10:21,805 | INFO  | qtp162426697-103 | eptor.AbstractLoggingInterceptor  253 | 101 - org.apache.cxf.cxf-core - 3.1.7 | Inbound Message
----------------------------
ID: 15
Response-Code: 405
Encoding: ISO-8859-1
Content-Type: application/json; odata.metadata=minimal
Headers: {Allow=[GET,PUT,PATCH,DELETE], Cache-Control=[no-cache], Content-Length=[2149], content-type=[application/json; odata.metadata=minimal], Date=[Mon, 12 Feb 2018 08:10:20 GMT], Expires=[-1], OData-Version=[4.0], Pragma=[no-cache], REQ_ID=[fb596d24-552e-4311-b5ee-2fc350009c3b], Server=[Microsoft-IIS/8.5], Set-Cookie=[crmf5cookie=!fvftU7/vfDW4hJc2sMAcTcX9KVcVpTu6e4KuOeIo/t5g+RsGqv39EeXX2CfNGfaun4sTKBJvbQOcpE8=;secure; path=/, ReqClientId=8d4063a6-9700-4dac-91d7-2f89119161d0; expires=Sun, 12-Feb-2068 08:10:21 GMT; path=/; secure; HttpOnly], Strict-Transport-Security=[max-age=31536000; includeSubDomains], X-AspNet-Version=[4.0.30319], X-Powered-By=[ASP.NET]}
Payload: {
  "error":{
    "code":"","message":"Unmapped Request found, PathTemplate:~/entityset/key, HttpVerb:POST","innererror":{
      "message":"Unmapped Request found, PathTemplate:~/entityset/key, HttpVerb:POST","type":"Microsoft.Crm.CrmHttpException","stacktrace":"   at Microsoft.Crm.Extensibility.OData.EntityController.HandleUnmappedRequest(ODataPath path)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
    }
  }
}
--------------------------------------

 

Solution

To resolve this issue request a patch from Talend Support. However, the issue is permanently fixed in Talend 6.4.

Version history
Revision #:
13 of 13
Last update:
‎07-05-2019 03:51 AM
Updated by: