Pls help. Portfolio add -> (400) Bad Request

35 views
Skip to first unread message

VPN

unread,
Nov 7, 2008, 8:42:16 AM11/7/08
to Google Finance APIs and Tools, sala...@gmail.com
Ref: http://code.google.com/apis/finance/developers_guide_protocol.html

The Create Portfolio is resulting in a :-
"{"The remote server returned an error: (400) Bad Request."}"
exception - For the .NET client library.

Other like retrieval operations works perfectly fine.

What am I doing wrong?. Please guide.
Thanks in Advance.

Doug Chimento

unread,
Nov 7, 2008, 11:48:57 AM11/7/08
to google-fi...@googlegroups.com
Can you provide the XML you are sending to the google servers?

SB

unread,
Nov 8, 2008, 4:01:24 AM11/8/08
to Google Finance APIs and Tools
The XML I am sending to the URL is

<entry>
<title type='text'>A New Portfolio</title>
<gf:portfolioData currencyCode='USD'/>
</entry>




String strATOMRequestBody = HttpUtility.UrlEncode("<entry xmlns:gf=
\"http://schemas.google.com/finance/2007\" >" +
"<title type=\"text\">A New Portfolio</title>" +
"<gf:portfolioData currencyCode=\"USD\"/ >" +
"</entry>", Encoding.UTF8);
> > Thanks in Advance.- Hide quoted text -
>
> - Show quoted text -

Doug Chimento

unread,
Nov 8, 2008, 3:57:11 PM11/8/08
to google-fi...@googlegroups.com
That doesn't look like the correct atom format.
It should be something like
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom">
<atom:category term="http://schemas.google.com/finance/2007#portfolio"
scheme="http://schemas.google.com/g/2005#kind"/>
<atom:title type="text">test</atom:title>
<gf:portfolioData xmlns:gf="http://schemas.google.com/finance/2007"
currencyCode="USD"/>
</atom:entry>

salaja K Balakrishnan

unread,
Nov 9, 2008, 6:10:02 AM11/9/08
to google-fi...@googlegroups.com, vin...@gmail.com
I am using the atom format you have send and I still get the same error. Please find attached the code to generate the Portfolio.
 
When trying to get webrequest.GetRequestStream() the following stack is shown:
 
-  stOut {System.Net.ConnectStream} System.IO.Stream {System.Net.ConnectStream}
+  [System.Net.ConnectStream] {System.Net.ConnectStream} System.Net.ConnectStream
+  base {System.Net.ConnectStream} System.MarshalByRefObject {System.Net.ConnectStream}
  CanRead false bool
  CanSeek false bool
  CanTimeout true bool
  CanWrite true bool
-  Length 'stOut.Length' threw an exception of type 'System.NotSupportedException' long {System.NotSupportedException}
+  base {"This stream does not support seek operations."} System.SystemException {System.NotSupportedException}
-  Position 'stOut.Position' threw an exception of type 'System.NotSupportedException' long {System.NotSupportedException}
+  base {"This stream does not support seek operations."} System.SystemException {System.NotSupportedException}
  ReadTimeout 300000 int
  WriteTimeout 300000 int
+  Static members  
+  Non-Public members  
 
Please guide.
 
Thanks,
 
SB
CreatePortfolio.txt

salaja K Balakrishnan

unread,
Nov 9, 2008, 8:05:55 AM11/9/08
to google-fi...@googlegroups.com, vin...@gmail.com
Thanks for the help, it works now.
Reply all
Reply to author
Forward
0 new messages