Can I consume a Restful web service that needs to post a XML file? I like to call a Redmine web service to register hours for a project. I need to call a web service described in this url: http://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries How do I pass the needed XML string to the web service?

Tia Hans

asked 17 Feb '14, 10:32

HansTSD's gravatar image

HansTSD
1304813
accept rate: 50%

1

Would you please explain how your question is related to SQL Anywhere (that's what this forum is about)?

(17 Feb '14, 13:06) Reimer Pods

I like to call a web service with SQL Anywhere, to send data from our database to Redmine. In a way like this: CREATE PROCEDURE "DBA"."zz_redmine_test"(IN as_xml XML) URL 'http://xxxx:yyyy@pj.tsd.nl:1443/redmine/time_entries.xml' TYPE 'HTTP:POST'

I used that for retrieving Google Maps locations and other web sites also. But now I have to Post a web service that needs a set of XML data.

(18 Feb '14, 04:02) HansTSD
Replies hidden

Have you had a look at that doc page on web client functions and POST requests:

Web service request types

(18 Feb '14, 04:23) Volker Barth

Yes I did. But I do know how to call a service of Redmine, see my original post. I need to create time entries an therfore need to Post a time_entries.xml. No idea if is possible with SA..?

(18 Feb '14, 04:32) HansTSD

I solved the problem as follows. Maybe somebody else can us this in the future.

CREATE PROCEDURE "DBA"."zz_redmine_test"(IN "time_entries.xml" LONG VARCHAR)
URL 'https://bb<--My API key-->>ca:pwd@pj.tsd.nl:1443/redmine/time_entries.xml'
CERTIFICATE 
'CERT=-----BEGIN CERTIFICATE-----
MIIE7zCCA9egAwIBAgIQJYaVVWDj......
......
-----END CERTIFICATE-----'
TYPE 'HTTP:POST:text/xml'

CALL "DBA"."zz_redmine_test" 
('<time_entry>
<issue_id>1139</issue_id>
<activity_id>9</activity_id>
<hours>1.0</hours>
<comments>Testfall</comments>
<spent_on>2012-02-16</spent_on>
</time_entry>')
permanent link

answered 18 Feb '14, 09:02

HansTSD's gravatar image

HansTSD
1304813
accept rate: 50%

edited 18 Feb '14, 09:17

Volker%20Barth's gravatar image

Volker Barth
29.6k294444650

Glad you got it working!

Apparently, you could use SQL Anywhere's XML features / XML datatype to construct the XML object instead of building it "manually"...

(18 Feb '14, 09:18) 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:

×19

question asked: 17 Feb '14, 10:32

question was seen: 874 times

last updated: 18 Feb '14, 09:24