从VB6代码调用Web服务导致“请求格式无效”系统错误

时间:2010-07-07 15:43:42

标签: vb6 web-services

这是我的代码

Private Sub PassTXrecordtoGP(ByVal sopNum As String, ByVal WOnum As String, ByVal mustNumb As String)
Dim objXMLHTTP As MSXML2.XMLHTTP60
Dim sURL As String
Dim i As Integer

i = 1
For i = 1 To 3

If (Len("" & sopNum) = 0) Or (Len("" & WOnum) = 0) Or (Len("" & mustNumb) = 0) Then Exit For
sURL = "http://192.168.214.111/webservice/integration.asmx/PreauthMode2?WOnum=" & WOnum & "&masterNumber=" & mustNumb & "&invoiceNumber=" & sopNum
Set objXMLHTTP = New MSXML2.XMLHTTP60
objXMLHTTP.Open "POST", sURL, False

objXMLHTTP.Send

If InStr(1, objXMLHTTP.responceText, "success") > 0 Then   'webservice call is successful, No need to try 3 more times!
    Set objXMLHTTP = Nothing
    Exit For
Else
    Set objXMLHTTP = Nothing
    GoToSleep 2     'wait for 2 seconds and then retry again!
End If

这是一个错误:

System.InvalidOperationException: Request format is invalid: .
at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
status = 500: "Internal Server Error"

我做错了什么?感谢大家的帮助。

1 个答案:

答案 0 :(得分:0)

听起来这是服务器端的问题。要么您的地址错误,要么服务器不知道如何回复您的请求,因为您发送的参数无效。

尝试“获取”而不是“发布”,因为您通过查询字符串发送参数。

http://www.checkupdown.com/status/E500.html