Forum Discussion
Resuming an articulate story
This is an old thread, but I am revisiting it now since we finally need this capability. I have this method which is called if I have chosen the resume option in my Articulate story:
[OperationContract, WebInvoke(Method = "*", UriTemplate = "{appId}/activities/state", ResponseFormat = WebMessageFormat.Json)]public void activitiesstate(string appId, Stream theStream)
With this code:
var method = WebOperationContext.Current.IncomingRequest.Method;string m = method.ToString();
I can tell whether it's a GET or a PUT. The framework seems fine -- GET only happens when the course is started, and for every question, I see a PUT, and the parameter "theStream" has the resume data, so I store it. On the next GET, when I resume the course, I read that data. It is not working.
My questions come from these statements from a couple of other related posts:
https://community.articulate.com/discussions/articulate-storyline/resume-tin-can-state
https://community.articulate.com/discussions/articulate-storyline/resuming-an-articulate-story#reply-737844
The first one has this statement:
You just need to save the "Content" string which is the bookmark. And then when its requesting that info back, just return that content string by itself and Articulate will resume to that specific spot it saved at.
I'm sure this advice is correct, but I'm not sure how to implement this. How do I just return that content string by itself? The method is a void, which I assume the Tin Can framework wants.
The second one has this statement:
Frank, just return that content parameter by itself. So its a json return that should just say 2h145040981001111000$Xa91010310103xe1C1414e720118_default1414e770158_default00010000 Or whatever your bookmark looks like
Again, how do I just return that content parameter by itself?
Should the code for GET send this data back? Like I said, the activitiesstate method is a void. I figured if maybe the GET sent this data back, that when the statements method executes, it would go to the place I want to resume. But I don't know how to send it back.
I do this in the GET code. resumeData has the proper string.
WebOperationContext.Current.OutgoingRequest.ContentType = "application/octet-stream"; WebOperationContext.Current.OutgoingResponse.ContentLength = resumeData.Length;
I read that I need to set the ContentType to application/octet-stream.
But this doesn't work yet. Perhaps I need another line of code to include that data? I don't quite see how to do that, and since the method is a void, I can't return anything.
Or am I totally off about how this is supposed to work? I guess my question is:
What do I do in the GET part of this code to get this to work?
Thanks
Related Content
- 11 months ago