on 2017 Mar 03 9:28 AM
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.
In the Help you can read that the Parameters to a service can be Host Variables.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
10 | |
9 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.