Friday, April 1, 2011
Tuesday, March 29, 2011
REST WCF
if your have the following function in WCF. You will need the following input.
[WebInvoke(UriTemplate = "testFunction", Method = "POST",
ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped,
RequestFormat =
WebMessageFormat.Json)]
public string testFunction(string test)
{
Expected Header
User-Agent: Fiddler
Host: localhost:5810
Content-Length: 15
Content-Type: application/json
INPUT:
{"test":"1234"}
OUTPUT:
{"testFunctionResult":"hi, 3\/29\/2011 10:46:56 PM 1234"}
You can make use of fiddler to send http post request. This illustrated the WCF REST function with JSON input and output.
[WebInvoke(UriTemplate = "testFunction", Method = "POST",
ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped,
RequestFormat =
WebMessageFormat.Json)]
public string testFunction(string test)
{
Expected Header
User-Agent: Fiddler
Host: localhost:5810
Content-Length: 15
Content-Type: application/json
INPUT:
{"test":"1234"}
OUTPUT:
{"testFunctionResult":"hi, 3\/29\/2011 10:46:56 PM 1234"}
You can make use of fiddler to send http post request. This illustrated the WCF REST function with JSON input and output.
Thursday, March 24, 2011
json framework
Simple step to teach you how to implement json framework to parse json string
Example
HTTP POST Restful
NSDictionary *data = [[NSDictionary alloc] initWithObjectsAndKeys:
username, USERNAMEKEY,
password, PASSWORDKEY,
nil];
SBJsonWriter *json = [SBJsonWriter alloc];
NSString *jsonString = [json stringWithObject:data];
NSLog(jsonString);
[data release];
[json release];
//create/send http post request
NSData *postData = [jsonString dataUsingEncoding:NSASCIIStringEncoding];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:@"http://abc.appspot.com/api/login/"]];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
Full article
Example
HTTP POST Restful
NSDictionary *data = [[NSDictionary alloc] initWithObjectsAndKeys:
username, USERNAMEKEY,
password, PASSWORDKEY,
nil];
SBJsonWriter *json = [SBJsonWriter alloc];
NSString *jsonString = [json stringWithObject:data];
NSLog(jsonString);
[data release];
[json release];
//create/send http post request
NSData *postData = [jsonString dataUsingEncoding:NSASCIIStringEncoding];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:@"http://abc.appspot.com/api/login/"]];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
Full article
Wednesday, March 23, 2011
Tuesday, December 14, 2010
Turn on Friendly URL
In the file /config/UrlRewriting.config one can place rules for rewriting URLs. Just add a rule like this.
virtualUrl="^~/blog/tag/(.*).aspx"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/blog.aspx?filterBy=$1"
ignoreCase="true"
/>
Refer to this post for more info.
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/blog.aspx?filterBy=$1"
ignoreCase="true"
/>
Refer to this post for more info.
Thursday, October 14, 2010
worldpay integration
The tricky part of the worldpay integration is about the redirecting. There is no way for you to specify where to redirect the user to a destinate page when the payment is completed.
Instead worldpay use the concept of proxy calling, which will call you page indirectly, in fact it is the Payment Response URL that you specify in installations after you login to worldpay page.
IF you didnt set the checkbox for [Enable the Shopper Response], user will not see the redirect.
In conclusion, the trick is to use point the Payment URL to PAGE A, then in PAGE A you include
< meta http-equiv=' refresh ' content=" 0 ; url = http://YOUR FINAL URL" / >
You will show you thank you message in your final URL.
Last point is to make sure you captured the transaction information that pass to you from worldpay in the Payment Response URL page.
Refer to this article http://harrybailey.com/2010/02/worldpay-response-url-shopper-return/.
Instead worldpay use the concept of proxy calling, which will call you page indirectly, in fact it is the Payment Response URL that you specify in installations after you login to worldpay page.
IF you didnt set the checkbox for [Enable the Shopper Response], user will not see the redirect.
In conclusion, the trick is to use point the Payment URL to PAGE A, then in PAGE A you include
< meta http-equiv=' refresh ' content=" 0 ; url = http://YOUR FINAL URL" / >
You will show you thank you message in your final URL.
Last point is to make sure you captured the transaction information that pass to you from worldpay in the Payment Response URL page.
Refer to this article http://harrybailey.com/2010/02/worldpay-response-url-shopper-return/.
Subscribe to:
Posts (Atom)