How to generate server response to submission

Hi,

I guess this is a common question but I can't find an answer that
works, let alone documentation.

I'm trying to integrate ODK Collect with my own server and I can
process the submission pretty easily, but I don't know how to respond
so that the client doesn't think that the submission has failed.

How should I build an "OK" response from the server?

I have found a pretty clear answer but I guess it is not up to date to
the current version of ODK Collect because it does not work
http://groups.google.com/group/opendatakit/browse_thread/thread/ff7f184b5b2d4eeb/0f3df9b28f0340d4?lnk=gst&q=submission+response#0f3df9b28f0340d4

According to this you simply have to generate a 201 http response with
a Location header pointing to a location within the same server, but
that doesn't work.

Thanks
m.

How should I build an "OK" response from the server?

Ok never mind, I just changed the location header to "http://" and it works.

According to the post I was referring to:

http://groups.google.com/group/opendatakit/browse_thread/thread/ff7f184b5b2d4eeb/0f3df9b28f0340d4?lnk=gst&q=submission+response#0f3df9b28f0340d4

"You MUST add a "Location" header
This location header MUST be part of the url that ODK submitted to. (If
you're sneaky you can always just set the Location header to "h", "t",
"p",
":", or ".", but you should probably use the real server location in case
ODK decides to change this on you.)

Well the real server location doesn't work, "http://" does.

··· On 09/23/2011 08:29 PM, Matteo Sisti Sette wrote:

The Location header is expected to be a fully-formed URL (e.g.,
http://www.opendatakit.appspot.com).

Collect looks for a matching prefix of this header. So if your server will
be running with HTTPS, you'd need to return "https://"

Mitch

··· On Fri, Sep 23, 2011 at 11:37 AM, Matteo Sisti Sette < matteosistisette@gmail.com> wrote:

On 09/23/2011 08:29 PM, Matteo Sisti Sette wrote:

How should I build an "OK" response from the server?

Ok never mind, I just changed the location header to "http://" and it
works.

According to the post I was referring to:

http://groups.google.com/**group/opendatakit/browse_**thread/thread/**

ff7f184b5b2d4eeb/**0f3df9b28f0340d4?lnk=gst&q=submission+response#
0f3df9b28f0340d4http://groups.google.com/group/opendatakit/browse_thread/thread/ff7f184b5b2d4eeb/0f3df9b28f0340d4?lnk=gst&q=submission+response#0f3df9b28f0340d4

"You MUST add a "Location" header
This location header MUST be part of the url that ODK submitted to. (If
you're sneaky you can always just set the Location header to "h", "t",
"p",
":", or ".", but you should probably use the real server location in case
ODK decides to change this on you.)

Well the real server location doesn't work, "http://" does.

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@**googlegroups.comopendatakit%2Bunsubscribe@googlegroups.com
Options: http://groups.google.com/**group/opendatakit?hl=enhttp://groups.google.com/group/opendatakit?hl=en

--
Mitch Sundt
Software Engineer
http://www.OpenDataKit.org
University of Washington
mitchellsundt@gmail.com

Well my server was http://www.example.com/SOMETHING/odk and I was
returning the header "Location: http://www.example.com/SOMETHING/odk"
and Collect complained that submission failed. Now I am returning the
header "http://" and it says submitted succesfully.

I'm not using https

··· On 09/23/2011 08:47 PM, Mitch Sundt wrote: > The Location header is expected to be a fully-formed URL (e.g., > http://www.opendatakit.appspot.com). > > Collect looks for a matching prefix of this header. So if your server > will be running with HTTPS, you'd need to return "https://"

You also need to make sure that you send a 201 code (not 200, as you might
otherwise expect).

--Christopher

··· On Fri, Sep 23, 2011 at 3:10 PM, Matteo Sisti Sette < matteosistisette@gmail.com> wrote:

On 09/23/2011 08:47 PM, Mitch Sundt wrote:

The Location header is expected to be a fully-formed URL (e.g.,
http://www.opendatakit.**appspot.com http://www.opendatakit.appspot.com
).

Collect looks for a matching prefix of this header. So if your server
will be running with HTTPS, you'd need to return "https://"

Well my server was http://www.example.com/**SOMETHING/odkhttp://www.example.com/SOMETHING/odkand I was returning the header "Location:
http://www.example.com/**SOMETHING/odkhttp://www.example.com/SOMETHING/odk"
and Collect complained that submission failed. Now I am returning the header
"http://" and it says submitted succesfully.

I'm not using https

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@**googlegroups.comopendatakit%2Bunsubscribe@googlegroups.com
Options: http://groups.google.com/**group/opendatakit?hl=enhttp://groups.google.com/group/opendatakit?hl=en

--
Christopher Swenson
cswenson@google.com

Yes, that's what I'm doing (otherwise, it wouldn't work even with
location "http://")

I suspect that maybe the location url must be STRICTLY a substring of
the server url, but not the whole server string itself?

··· On 09/23/2011 09:55 PM, Christopher Swenson wrote: > You also need to make sure that you send a 201 code (not 200, as you > might otherwise expect).

I suspect that maybe the location url must be STRICTLY a substring of
the server url, but not the whole server string itself?

No, the only thing that works is just "http://" or any substring of it,
i.e.:
Location: http://
Location: http:/
Location: htt
Location: h
Location: tp

All these work.

However, I tried:
Location: http://www.myserver.com/myfolder
Location: http://www.myserver.com/
Location: http://www.myserver.com
Location: http://myserver.com
Location: www.myserver.com
Location: http://www
Location: hgf

NONE of these work - where the server url in the settings is
http://www.myserver.com/myfolder

··· On 09/23/2011 10:48 PM, Matteo Sisti Sette wrote: