I pass three parameters to the HTTPPOSTCLOB function the web service URL, a Header, and a Body. The JSON_TABLE function parses the results returned from the web service. I declare a cursor, then execute the SQL statement that consumes the REST service using the HTTPPOSTCLOB function. Values (:jsonData.petMessage, :jsonData.petType, (pet_message, pet_type, pet_price, AddPgm, AddUser, Ws_pet_price decimal(5,2) Path 'lax $.price') Json_Table(Systools.HttpPostClob(:WebServiceUrl, :WebServiceHeader,Ĭolumns(ws_pet_message VarChar(30) Path 'lax $.message',Ĭolumns(ws_pet_type VarChar(30) Path 'lax $.type', I’ll show the entire routine, then break it down piece by piece. The following section of code does just that. Now that the setup work is done, it’s time to consume the web service. clear output table before consuming the web service Next, I clear the DB2 table that will store the results from the web service to make sure I only have the results from the latest call to the service. I pass a JSON structure to the web service that contains the pet type and price. I created a simple REST Amazon Web Service that accepts information about a pet which will be inserted into a pet store database. The goal is to post information to an Amazon Web Service (AWS). Db2 json query example how to#In addition to working with a different verb, I’m also going to demonstrate how to pass a header and body to the service. This time, we’re going to continue to build our knowledge of web services by working with the POST verb. In my prior article, I showed how to consume a REST web service using the GET verb. Guru: Consuming A REST Web Service Using SQL And POST
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |