开发者社区> 问答> 正文

通过码栈访问自己搭建的webservice

码栈对页面元素的处理已经很完整,但是是在实现更复杂的后台逻辑或调用其它平台接口时,却没有能更好的解决
所以自己搭建了个webservice的服务,码栈通过调用自己的服务,再由自己的服务实现更复杂的逻辑处理或调用其它平台的接口,并返回处理结果,这可以大大拓展码栈的使用范围
以下是自己写的调用webservice服务的一个例子,仅供参考~
Func test()
    Dim $objHTTP
    Dim $strEnvelope
    Dim $strReturn
    Dim $objReturn
    Dim $dblTax
    Dim $strQuery
    Dim $value
    ; Initialize COM error handler
    $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
    $objHTTP = ObjCreate("Microsoft.XMLHTTP")
    $objReturn = ObjCreate("Msxml2.DOMdocument.3.0")
    ; Create the SOAP Envelope
    $strEnvelope = "<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:taob=""http://taobao.task.goelia.com.cn"">   <soapenv:Header/>   <soapenv:Body>      <taob:getItemsbyOuterid/>   </soapenv:Body></soapenv:Envelope>"
    ; Set up to post to our local server
    $objHTTP.open("post", 【自己的服务地址】, False)
    ; Set a standard SOAP/ XML header for the content-type
    $objHTTP.setRequestHeader("Content-Type", "text/xml;charset=UTF-8")
    ; Set a header for the method to be called
    $objHTTP.setRequestHeader("SOAPAction", "urn:getItemsbyOuterid")
    ;J_MsgBox("Content of the Soap envelope : " & @CR & $strEnvelope & @CR & @CR)
    ; Make the SOAP call
    $objHTTP.send($strEnvelope)
    ; Get the return envelope
    $strReturn = $objHTTP.responseText
    ;J_View_Write(1, 2, $strReturn)
    ;J_MsgBox("strReturn : " & $strReturn & @CR & @CR)
    $objReturn.loadXML($strReturn)
    $dblTax = $objReturn.SelectNodes("soapenv:Envelope/soapenv:Body/ns:getItemsbyOuteridResponse/ns:return")
    ;J_MsgBox("$max:" & $dblTax.length)
    For $objNode in $dblTax
        J_MsgBox($objNode.selectSingleNode("ax21:outerId" ).Text)
    Next


    ;J_View_Write(1, 3, $Soap)


    ;J_MsgBox($Soap)
EndFunc   ;==>test

展开
收起
西瓜皮lcy 2017-01-15 12:34:36 3812 0
2 条回答
写回答
取消 提交回答
  • 啊啊啊啊
    2017-05-22 15:07:06
    赞同 展开评论 打赏
  • 用J_Rest_Post也是可以的吧
    2017-01-18 17:51:32
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
网易 NEI 接口管理解决方案 立即下载
网易NEI接口管理解决方案 立即下载
网易 NEI 接口管理解决 方案 立即下载