Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in August and this forum will be retired.

I am consuming an external webservice from within my SQL Anywhere 17 using the following code:

create or replace function F1("JsonLoad" long varchar)

returns long varchar

url 'https://USER:PWD@localhost/index.php/mytest'

CERTIFICATE 'file=C:\TEMP\mycer.cer'

type 'http:post:application/json'

create or replace procedure P1("JsonLoad" long varchar)


call F1(JsonLoad);


The question is, how can I feed the USER & PWD from within P1?


How can I change the definition of F1 so that it reads the values of USER & PWD from a table in DB

asked 10 Apr '20, 14:29

Baron's gravatar image

accept rate: 48%

edited 10 Apr '20, 14:30

You can use parameter substitution

Example (note the !user and !pwd in the url clause):

create or replace function F1( 
                    "user" long varchar,
                    "pwd"  long varchar,
                    "JsonLoad" long varchar )
returns long varchar
url 'https://!user:!pwd@localhost/index.php/mytest'
CERTIFICATE 'file=C:\TEMP\mycer.cer'
type 'http:post:application/json'

create or replace procedure P1("JsonLoad" long varchar)
    call F1( 'myuser', 'mypassword', JsonLoad );
permanent link

answered 11 Apr '20, 17:08

Mark%20Culp's gravatar image

Mark Culp
accept rate: 41%

edited 13 Apr '20, 10:50

Just to add: Like Mark has shown above and answered here, web client functions (and also web client procedures) can be parameterized with the "!param" syntax - but the work to calculate or query values for these parameters must be done outside the web client functions.

Web client functions simply build a request from their input values, send it to the according web server, wait for the response and fetch and return it in the desired way. And that's all (although technically, that's certainly pretty much work...).

So in most cases you will need wrappers (usually "normal" functions/procedures like P1 in your sample) to calculate parameter values for the web client functions (say, by querying database contents and the like), then calling the web client function with these parameters, and then probably work on the web client function's return value to pick up the relevant information like error states, particular fields and the like. I have never used a web client function without having to wrap its call with one or more "outer" functions and produres.

permanent link

answered 13 Apr '20, 14:51

Volker%20Barth's gravatar image

Volker Barth
accept rate: 34%


@volker bath, thanks for the explanation and sorry for the duplicated question.


(13 Apr '20, 19:48) Baron
Your answer
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 10 Apr '20, 14:29

question was seen: 935 times

last updated: 13 Apr '20, 19:48