1
我開發了一個.vbs來調用SOAP Web服務,如下所示。在執行期間,我得到了錯誤代碼500.如果您以前遇到過這個問題,請分享您的想法。調用帶有參數錯誤代碼的SOAP Web服務:500內部服務器錯誤
我使用Windows 7來執行此文件。
Dim dt
mydt = Now()
mm = add0(Month(mydt))
dd = add0(Day(mydt))
hh = add0(Hour(mydt))
mn = add0(Minute(mydt))
ss = add0(second(mydt))
'WScript.Echo (Year(mydt)) & mm & dd & hh & mm & ss
'short-name: Max 8 char
dt = mm & dd & hh & mm
Function add0 (testIn)
Select Case Len(testIn) < 2
Case True
add0 = "0" & testIn
Case Else
add0 = testIn
End Select
End Function
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "C:\test"
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile In colFiles
strFileName = objFile.Name
If objFSO.GetExtensionName(strFileName) = "xml" Then
strUrl = "http://IP:Server/dummy"
strRequest = "<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/""" &_
" xmlns:v1=""http://crsoftwareinc.com/xml/ns/titanium/newbiz/newbusinessuploadreleaseservice/v1_0""" &_
" xmlns:v11=""http://www.crsoftwareinc.com/xml/ns/titanium/common/v1_0""" &_
" <soapenv:Header>/" &_
" <soapenv:Body>" &_
" <v1:new-business-upload-release-request>" &_
" <v1:new-business-upload-dto>" &_
" <v11:ID>ID="& dt &"</v11:ID>" &_
" <v11:file-name>"& objFile.Name &"</v11:file-name>" &_
" <v11:manual-upload>""false</v11:manual-upload>" &_
" <v11:auto-linking-enabled-flag>""true</v11:auto-linking-enabled-flag>" &_
" <v11:auto-merging-enabled-flag>""true</v11:auto-merging-enabled-flag>" &_
" <v11:strategy-option-choice>""USE_CREDITOR_DEFAULT_STRATEGY</v11:strategy-option-choice>" &_
" <v11:account-strategy-option-choice>""USE_CREDITOR_DEFAULT_STRATEGY</v11:account-strategy-option-choice>" &_
" <v11:auto-release>""true</v11:auto-release>" &_
" </v1:new-business-upload-dto>" &_
" <v1:web-service-request-version>""2</v1:web-service-request-version>" &_
" </v1:new-business-upload-release-request>" &_
"</soapenv:Body>" &_
"</soapenv:Envelope>"
End If
Next
Dim http
Set http = createObject("Msxml2.ServerXMLHTTP")
http.Open "POST", strUrl, False
http.setRequestHeader "Authorization", "Basic 123"
http.setRequestHeader "Content-Type", "text/xml"
http.send strRequest
If http.Status = 200 Then
WScript.Echo "RESPONSE : " & http.responseXML.xml
Else
WScript.Echo "ERRCODE : " & http.status
'add0()'函數對於什麼應該等於'mm = right(「00」,&Month(mydt),2)「等等有很多開銷。 – Lankymart
關於HTTP 500服務器遇到錯誤時發生錯誤,可能試圖解析您的請求。只是想知道在你的很多''元素中的''''都是關於什麼的?我想象Web服務正在檢索請求並獲得像「USE_CREDITOR_DEFAULT_STRATEGY」這樣的值,並且想知道如何處理它或者未能對它進行反序列化併產生錯誤。 –
Lankymart