List Info

Thread: ASP.net integration error




ASP.net integration error
country flaguser name
United States
2007-08-01 12:18:50
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-integrationgooglegroups.com
To unsubscribe from this group, send email to
google-checkout-api-integration-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/google-checko
ut-api-integration?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: ASP.net integration error
country flaguser name
United States
2007-08-01 23:13:13
This thread talks about your issue:

http://groups.google.com/group/google-check
out-api-dotnet/browse_thread/thread/c209f0217e32fba6/3ade65a
12297c3d5#3ade65a12297c3d5

Joe

On Aug 1, 1:18 pm, Capture <d...decodestudios.co.uk>
wrote:
> 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-integrationgooglegroups.com
To unsubscribe from this group, send email to
google-checkout-api-integration-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/google-checko
ut-api-integration?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )