微剋多資訊

 找回密碼
 註冊

Sign in with google

Google帳號登入

搜索

簽到天數: 17

該用戶今日未簽到

升級   24%

跳轉到指定樓層
主題
發表於 2023-3-13 16:27 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
本帖最後由 kaihsin1703 於 2023-3-17 08:48 編輯

請問各位大大

錯誤訊息,看不太懂? 該從哪個方向修改呢?

;AutoIT - Getting data from a Web Service
;https://audministrator.wordpress ... 5Rvc837Yu4HqZFpvyUo

Dim $objHTTP
Dim $strEnvelope
Dim $strReturn
Dim $objReturn
Dim $strQuery
Dim $strValue

;~ $strValue = InputBox("Testing", "Enter your new value here.", 60007)
$value1 = "TEST 1"
$value2 = "TEST 2"
$value3 = "TEST 3"
$value4 = "TEST 4"
$value5 = "TEST 5"

; Initialize COM error handler
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

$objHTTP = ObjCreate("Microsoft.XMLHTTP")
$objReturn = ObjCreate("Msxml2.DOMDocument.3.0")
; Create the SOAP Envelope 修改碼
$strEnvelope = "<soap:envelope xmlns:soap=""urn:schemas-xmlsoap-org:soap.v1"">" & _
   "<soap:Body>" & _
   "<insertStatus2DB xmlns=" & "http://10.34.128.182/" & ">" & _
   "<product>" & $value1 & "</product>" & _
   "<lotno>" & $value2 & "</lotno>" & _
   "<cst>" & $value3 & "</cst>" & _
   "<step>" & $value4 & "</step>" & _
   "<date>" & $value5 & "</date>" & _

   "</insertStatus2DB>" & _
   "</soap:Body>" & _
   "</soap:Envelope>"

; Set up to post to our local server 修改碼
$objHTTP.open ("post", "http://10.34.128.182/Auto_Delivery/WebService/AutoDeliveryData.asmx?op=insertStatus2DB", False)

; Set a standard SOAP/ XML header for the content-type ;為內容類型設置一個標準的 SOAP/XML 標頭
$objHTTP.setRequestHeader ("Content-Type", "text/xml")

; Set a header for the method to be called
$objHTTP.setRequestHeader ("SOAPMethodName", "urn:myserver/soap:TaxCalculator#Getsalestax")

ConsoleWrite("Content of the Soap envelope : "& @CR & $strEnvelope & @CR & @CR)

; Make the SOAP call
$objHTTP.send ($strEnvelope)

; Get the return envelope
$strReturn = $objHTTP.responseText

ConsoleWrite("-----------" & @CRLF)
ConsoleWrite ("Debug Response : "& @CR & $strReturn & @CR & @CR)
ConsoleWrite("-----------" & @CRLF)

; Load the return envelope into a DOM
$objReturn.loadXML ($strReturn)

ConsoleWrite("Return of the SOAP Msg : " & @CR & @CR & $objReturn.XML & @CR & @CR)

; Query the return envelope
$strQuery = "SOAP:Envelope/SOAP:Body"

$objReturn.selectSingleNode($strQuery)

$Soap = $objReturn.Text

MsgBox(0,"SOAP Response","The Response is  : " & $Soap)

Func MyErrFunc()
  $HexNumber=hex($oMyError.number,8)
  Msgbox(0,"COM Test","We intercepted a COM Error !"       & @CRLF  & @CRLF & _

                         "err.description is: "    & @TAB & $oMyError.description    & @CRLF & _
                         "err.windescription:"     & @TAB & $oMyError.windescription & @CRLF & _
                         "err.number is: "         & @TAB & $HexNumber              & @CRLF & _
                         "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
                         "err.scriptline is: "     & @TAB & $oMyError.scriptline     & @CRLF & _
                         "err.source is: "         & @TAB & $oMyError.source         & @CRLF & _
                         "err.helpfile is: "       & @TAB & $oMyError.helpfile       & @CRLF & _
                         "err.helpcontext is: "    & @TAB & $oMyError.helpcontext _
                        )

  SetError(1)
Endfunc

#cs
   錯誤訊息
   The Sales Tax is : soap:VersionMismatchSystem.Web.Services.Protocols.SoapException:
   可能是 SOAP 的版本不符合: 發現未預期的 Envelope 命名空間 urn:schemas-xmlsoap-org:soap.v1。必須是 http://schemas.xmlsoap.org/soap/envelope/
   於 System.Web.Services.Protocols.SoapServerProtocol.CheckHelperVersion()
   於 System.Web.Services.Protocols.SoapServerProtocol.Initialize()
   於 System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
#ce

樓主熱門主題

簽到天數: 17

該用戶今日未簽到

升級   24%

2F
 樓主| 發表於 2023-3-17 08:54 | 只看該作者
解決了
; Create the SOAP Envelope
$strEnvelope = '<?xml version="1.0" encoding="utf-8"?>' & _
'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' & _
  '<soap:Body>' & _
    '<insertStatus2DB_Post xmlns="http://tempuri.org/">' & _
"<product>" & $value1 & "</product>" & _
   "<lotno>" & $value2 & "</lotno>" & _
   "<cst>" & $value3 & "</cst>" & _
   "<step>" & $value4 & "</step>" & _
   "<date>" & $value5 & "</date>" & _

   "</insertStatus2DB>" & _
   "</soap:Body>" & _
   "</soap:Envelope>"

使用道具

您需要登入後才可以回帖 登入 | 註冊

本版積分規則

小黑屋|Archiver|微剋多資訊(MicroDuo)

GMT+8, 2024-11-21 20:27

Discuz! X

© 2009-2023 Microduo

快速回覆 返回頂部 返回列表