Post json data parameters to a remote server

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
gillettd
Posts: 16
Joined: Tue May 24, 2016 2:13 pm

Post json data parameters to a remote server

Post by gillettd » Tue Sep 03, 2019 5:51 pm

HI,

I am getting a bad request for this request to a remote server and not sure what i am doing wrong ... any help welcome :)

* SERVICE_LOAD
Change Field(#JSMCMD) To('''SERVICE_LOAD SERVICE(HTTPService) TRACE(*YES)''')
Use Builtin(JSM_COMMAND) With_Args(#JSMCMD) To_Get(#JSMSTS #JSMMSG)
Execute Subroutine(CHECK) With_Parms(#JSMSTS #JSMMSG)

Clr_List Named(#PLST)

Change Field(#PNME) To('''accept''')
Change Field(#PVAL) To('''application/json''')
Add_Entry To_List(#PLST)

Change Field(#PNME) To('''Content-Type''')
Change Field(#PVAL) To('''application/json-patch+json''')
Add_Entry To_List(#PLST)

Use Builtin(JSM_COMMAND) With_Args('SET PROPERTY(*LIST) SERVICE_LIST(PNME,PVAL)') To_Get(#JSMSTS #JSMMSG #PLST)
*
Clr_List Named(#WRKLST)
Change Field(#NAME) To('''productId''')
Change Field(#VALUE) To('''string''')
Add_Entry To_List(#WRKLST)

Change Field(#NAME) To('''sampleId''')
Change Field(#VALUE) To('''string''')
Add_Entry To_List(#WRKLST)


* SEND REQUEST
Change Field(#JSMCMD) To('''SEND HOST(''')
Use Builtin(TCONCAT) With_Args(#JSMCMD #WK_HOST ') HANDLER(OutboundNameValue) URI(') To_Get(#JSMCMD)
Use Builtin(TCONCAT) With_Args(#JSMCMD #WK_URL ') SECURE(*NO) SNISERVER(*HOST) METHOD(*') To_Get(#JSMCMD)
Use Builtin(TCONCAT) With_Args(#JSMCMD #WK_METHOD ')') To_Get(#JSMCMD)
Use Builtin(TCONCAT) With_Args(#JSMCMD #WK_METHOD ') #WRKLST(NAME,VALUE)') To_Get(#JSMCMD)

Use Builtin(JSM_COMMAND) With_Args(#JSMCMD) To_Get(#JSMSTS #JSMMSG)
Execute Subroutine(CHECK) With_Parms(#JSMSTS #JSMMSG)

* RECEIVE CONTENT
Change Field(#JSMCMD) To('''RECEIVE HANDLER(InboundFile) TO(''')
Use Builtin(TCONCAT) With_Args(#JSMCMD #WK_FILE ')') To_Get(#JSMCMD)
Use Builtin(JSM_COMMAND) With_Args(#JSMCMD) To_Get(#JSMSTS #JSMMSG)
Execute Subroutine(CHECK) With_Parms(#JSMSTS #JSMMSG)

* SERVICE_UNLOAD
Use Builtin(JSM_COMMAND) With_Args('SERVICE_UNLOAD') To_Get(#JSMSTS #JSMMSG)
Execute Subroutine(CHECK) With_Parms(#JSMSTS #JSMMSG)

Post Reply