400 Bad Request

S

Scott

I create a proxy class and instantiate it, then I try to make multiple
calls to the methods of the class. 75% of the time, all of the 7
calls work great, but 1 in 4 times one of the calls fails with 400 Bad
Request. In each call, I am loading a dataset and sending it to the
webservice.

I have tried numerous solutions here....
1. Originally, I started my application and instantiated my object
once and then, I would call the methods one by one. I received the
error here (25% of the time).
2. I then decided to start the application and dispose of the object
before making each call and "new" the object again. I still received
the error (25% of the time)
3. I then decided to start the application and create a completely
new object for each call in attempt to circumvent the error, but it
still appears 25% of the time.
4. Lastly, I tried starting my application and only making one call
each time the application runs. This worked beautifully, and no
errors have been received.


Here is my code (from #3 above):

try

For Each myTable In dsBuildout.Tables
strTableName = myTable.TableName()


If strTableName = "seats" And retval = 0 Then

If dsBuildout.Tables("seats").Rows.Count > 0 Then

tbTemp = dsBuildout.Tables("seats").Copy()
dsTemp.Tables.Add(tbTemp)

Dim obj1 As New WebNetApp.WebReference.CBPS
obj1 = New WebNetProcessApp.WebReference.CBPS
obj1.PreAuthenticate = True
obj1.Credentials = New
System.Net.NetworkCredential("uuu", "ppp")
obj1.Timeout = 300000

retval = obj1.ProcS(dsTemp, x, y, z, "seats",
dsBuildout.Tables("seats").Rows.Count)
iDataSetCount += 1

End If

End If

..... call more methods here the same as above and below ....


If strTableName = "options" And retval = 0 Then

If dsBuildout.Tables("options").Rows.Count > 0
Then

tbTemp.Clear()
tbTemp = dsBuildout.Tables("options").Copy()
dsTemp.Tables.Add(tbTemp)

Dim obj2 As New
WebNetProcessApp.WebReference.CBPS
obj2 = New WebNetProcessApp.WebReference.CBPS
obj2.PreAuthenticate = True
obj2.Credentials = New
System.Net.NetworkCredential("uuu", "ppp")
obj2.Timeout = 300000

retval = obj2.ProcessSeats(dsTemp, x, y, z,
"options", dsBuildout.Tables("options").Rows.Count)
iDataSetCount += 1

End If

End If


catch



end try


If it was on the same call every time I run through my code, I could
narrow it down, but it's sporadic.


My only guess is that I'm running framework 1.1 and the webservice I'm
calling is using 1.0. This is the only thing I can think of that
would cause the problem...I'm sending from an asp.net application and
also a windows application and both act the same.
 
D

Dan Rogers

Hi Scott,

This is a know issue with the generated proxy code. The issue is related
to the keep-alive connection timing out, and the proxy not knowing about
it. A work around is to disable keep-alives on your proxy. The proxy
class has a property that controls this. If you set it to false, this
sporadic failure should cease. The trade-off here is that each request
will instantiate a full setup-call-teardown connection cycle.

I hope this helps

Dan Rogers (danro)
Microsoft Corporation
--------------------
 
S

Scott

I put the keep-alive fix in, but it didn't work for me. I also
unchecked the keep-alive box within IIS for the website. No luck. It
seems that this solution is posted everywhere, so I would think that
it would fix it. Could anything else cause the error, such as a
timeout???
 
D

Dan Rogers

Hi Scott,

I sent you an email with some thoughts on measurements to take. The thing
that is unique about your situation is the error is 400 - which is an HTTP
server error, and not a SOAP error. I went back and looked into the
specifics of the keep-alive recommendation and that is intended to address
an issue in the proxy that surfaces the symptom "the underlying connection
was closed" as the error. A 400 error (bad request) may indicate that the
request is arriving mangled.

Dan Rogers
Microsoft Corporation
--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,161
Latest member
GertrudeMa
Top