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

Please tell me the HTTP folder under Sybase installation directory, which is the function demonstration file of opening CORS,

The help document only describes the support, but there is no explanation on how to open it http://dcx.sap.com/index.html#sqla170/en/html/b28cc1d4c5df4eb6a2d2fe4aa269955d.html

  1. I run dbsrv17.exe - n testweb - XS HTTP (Port = 8098) demo.db (17.0.10.5963)

  2. Create a web service create service "test" type 'JSON' authorization off user "DBA" URL on as call "get_no" (: no);

  3. Visit the local webpage http://127.0.0.1:8098/test? No = 201140017

  4. The web page shows the JSON page

  5. :get_no code:

ALTER PROCEDURE "DBA"."get_no"(IN no varchar(20) )

BEGIN

CALL dbo.sa_set_http_header('access-control-allow-headers','Authorization, Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, X-Requested-By, If-Modified-Since, X-File-Name, X-File-Type, Cache-Control, Origin');

CALL dbo.sa_set_http_header('access-control-allow-methods','GET, POST, OPTIONS, PUT, DELETE');

CALL dbo.sa_set_http_header( 'Access-Control-Allow-Origin',' *' );

CALL dbo.sa_set_http_header('access-control-expose-headers','Authorization');

call sa_set_http_header( 'Content-Type', 'text/html' );

select * from trans where trans_num=no

end

————

The help document only describes the support, but there is no explanation on how to open it:

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:50680' is therefore not allowed access. The response had HTTP status code 404.

2.Is this related to the options option?

3 . Request URL:http://127.0.0.1:8098/test?get_no=9140017

Request Method:OPTIONS

Status Code:404 Not Found

Remote Address:127.0.0.1:8098

Referrer Policy:no-referrer-when-downgra

How should I deploy it! There are problems on the forum. Are there no successful deployment cases?

end at 2020-01-15

I finally found the problem It turns out it's in Ajax contentType: "multipart/form-data", It's OK to set it as this. Thank all the help people and the posts in the forum, ASA is a powerful database.

asked 09 Jan '20, 23:21

mfkpie8's gravatar image

mfkpie8
273667075
accept rate: 12%

edited 16 Jan '20, 01:01

The help document only describes the support, but there is no explanation on how to open it:

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:50680' is therefore not allowed access. The response had HTTP status code 404.

2.Is this related to the options option?

3 . Request URL:http://127.0.0.1:8098/test?get_no=9140017

Request Method:OPTIONS

Status Code:404 Not Found

Remote Address:127.0.0.1:8098

Referrer Policy:no-referrer-when-downgra

How should I deploy it! There are problems on the forum. Are there no successful deployment cases?

(09 Jan '20, 23:51) mfkpie8
Replies hidden

Yes, you are right that the docs only tell that v17 does allow CORS via the added support for the HTTP OPTIONS method.

v16 and below do not support OPTIONS as method with CREATE SERVICE so thereby you cannot service "non-simple CORS requests", as discussed here as that requires an OPTIONS request.

Note: I have taken that reference from that other FAQ you have related to. And I guess you should be able to build according requests based on that discussion...

(10 Jan '20, 06:12) Volker Barth

I've been looking at these materials, but I still can't find the reason for the lack of support! I have upgraded to the latest version of the software. Can you tell me where the configuration is wrong? That post is a very long time ago. I am now upgrading to 17.0.10 53 patch. Thank you very much for your guidance

(10 Jan '20, 06:32) mfkpie8

I have not used SQL Anywhere with CORS so I can't help further. That said, I do not know whether others can comment on that as your test request simply makes a GET. I don't know or see where a different domain would come into play in your sample at all...

(10 Jan '20, 06:43) Volker Barth

Thank you for your reply. Yes, I just made a very simple example,

That is, there are no successful cases in this CORS, so we should solve this problem! Must also have the same user also needs this function use! Can someone else help me find this problem? Why does web services not support CORS

(10 Jan '20, 06:47) mfkpie8

I can invite you to use the TeamViewer remote tool to assist in debugging

(10 Jan '20, 06:50) mfkpie8
1

Don't get me wrong but I'm just another customer so that's certainly no way for me to help.

(10 Jan '20, 07:49) Volker Barth

Thank you very much for your help. I will continue to test the research of this function, find problems and share them with all!

(11 Jan '20, 00:03) mfkpie8
1

See the comments and the linked discussions above...

In my limited understanding, "a preflight request" is an OPTIONS request, and your web service does not support that method (as that is not allowed by default) and therefore returns 404.

I guess you will at least have to add something like

METHODS '*,OPTIONS'

or

METHODS 'POST,GET,HEAD,OPTIONS'

(and possibly PUT and DELETE) to your create service statement.

Aside: I can't tell whether you will have to modify the stored procedure called by the web service but I assume that it would not be able to handle modifying requests like POST or PUT.

(15 Jan '20, 07:47) Volker Barth
Comment Text Removed
showing 2 of 9 show all flat view

I finally found the problem

It turns out it's in Ajax

contentType: "multipart/form-data",

It's OK to set it as this. Thank all the help people and the posts in the forum,

ASA is a powerful database.

permanent link

answered 16 Jan '20, 01:00

mfkpie8's gravatar image

mfkpie8
273667075
accept rate: 12%

1

Well, if you have fully answerred your question, then please "accept" your answer (i.e. click on the check mark) to mark it as solved...

(16 Jan '20, 03:42) Volker Barth
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:

×22

question asked: 09 Jan '20, 23:21

question was seen: 1,733 times

last updated: 29 Dec '20, 06:14