Hi All,

Is google-form, the user fills in the fields on it and presses the button, which is formed by the json object, and call my web service in SA 12.0.1 which that the json-object should be transferred.

This JS-method code that calls the service at Sybase SA 12.0.1

function postToURL_1(formObject, URL) {
  var result = {};
  try {
    var options =
        { "method": "post",
         "contentType": "application/json",
         "muteHttpExceptions": true,
         "payload": JSON.stringify([ formObject.text, +formObject.number,
formObject.string, formObject.inputDate, formObject.myFile ])
        };
    result.status = true;
    result.message = 'Запрос выполнился';
    var response = UrlFetchApp.fetch(URL, options);
    result.itog = JSON.parse(response);
  }
  catch (err) {
    result.status = false;
    result.message = 'Запрос не выполнился';
    result.err = err;
  }
  return result;
}

The URL parameter is passed a reference to the web-service http://xxx.xxx.xxx.xxx:yyyy/TestBase/wsTest1 formObject is google-form.

This is the code from the database:

CREATE SERVICE "wsTest1" TYPE 'JSON' AUTHORIZATION OFF USER "MyUser" AS call dba.WebTest1(:cXML);

CREATE PROCEDURE "DBA"."WebTest1"(in cXML long varchar)
RESULT( cReturn long varchar ) 
BEGIN       
 select cXML;
END
go

The parameter should come cXML json-object, but why it does not come. That is, the web-service call and subsequent call dba.WebTest1 happening, but why it cXML null value (NULL) comes.

asked 03 Mar '17, 09:28

Stalker's gravatar image

Stalker
515293151
accept rate: 11%


In the Help you can read that the Parameters to a service can be Host Variables.

Create Service -> statement

Specifies a command, such as a stored procedure call, to invoke when the service is accessed.
In a typical web service application, you use statement to call a function or procedure. You can pass host variables as parameters to access client-supplied HTTP variables.

You should use the HTTP_BODY function to get the POST Data.

HTH

permanent link

answered 03 Mar '17, 09:48

Thomas%20Duemesnil's gravatar image

Thomas Dueme...
2.7k293965
accept rate: 17%

edited 06 Mar '17, 03:56

Many thanks for the tip, HTTP_BODY() returns the value of transmitted json-object. But still not clear why the cXML comes NULL ?

(03 Mar '17, 13:29) Stalker
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×30
×24

question asked: 03 Mar '17, 09:28

question was seen: 3,167 times

last updated: 06 Mar '17, 03:56