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.

Hi, I have 2 SQL-Anywhere DBs, each of them has several Webservices. Is there a way to call the the Webservice on DB1 from within DB2?

Now I can imagine that I can use CURL for this purpose, and then output the Service response in a text file, and then read the response from this text file.

Is there maybe a ready function in Sybase 10?

Thanks in advance

asked 10 Sep '19, 08:40

Baron's gravatar image

accept rate: 48%

edited 10 Sep '19, 09:48

Volker%20Barth's gravatar image

Volker Barth

Of course you can, even with v10, and no need to fiddle with calling external tools. See the following doc topic:

Creating web service client functions and procedures

This forum certainly has a bunch of questions dealing with web client functions/procedures.

permanent link

answered 10 Sep '19, 09:48

Volker%20Barth's gravatar image

Volker Barth
accept rate: 34%

Thank you very much. Very useful is that the parameters list which are defined in:

CREATE PROCEDURE [ owner.]procedure-name ( [ parameter, ... ] )

Will be the parameters of the URL ('?' '=' '&' will be automatically added)

(11 Sep '19, 07:15) Baron

One more question please.

If I apply the example in the link sent:


URL 'HTTP://localhost'



CALL MyOperation( 123, 'abc' )

How can I read the output of MyOperation (I need to get the Response of HTTP://localhost).

in other words, I need something like select * from MyOperation( 123, 'abc' ) Here I get error message (MyOperation does not return result set).

Even with the following block I can not solve the problem!

CREATE function MyOperation ( a INTEGER, b CHAR(128) )

returns varchar

URL 'HTTP://localhost'



select * from MyOperation( 123, 'abc' )

(12 Sep '19, 04:24) Baron
Replies hidden

Hm, v11.0.0 has introduced a facility to log web client requests and responses via the -zoc server option and/or sa_server_option settings. I found that very helpful in developping web client procedures.

Nevertheless, the docs certainly do tell the difference between using web client functions vs. procedures based on their different result (sets). When using functions, you get a XML that can be extracted via openxml.

(12 Sep '19, 05:08) Volker Barth

Thanks for the reply, I still have difficulty with OPENXML. The response of my webservice looks like:


<row updresult="OK"/>


How can I read the "OK"?

I tried the following without success:

select * from openxml (get_webservices(), '/row') with ("ResultfromSRV" char(5) '@UpdResult')

(12 Sep '19, 07:55) Baron

This is more an OpenXML question. I'd recommend to ask that as a separate question.

(12 Sep '19, 08:56) Volker Barth

FWIW, here's a sample:

select *
from openxml(
    <row updresult="OK"/>
with (LocalName long varchar '@mp:localname', LocalText long varchar '@mp:xmltext', ResultfromSRV varchar(5) '@updresult')



row,<row updresult="OK"/>,OK

I suggest to use those meta properties like @mp:xmltext and the like to check whether you are "looking at the rigt nodes" , in your sample the XPath was not fitting as it missed the initial slash, therefore the '//row'.

(12 Sep '19, 09:43) Volker Barth

Thank you very much. I am missing gneral knowledge in XML

(12 Sep '19, 10:45) Baron
showing 2 of 7 show all flat view

In additiion to what Volker said, if you get 403 Forbidden when trying to call a service from a client on the same database, try HEADER 'ASA-Id'.

I'm not sure that also applies to different databases on the same SQL Anywhere server, but it might.

Here's a snippet from my Vast Template Collection :)...

   urlspec    LONG VARCHAR )
   attribute   LONG VARCHAR,
   value       LONG VARCHAR )
URL '!urlspec'
HEADER 'ASA-Id'   -- avoid same-server error "HTTP request failed. Status code '403 Forbidden'"
permanent link

answered 10 Sep '19, 11:15

Breck%20Carter's gravatar image

Breck Carter
accept rate: 20%

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 Sep '19, 08:40

question was seen: 1,293 times

last updated: 12 Sep '19, 10:45