StefanE
StefanE

Reputation: 7630

Webservice respond with 400 Bad Request

I have a standard webservice in ASP .Net 4.0 defined like this:

       [WebMethod]
        public string MyWebServiceRequest(string data)
        {
           //Code
        }

The size of the string is about 10K Bytes and when trying to send to this webservice I get a 400 Bad Request. If I just send a few lines it works fine.

As I know the default max size is about 65KB or am I wrong? I get no good errors in the eventviewer and so on. Is there a way of force logging of errors for webservices?

Update: Is there any restrictions what you are allow to have in the string if that could cause my problem?

Here is my request with the actual data I'm trying to send. Just as a note I have managed to get it be sent by deleting one of the lines and I can't see why this line would fail the request.

Score Lines then - Is Arrow, NS Pair, EW Pair, NS Score, Round
            NoSlam Tricks(+ or -, 6 or 7), Points NS & EW, Adjustments NS &
            EW, Penalties NS & EW, Contract, By, TricksMade, Lead,
            Table,Spare

The whole XML request

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soap12:Envelope xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
    <soap12:Body>
        <tns:xTournamentResultDatFile
            xmlns:tns="http://www.mywebsite.com/">
            <!-- Zero or one occurrences -->
            <tns:datFile>
                Version,8 ID1 - Type, Date Serial, Description, Section, Web
                File Name, Sessions P,40805,,,2011sep19.htm,1 ID2 - BridgeMate,
                IsStratified, 3x spares 0,0,0,0,0 Profile Tables, NTotal,
                ETotal, Pairs, Is 2 Winners, Min Details, ScoreMethod, Color
                5,5,5,10,-1,0,0,0 Swiss, E_Individual,Teams BPM Stored,0,0,0 Is
                VPs, VPs are Stored, Is Teams Travellers 0,0,0 Is Done -
                Movement, Tables, Sheets -1,-1,-1 Teams Entered as Imps, Teams
                Boards, Boards Per Set,-1,25,5 Results - pair number then 2 x
                Player Nos, Score, G Slams, S Slams Master Points, Orientation,
                Score, Score Divisor,Handicap, 2 x Player Names,Green Points
                Score Lines Count,Green Point, Is Handicapped, V3,10,0,0
                3,9,10,5400,0,0,25,N,108,200,0,Player Nine,Player Ten 0
                2,5,6,5050,0,0,10,N,101,200,0,Player Five,Player Six 0
                5,17,18,5050,0,0,10,N,101,200,0,Player Seventeen,Player Eighteen
                0 1,1,2,5000,0,0,0,N,100,200,0,Player One,Player Two 0
                4,13,14,4500,0,0,0,N,90,200,0,Player Thirteen,Player Fourteen 0
                7,7,8,7000,0,0,25,E,140,200,0,Player Seven,Player Eight 0
                10,19,20,5100,0,0,13,E,102,200,0,Player Nineteen,Player Twenty 0
                9,15,16,4700,0,0,0,E,94,200,0,Player Fithteen,Player Sixteen 0
                6,3,4,4250,0,0,0,E,85,200,0,Player Three,Player Four 0
                8,11,12,3950,0,0,0,E,79,200,0,Player Elven,Player Twelwe 0 ESE
                MPs Auto Calc,0 Master Points - Awarded, Printed, e File Serial,
                Serial Start, Hand Title, Spare 10,0,0,0,,S Master Pointing
                Score Level, CBAI Club Factor,1,0 Is a Qualifinal,
                Tables,#FALSE#,0 SABF - Grading, Is Closed, Is Mixed,0,0,0 No
                MPs For Event,0 SMPC Adjustment Method,
                E_ABFRestricted,E_ABFMFactor ,1,0,1 Table Allocations,5 N/S
                Pair, E/W Pair,4 x Player numbers, 2 x Spares 1,6,1,2,3,4,S,S
                2,7,5,6,7,8,S,S 3,8,9,10,11,12,S,S 4,9,13,14,15,16,S,S
                5,10,17,18,19,20,S,S Movement Not New Move, Name,
                Type,-1,Straight Mitchell - Boards Down, Pairs Up,M Board Sets,
                Boards Per Set, Max Rounds, Rounds Missed, Round 1 Not Played
                5,5,5,0,0 Missing Pair No, Missing Pair is NS, Pair Numbers
                Duped, EW Pair No Offset 0,0,-1,5 Is a Rover, Rover Table No,
                Rover Is NS, Standard Rover 0,0,0,0 Feed In Table, Boards Down
                1,0,0 Mitchell Skip Early +4 Spares,0,S,S,S,S Arrow Count,0
                Score Sheets Is NSNumbered, Are Slams, Butler Scoring Exclusions
                -1,0,1 Expected Min Score Lines, SMPC, Max Score Lines 5,-1,5
                Aggregate UpperLimit,1000 Order SS By Score, No Score Check &
                Spare,0,0,S Sheet Count 2,25 Show Contract,spare, spare,0,0,0
                Score Lines then - Is Arrow, NS Pair, EW Pair, NS Score, Round
                NoSlam Tricks(+ or -, 6 or 7), Points NS & EW, Adjustments NS &
                EW, Penalties NS & EW, Contract, By, TricksMade, Lead,
                Table,Spare 5 0,1,1,50,1,0,4,4,-1,-1,0,0,, ,0,,1,0
                0,2,3,100,5,0,7,1,-1,-1,0,0,, ,0,,2,0
                0,3,5,100,4,0,7,1,-1,-1,0,0,, ,0,,3,0
                0,4,2,-420,3,0,1,7,-1,-1,0,0,, ,0,,4,0
                0,5,4,-420,2,0,1,7,-1,-1,0,0,, ,0,,5,0 5
                0,1,1,500,1,0,3,5,-1,-1,0,0,, ,0,,1,0
                0,2,3,500,5,0,3,5,-1,-1,0,0,, ,0,,2,0
                0,3,5,620,4,0,7,1,-1,-1,0,0,, ,0,,3,0
                0,4,2,620,3,0,7,1,-1,-1,0,0,, ,0,,4,0
                0,5,4,-100,2,0,0,8,-1,-1,0,0,, ,0,,5,0 5
                0,1,1,140,1,0,4,4,-1,-1,0,0,, ,0,,1,0
                0,2,3,140,5,0,4,4,-1,-1,0,0,, ,0,,2,0
                0,3,5,140,4,0,4,4,-1,-1,0,0,, ,0,,3,0
                0,4,2,-50,3,0,0,8,-1,-1,0,0,, ,0,,4,0
                0,5,4,170,2,0,8,0,-1,-1,0,0,, ,0,,5,0 5
                0,1,1,-170,1,0,5,3,-1,-1,0,0,, ,0,,1,0
                0,2,3,-170,5,0,5,3,-1,-1,0,0,, ,0,,2,0
                0,3,5,-170,4,0,5,3,-1,-1,0,0,, ,0,,3,0
                0,4,2,-620,3,0,0,8,-1,-1,0,0,, ,0,,4,0
                0,5,4,-170,2,0,5,3,-1,-1,0,0,, ,0,,5,0 5
                0,1,1,600,1,0,3,5,-1,-1,0,0,, ,0,,1,0
                0,2,3,600,5,0,3,5,-1,-1,0,0,, ,0,,2,0
                0,3,5,600,4,0,3,5,-1,-1,0,0,, ,0,,3,0
                0,4,2,600,3,0,3,5,-1,-1,0,0,, ,0,,4,0
                0,5,4,630,2,0,8,0,-1,-1,0,0,, ,0,,5,0 5
                0,1,5,-620,2,0,3,5,-1,-1,0,0,, ,0,,1,0
                0,2,2,-620,1,0,3,5,-1,-1,0,0,, ,0,,2,0
                0,3,4,-600,5,0,7,1,-1,-1,0,0,, ,0,,3,0
                0,4,1,-630,4,0,0,8,-1,-1,0,0,, ,0,,4,0
                0,5,3,-600,3,0,7,1,-1,-1,0,0,, ,0,,5,0 5
                0,1,5,-100,2,0,2,6,-1,-1,0,0,, ,0,,1,0
                0,2,2,-100,1,0,2,6,-1,-1,0,0,, ,0,,2,0
                0,3,4,-100,5,0,2,6,-1,-1,0,0,, ,0,,3,0
                0,4,1,140,4,0,8,0,-1,-1,0,0,, ,0,,4,0
                0,5,3,110,3,0,6,2,-1,-1,0,0,, ,0,,5,0 5
                0,1,5,420,2,0,4,4,-1,-1,0,0,, ,0,,1,0
                0,2,2,420,1,0,4,4,-1,-1,0,0,, ,0,,2,0
                0,3,4,420,5,0,4,4,-1,-1,0,0,, ,0,,3,0
                0,4,1,420,4,0,4,4,-1,-1,0,0,, ,0,,4,0
                0,5,3,420,3,0,4,4,-1,-1,0,0,, ,0,,5,0 5
                0,1,5,420,2,0,1,7,-1,-1,0,0,, ,0,,1,0
                0,2,2,420,1,0,1,7,-1,-1,0,0,, ,0,,2,0
                0,3,4,450,5,0,5,3,-1,-1,0,0,, ,0,,3,0
                0,4,1,450,4,0,5,3,-1,-1,0,0,, ,0,,4,0
                0,5,3,480,3,0,8,0,-1,-1,0,0,, ,0,,5,0 5
                0,1,5,-140,2,0,5,3,-1,-1,0,0,, ,0,,1,0
                0,2,2,-140,1,0,5,3,-1,-1,0,0,, ,0,,2,0
                0,3,4,-170,5,0,2,6,-1,-1,0,0,, ,0,,3,0
                0,4,1,-110,4,0,8,0,-1,-1,0,0,, ,0,,4,0
                0,5,3,-200,3,0,0,8,-1,-1,0,0,, ,0,,5,0 5
                0,1,4,300,3,0,6,2,-1,-1,0,0,, ,0,,1,0
                0,2,1,110,2,0,4,4,-1,-1,0,0,, ,0,,2,0
                0,3,3,1400,1,0,8,0,-1,-1,0,0,, ,0,,3,0
                0,4,5,-50,5,0,1,7,-1,-1,0,0,, ,0,,4,0
                0,5,2,-50,4,0,1,7,-1,-1,0,0,, ,0,,5,0 5
                0,1,4,170,3,0,1,7,-1,-1,0,0,, ,0,,1,0
                0,2,1,170,2,0,1,7,-1,-1,0,0,, ,0,,2,0
                0,3,3,620,1,0,7,1,-1,-1,0,0,, ,0,,3,0
                0,4,5,620,5,0,7,1,-1,-1,0,0,, ,0,,4,0
                0,5,2,600,4,0,4,4,-1,-1,0,0,, ,0,,5,0 5
                0,1,4,-100,3,0,7,1,-1,-1,0,0,, ,0,,1,0
                0,2,1,-100,2,0,7,1,-1,-1,0,0,, ,0,,2,0
                0,3,3,-170,1,0,2,6,-1,-1,0,0,, ,0,,3,0
                0,4,5,-200,5,0,0,8,-1,-1,0,0,, ,0,,4,0
                0,5,2,-140,4,0,4,4,-1,-1,0,0,, ,0,,5,0 5
                0,1,4,500,3,0,5,3,-1,-1,0,0,, ,0,,1,0
                0,2,1,500,2,0,5,3,-1,-1,0,0,, ,0,,2,0
                0,3,3,690,1,0,8,0,-1,-1,0,0,, ,0,,3,0
                0,4,5,420,5,0,1,7,-1,-1,0,0,, ,0,,4,0
                0,5,2,420,4,0,1,7,-1,-1,0,0,, ,0,,5,0 5
                0,1,4,-100,3,0,3,5,-1,-1,0,0,, ,0,,1,0
                0,2,1,140,2,0,7,1,-1,-1,0,0,, ,0,,2,0
                0,3,3,-100,1,0,3,5,-1,-1,0,0,, ,0,,3,0
                0,4,5,140,5,0,7,1,-1,-1,0,0,, ,0,,4,0
                0,5,2,-200,4,0,0,8,-1,-1,0,0,, ,0,,5,0 5
                0,1,3,170,4,0,5,3,-1,-1,0,0,, ,0,,1,0
                0,2,5,170,3,0,5,3,-1,-1,0,0,, ,0,,2,0
                0,3,2,170,2,0,5,3,-1,-1,0,0,, ,0,,3,0
                0,4,4,140,1,0,0,8,-1,-1,0,0,, ,0,,4,0
                0,5,1,170,5,0,5,3,-1,-1,0,0,, ,0,,5,0 5
                0,1,3,450,4,0,5,3,-1,-1,0,0,, ,0,,1,0
                0,2,5,450,3,0,5,3,-1,-1,0,0,, ,0,,2,0
                0,3,2,300,2,0,0,8,-1,-1,0,0,, ,0,,3,0
                0,4,4,420,1,0,2,6,-1,-1,0,0,, ,0,,4,0
                0,5,1,480,5,0,8,0,-1,-1,0,0,, ,0,,5,0 5
                0,1,3,140,4,0,6,2,-1,-1,0,0,, ,0,,1,0
                0,2,5,-110,3,0,1,7,-1,-1,0,0,, ,0,,2,0
                0,3,2,-110,2,0,1,7,-1,-1,0,0,, ,0,,3,0
                0,4,4,140,1,0,6,2,-1,-1,0,0,, ,0,,4,0
                0,5,1,140,5,0,6,2,-1,-1,0,0,, ,0,,5,0 5
                0,1,3,460,4,0,6,2,-1,-1,0,0,, ,0,,1,0
                0,2,5,460,3,0,6,2,-1,-1,0,0,, ,0,,2,0
                0,3,2,430,2,0,1,7,-1,-1,0,0,, ,0,,3,0
                0,4,4,460,1,0,6,2,-1,-1,0,0,, ,0,,4,0
                0,5,1,430,5,0,1,7,-1,-1,0,0,, ,0,,5,0 5
                0,1,3,600,4,0,7,1,-1,-1,0,0,, ,0,,1,0
                0,2,5,-100,3,0,2,6,-1,-1,0,0,, ,0,,2,0
                0,3,2,-100,2,0,2,6,-1,-1,0,0,, ,0,,3,0
                0,4,4,600,1,0,7,1,-1,-1,0,0,, ,0,,4,0
                0,5,1,-100,5,0,2,6,-1,-1,0,0,, ,0,,5,0 5
                0,1,2,110,5,0,6,2,-1,-1,0,0,, ,0,,1,0
                0,2,4,130,4,0,8,0,-1,-1,0,0,, ,0,,2,0
                0,3,1,-170,3,0,2,6,-1,-1,0,0,, ,0,,3,0
                0,4,3,-420,2,0,0,8,-1,-1,0,0,, ,0,,4,0
                0,5,5,-150,1,0,4,4,-1,-1,0,0,, ,0,,5,0 5
                0,1,2,400,5,0,2,6,-1,-1,0,0,, ,0,,1,0
                0,2,4,400,4,0,2,6,-1,-1,0,0,, ,0,,2,0
                0,3,1,430,3,0,7,1,-1,-1,0,0,, ,0,,3,0
                0,4,3,430,2,0,7,1,-1,-1,0,0,, ,0,,4,0
                0,5,5,400,1,0,2,6,-1,-1,0,0,, ,0,,5,0 5
                0,1,2,690,5,0,0,8,-1,-1,0,0,, ,0,,1,0
                0,2,4,990,4,0,4,4,-1,-1,0,0,, ,0,,2,0
                0,3,1,990,3,0,4,4,-1,-1,0,0,, ,0,,3,0
                0,4,3,1010,2,0,8,0,-1,-1,0,0,, ,0,,4,0
                0,5,5,990,1,0,4,4,-1,-1,0,0,, ,0,,5,0 5
                0,1,2,-980,5,0,2,6,-1,-1,0,0,, ,0,,1,0
                0,2,4,-980,4,0,2,6,-1,-1,0,0,, ,0,,2,0
                0,3,1,100,3,0,7,1,-1,-1,0,0,, ,0,,3,0
                0,4,3,-980,2,0,2,6,-1,-1,0,0,, ,0,,4,0
                0,5,5,100,1,0,7,1,-1,-1,0,0,, ,0,,5,0 5
                0,1,2,420,5,0,5,3,-1,-1,0,0,, ,0,,1,0
                0,2,4,420,4,0,5,3,-1,-1,0,0,, ,0,,2,0
                0,3,1,420,3,0,5,3,-1,-1,0,0,, ,0,,3,0
                0,4,3,-50,2,0,0,8,-1,-1,0,0,, ,0,,4,0
                0,5,5,420,1,0,5,3,-1,-1,0,0,, ,0,,5,0 Split Boards - Count and
                Line numbers,0 Section Pairs Count 2,0 Section Count, 2 x
                spares,0,0,0 Sessions Input,0 VP Type,W EBU Green or SBU
                National Points,0 Swiss Pairing,1,2,1,99 Swiss BPM, DualTables,
                Sections, Alloc LPP, SBU Bonus MP Top,7,-1,A,B,10,0 SBU MPs Per
                Match,0 BWS DB File Path, Quali-final is a Final,0 EBU National
                Pairs Heat,0 Deal File
                Path,C:/BridgeData/Test/DealFiles/2011Sep19!!.dup Swiss Pairs
                Match Being Scored,1 Swiss Pair Numbering,0 Swiss Pair Input
                From TS,0 UK MP Multiplier,1 Last Bm Db Line Read,0 Ecats Hand
                Records Needed, Session No,#FALSE#, Tables For MPs,0 Scorers
                Name, Directors Name,xxxx xxxxx,Mr Director Is Parallel Play,0
                Barometer Event,0 MPs Ignore Minimum Boards Rule,0 Reuse Board
                Count,0 Swiss Pairs Rounds,8 PP Event FileName, QualiFinal
                ScaleQF,0 EBU P2P Charge Rate#ERROR 448#
            </tns:datFile>
        </tns:xTournamentResultDatFile>
    </soap12:Body>
</soap12:Envelope>

Upvotes: 0

Views: 3068

Answers (1)

3Dave
3Dave

Reputation: 29041

There's a section in web.config that controls maximum transfer size:

<security>
  <requestFiltering>
   <requestLimits maxAllowedContentLength=”2000000000″ />
  </requestFiltering>
 </security>

But I doubt that's your real problem. Have you tried examining the request in Fiddler to make sure your page is really sending the correct data? A 400 error can mean any number of things, including posting to a misshapen URL (ie, https instead of http, wrong host header, etc).

Comment

While I'm at it, why are you using an XML envelope in this way? If you're going to go through the trouble of using XML/SOAP, why not pass a nicer, XML-friendly dataset (with child nodes, etc)?

Upvotes: 1

Related Questions