Linux使用Curl進行Soap測試WSDL接口


Linux使用Curl進行Soap測試WSDL接口

1 創建request.xml文件

創建一個Soap Envelope,另存為比如request.xml,文件內容為該soap接口消息體

[root@localhost soapRequest]# cat jkda_request.xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="service.qualitycontrolwriteback.qy.com">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:executeData>
         <!--Optional:-->
         <arg0><![CDATA[
<root>
   <project>
  <id>0b42fd7768da4dcb815738f8b92604e7</id>
   </project>
</root>
]]></arg0>
      </ser:executeData>
   </soapenv:Body>

2 構造消息頭

構造消息頭,放到-H/ --header 參數后面,一個header加一個參數,可以添加多個header
--header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:XX"

3 執行Crul命令

[root@localhost soapRequest]# curl --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:" --data @/qualityControlWriteBack/soapRequest/jkda_request.xml http://10.16.113.1:10009/service/writeBack
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:executeDataResponse xmlns:ns2="service.qualitycontrolwriteback.qy.com"><return>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;response&gt;
        &lt;code&gt;1001&lt;/code&gt;
        &lt;msg&gt;接口調用成功&lt;/msg&gt;
&lt;/response&gt;</return></ns2:executeDataResponse></soap:Body></soap:Envelope>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM