Cannot place bet with XML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jonnyknowsbest
    Junior Member
    • Mar 2009
    • 3

    #1

    Cannot place bet with XML

    I am trying to place abet using the following URL https://api.games.betfair.com/rest/v1/bet/order?, but no matter what XML i pass in the request, i keep getting "Premature end of file" errors in the XML response.

    Can someone post some sample VB / XML that i can have a look at for passing XML to place a bet

    Cheers
  • Mr Stokes
    BDP Team
    • Oct 2008
    • 6

    #2
    Cannot place bet with XML

    Hi Jonny,

    Here is an XML sample for a successful bet order request:

    https://api.games.betfair.com/rest/v...ame=sampleuser


    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <postBetOrder xmlns="urn:betfair:games:api:v1"
    marketId="18224952" round="3" currency="GBP">
    <betPlace>
    <bidType>BACK</bidType>
    <price>2.5</price>
    <size>2.00</size>
    <selectionId>658440</selectionId>
    </betPlace>
    </postBetOrder>

    Comment

    • jonnyknowsbest
      Junior Member
      • Mar 2009
      • 3

      #3
      It is still failing with "Premature End of File". This is my XML request:

      <?xml version="1.0" encoding="UTF-8"?>
      <postBetOrder xmlns="urn:betfair:games:api:v1"
      marketId="18246486" round="1" currency="GBP">
      <betPlace>
      <bidType>LAY</bidType>
      <price>4.02</price>
      <size>2.00</size>
      <selectionId>658441</selectionId>
      </betPlace>
      </postBetOrder>

      And this is how the XML is wrapped up in VB:

      Dim Postdata As String = "<?xml version=""1.0"" encoding=""UTF-8""?>" & vbCrLf
      Postdata = Postdata & "<postBetOrder xmlns=""urn:betfair:games:api:v1"" " & vbCrLf
      Postdata = Postdata & "marketId=""" & lblMarketID.Text & """ round=""1"" currency=""GBP"">" & vbCrLf
      Postdata = Postdata & "<betPlace>" & vbCrLf
      Postdata = Postdata & "<bidType>LAY</bidType>" & vbCrLf
      Postdata = Postdata & "<price>4.02</price>" & vbCrLf
      Postdata = Postdata & "<size>2.00</size>" & vbCrLf
      Postdata = Postdata & "<selectionId>658441</selectionId>" & vbCrLf
      Postdata = Postdata & "</betPlace>" & vbCrLf
      Postdata = Postdata & "</postBetOrder>" & vbCrLf

      Any ideas? This is really frustrating

      PS-i have tried without the vbCrLf's too.

      Cheers

      Jonny

      Comment

      • JosTheelen
        Junior Member
        • Apr 2009
        • 1

        #4
        Is that price 4.02 allowed?

        Comment

        • Mr Stokes
          BDP Team
          • Oct 2008
          • 6

          #5
          Hi Jonny,

          Yes, a price of 4.02 is allowed.

          A few factors that may cause this error:

          1. You have specified incorrect value for the ‘content-length’ in the header
          2. You have specified one ‘content-type’ in the header and sent the data as a different ‘content-type’.
          3. You are behind a proxy that has changed the original request in some way.

          If you can provide full details of the HTTP request including the headers this may help to identify the problem.

          Comment

          • Stuffe
            Junior Member
            • Apr 2011
            • 1

            #6
            I too am having this problem. (I posted it in the Ruby section)

            I believe am doing all the things you are pointing out correctly, Stokes.

            Comment

            Working...
            X