am having a probelm in the http post to the google sandbox
i am getting an erro that i am not autherised am i sending
the
information to google correct
public static string httpPost(string xmlPost)
{
//get merchant id
string merchant = merchId().ToString();
// Create a request for the URL.
string urlReq = ("https://s
andbox.google.com/checkout/cws/v2/
Merchant/" + merchant +
"/merchantCheckout");
// make the request
HttpWebRequest req =
(HttpWebRequest)WebRequest.Create(urlReq);
req.Method = "POST";
//set the content type
req.ContentType =
"application/xml;charset=UTF-8";
//do the Basic Authentication bit
byte[] bytesBuff =
Encoding.UTF8.GetBytes((gCheckout.merchId()
+ ":" + gCheckout.baseCode()));
string strHeaderEnc =
Convert.ToBase64String(bytesBuff);
//create a string with the Basic Auth at the top
then folloed
by the generated XML
string strPost = ("Authorization: Basic "
+ strHeaderEnc +
xmlPost);
//Send the request to Google and get the response
StreamWriter streamOut = new
StreamWriter(req.GetRequestStream());
streamOut.Write(strPost);
streamOut.Close();
StreamReader streamIn = new
StreamReader(req.GetResponse().GetResponseStream());
string strResponse = streamIn.ReadToEnd();
streamIn.Close();
return strResponse;
}
Anyone got an idea??
Thanks
Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "API Integration Basics" group.
To post to this group, send email to
google-checkout-api-integration googlegroups.com
To unsubscribe from this group, send email to
google-checkout-api-integration-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/google-checko
ut-api-integration?hl=en
-~----------~----~----~----~------~----~------~--~---
|