Converting C# source code

See working C# solution attached.

How do you convert this code to use with outsystems?
by not looking at the code:

make an extension out of it.
find which methods you want to make public and work with that.

Hi Robert,

With a quick glance at your code, it seems to me that the best way to use your code is to place the OAuth.Net.Examples.EchoServiceProvider namespace in an OutSystems extension (with its dependencies to OAuth.Net.Common and OAuth.Net.ServiceProvider).

In that extension, you can then design an API (in Integration Studio) that makes available actions to the OutSystems eSpaces. For example you could create a BuildEchoCallUri action in the extension that receives a record list of a structure with a Key and Value fields and returns theresulting URI as a text - in its c# implementation, this action would use the needed OAuth.Net.Examples.EchoServiceProvider functionalities.

I realized that you use static variables in some of your classes. Please be aware that this kind of variables can cause problems in multiple server environments (web farms) due to the fact that you will have an instance of the static variable on each of the servers (this is a comment that is not directly related with OutSystems, it is bound to web programming on any technology).

I hope this helps,

Best Regards,

Daniel Lourenço
Hi Daniel

Ok understood.

I got two questions...

1 - How do you perform the following HTTP Request using outsystem's HTTPRequest Extension.

POST /photos?size=original&file=vacation.jpg HTTP/1.1
Authorization: OAuth realm="",

2 - what about reading this http request?

Hi Robert,

Were you able to solve this? I will give my ideas on your questions below.

1) There is PostRequest_Submit action in the HTTPRequestHandler extension, but I do not think you can write the POST request you have shown using it. This because the PostRequest_Submit action always adds the content-type: application/x-www-form-urlencoded header and you do not have a way to add headers to the POST request (you need to add the OAuth realm header). I think in your case the best thing to do is to create a new extension with the code that writes your post request - it would be fairly easy to do it, just create a new extension, copy the .Net implementation of the MssPostRequest_Submit action of the HTTPRequestHandler extension and create a similar one with your particularities.

2) I made a test and you can read a POST request content with the action GetRequestContent on the HTTPRequestHandler extension. Create an OutSystems entry point (eg. named ReadPost) in a Web Flow that goes to a blank screen. In the preparation of this screen, use the GetRequestContent to get the content of any POST requests made to ReadPost.aspx). You can use the IncludeHeaders parameter of the GetRequestContent action to determine if you want to read the headers too.

I hope this information helps.

Best Regards,

Daniel Lourenço


Hi Daniel

Not yet, have started..
Oauth Specifications

You are right Daniel, it seems like the best way to implement Oauth is via an extension. 

All sorted.

Thank you.
Hi Robert. Thanks for the reply.
I'm glad I could help!

Daniel Lourenço
Is it possible to remove all page content and leave only the following line


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" >
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" /><meta http-equiv="Content-Style-Type" content="text/css" /> <link href="web.css?9" type="text/css" rel="stylesheet" />
<script src="_osjs.js?5_0_2_6" type="text/javascript" charset="UTF-8"></script>

<form name="WebForm1" method="post" action="GetRequestToken.aspx?_ts=634037659220906837" id="WebForm1">
<input type="hidden" name="__OSVSTATE" id="__OSVSTATE" value="]/wEPZA8FCy0xNDk1MzQ2MzI2ZA==" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="" />


<script type="text/javascript">
var OsPage_Validators = new Array({});
You can use the TextToBinaryData action in the BinaryData extension (which is shipped within the Enterprise Manager solution). All you have to do is convert the text you want your screen to output into the binary type, and pass it on as File Contents to a Download node, setting save to disk as No.