2016-11-08 7 views
1

以下のようにSOAP Webサービスを呼び出す.vbsを開発しました。実行中にエラーコード500が表示されます。これに直面した場合は、あなたのアイデアを共有してください。パラメータに直面したSOAP Webサービスを呼び出すエラーコード:500内部サーバエラー

私はこのファイルを実行するためにWindows 7を使用します。

enter image description here

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 
+0

'add0()'関数は、 'mm = Right(" 00 "、&Month(mydt)、2)などに相当するオーバーヘッドになります。 – Lankymart

+0

質問に関して、HTTP 500サーバーがエラーを検出したときにエラーが発生し、要求を解析しようとしている可能性があります。多くの ''要素の中の '' "が何のためになっているのだろうか?私はWebサービスが要求を取得し、 '' USE_CREDITOR_DEFAULT_STRATEGY'のような値を得て、それをどう処理すべきか疑問に思ったり、直列化をやめたりエラーを生成したりしていると思います。 – Lankymart

答えて

0

あなたのXMLデータが無効です。開封<soapenv:Envelope>タグには閉じ角括弧がなく、タグ<soapenv:Header>タグの終了スラッシュは閉じ角括弧の後にあります。

変更この:この中

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>/" &_ 
      ... 

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/>" &_ 
      ... 

また、あなたがdtの構築に二回mmを使用します。

dt = mm & dd & hh & mm 

それはおそらく

する必要があります
dt = mm & dd & hh & mn 

問題が解決しない場合は、ウェブサーバーのログを確認する必要があります(エラー500はサーバー側のエラーです)。また、APIドキュメントを参照して、送信しているリクエストが正しいかどうかを確認してください形。

関連する問題