May 19, 2021 at 8:47 pm #17003
I am calling a rest API using post method. I get the response and when commit is called, I see a GET request being sent on the channel. This request is only seen if commit is called after API call.
As API does not support GET, HTTP code 500 is returned and transaction fails to commit.
In the Channel I have specified GET = false.
Not sure why GET request is called on commit, and not sure how GET goes through the channel if GET = false.
Any pointers will be helpful0
May 20, 2021 at 9:27 am #17013
Would it be possible to share a code snippet? The commit behaviour is expected as integration channels are transactional. But if you are sending a POST it should remain a POST, not change to a GET. Are you sure the method property on your request is POST?0
May 20, 2021 at 10:57 am #17019
Hi Ed, thank you.
Yes Method on my request is POST, but when commit is called I can see request as GET. Please see attached log.
Code is 1- Invoke service
Step 2- Commit.0
May 20, 2021 at 10:58 am #17026
May 20, 2021 at 11:18 am #17034
I see your log output, but it would be helpful if you could post the HTTP invocation code you are executing. Thanks, Ed0
May 20, 2021 at 11:48 am #17040
Please find code below.
(: :class “T24_SA_CashCCY”)
(: bu “0201”)
(: cif “1100324”)
(: portfolioNumber “1100324-2” )
(: accountOfficer “1104”)
(: availableCashAccounts “1”)
(: accountCurrencies col)
; (: accountCurrencies (message
; (: :class “T24_SA_CashCCY_CCY”)
; (: accountCurrencies col )
Attachments:You must be logged in to view attached files.
May 20, 2021 at 12:43 pm #17048
Thanks, could you show me the code that sends the message in the “T24_SA_CashCCY” service?0
May 20, 2021 at 12:56 pm #17054
do you mean the code for invokeService method ? Please see below.
(define (invokeService service-name message output . args)
((apply SysService ‘invoke
May 20, 2021 at 2:48 pm #17061
What I’m looking for are the contents of the T24_SA_CachCCY.service file.
May 20, 2021 at 3:33 pm #17067
Thank you. Please find it below
Interface and channel name is same .
<Service layout=”startX:420;startY:100;endX:414;endY:600″ variables=”ex”>
<TryCatch layout=”w:191;y:160;h:401;x:320″ name=”tryCatch” variable=”ex”>
<Log layout=”y:34;x:70″ level=”"info"” name=”log”/>
<SendReceive interface=”T24_SA_CashCCY” layout=”y:150;x:44″ name=”sendReceive” output=”"T24_SA_CashCCY"”/>
<Log layout=”y:280;x:42″ level=”"dump"” name=”log response”/>
<Catch layout=”w:150;h:100;y:311;x:640″ name=”catch”>
<Script layout=”y:10;x:10″ name=”log Exception”><![CDATA[(logger’error “Cash Account error: ” ex)
May 20, 2021 at 5:37 pm #17074
I think I need to see the interface and the .message file associated with the class “T24_SA_CashCCY”. I’m not sure what transformations are being made by the interface. As it stands, you are passing a “T24_SA_CashCCY” transfer object to the service. There is no method part to the message so it makes sense that it is defaulting to GET because I don’t see POST being set anywhere. The typical approach is something like…
(define msgBody ; your message payload in raw internal format
(: :class “MyMessageType”)
(: part1 “mypart”)
(: part2 “mypart2”)
(: :class “HTTP”)
(: method “POST”) ; must set the method explicitly
(: headers ; set security and type headers that the target API expects
(message (: content-type “application/json”))
(: body (format-message msgBody)) ; uses the message type to format to the wire format e.g. JSON or XML
(define ret ((integration-send-receive request “MyChannel” ()))) ; equivalent to using the SendReceive step in a service
; you may optionally use an interface to automatically parse the return value which is the third parameter above
(define bod (ret’body))0
May 20, 2021 at 9:16 pm #17081
It worked . thanks a lot.
what I infer from this is,
1- the method that I used (invokeService) is transactional. so when commit was getting called, it makes the API call with GET method.
2- My call was going with POST method as I was using a channel in which POST was set to true ( GET was not set to true)
3- Commit is using GET method as POST method was not specified in the request message (still my first request goes as POST ).
One difference that I see in the logs with my code , before the GET call channel logs sending a request on channel, with response type message (T24_SA_CashCCY_Response).
where as before the POST call I can see log as sending message on channel with correct object
Se both logs below.
GET call log.
; 16:42:14,131 DEBUG [UnitOfWork] (NexJ-ContainedProcess) Committing 0 instance(s)
; 16:42:14,131 DEBUG [UnitOfWork] (NexJ-ContainedProcess) Sending 1 message(s) on channel “T24_SA_CashCCY”
; 16:42:14,131 DEBUG [T24_SA_CashCCY] (NexJ-ContainedProcess) Sending a request on channel “T24_SA_CashCCY”
; 16:42:14,131 DUMP [T24_SA_CashCCY] (NexJ-ContainedProcess) TO<T24_SA_CashCCY_Response, @650985704>(
; 16:42:14,131 DEBUG [HTTPClient] (NexJ-ContainedProcess) Connecting to sglt9010200.ap.hedani.net/10.164.168.16:8088
; 16:42:14,131 DEBUG [T24_SA_CashCCY] (NexJ-ContainedProcess) Activated HTTPConnection(socket=572a6f17[TLS_DHE_RSA_WITH_AES_128_CBC_SHA: Socket[addr=sglt9010200.ap.hedani.net/10.164.168.16,port=8088,localport=53922]], time=2021-05-20 15:42:14.130000000)
; 16:42:14,131 DEBUG [HTTPClient] (NexJ-ContainedProcess) HTTP request: GET https://sglt9010200.ap.hedani.net:8088/api/cs/pb/saudi/pronghorn/v1/createAccount HTTP/1.1
POST call log
; 16:42:12,004 DEBUG [T24_SA_CashCCY] (NexJ-ContainedProcess) Sending a message on channel “T24_SA_CashCCY”
; 16:42:12,004 DUMP [T24_SA_CashCCY] (NexJ-ContainedProcess) TO<, @778351515>(
; 16:42:12,004 DEBUG [HTTPClient] (NexJ-ContainedProcess) Connecting to sglt9010200.ap.hedani.net/10.164.168.16:8088
; 16:42:12,182 DEBUG [T24_SA_CashCCY] (NexJ-ContainedProcess) Created HTTPConnection(socket=572a6f17[SSL_NULL_WITH_NULL_NULL: Socket[addr=sglt9010200.ap.hedani.net/10.164.168.16,port=8088,localport=53922]])
; 16:42:12,182 DEBUG [HTTPClient] (NexJ-ContainedProcess) HTTP request: POST https://sglt9010200.ap.hedani.net:8088/api/cs/pb/saudi/pronghorn/v1/createAccount HTTP/1.10
- You must be logged in to reply to this topic.