我想通过bash脚本中的命令行访问在线程序。有人告诉我可以运行肥皂请求以访问软件。这是我被告知我可以使用的请求。
POST /OnlineAnalysis/Service.asmx HTTP/1.1
Host: cydas.org
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.cydas.org/OnlineAnalysis/analyseKaryotype"
<?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>
<analyseKaryotype xmlns="http://www.cydas.org/OnlineAnalysis/">
<strKaryotype>string</strKaryotype>
</analyseKaryotype>
</soap:Body>
</soap:Envelope>
我以前从未运行过SOAP请求,但是看起来我可以基于此问题使用Curl命令。我尝试根据我发布的链接
对我的卷曲命令进行建模curl -X POST -H "POST /OnlineAnalysis/Service.asmx HTTP/1.1" -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction: "http://www.cydas.org/OnlineAnalysis/analyseKaryotype"" -H "Host: cydas.org" --data-binary @request.xml
和正在获取此输出
<HTML>
<HEAD>
<TITLE>405 Method Not Allowed</TITLE>
<BASE href="/error_docs/"><!--[if lte IE 6]></BASE><![endif]-->
</HEAD>
<BODY>
<H1>Method Not Allowed</H1>
The HTTP verb used to access this page is not allowed.<P>
<HR>
<ADDRESS>
Web Server at cydas.org
</ADDRESS>
</BODY>
</HTML>
<!--
- Unfortunately, Microsoft has added a clever new
- "feature" to Internet Explorer. If the text of
...
这些是我的request.xml文件的内容
<?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>
<analyseKaryotype xmlns="http://www.cydas.org/OnlineAnalysis/">
<strKaryotype>46,XX,del(3)(p11)</strKaryotype>
</analyseKaryotype>
</soap:Body>
</soap:Envelope>
我不确定预期的输出应该是什么,因为我无法运行该程序。我只想让我的肥皂请求正确运行。
尝试以下:
curl -v "http://www.cydas.org/OnlineAnalysis/Service.asmx" -H "Content-Type: text/xml;charset=UTF-8" -H "SOAPAction: "http://www.cydas.org/OnlineAnalysis/analyseKaryotype"" -H "Connection: Keep-Alive" -H "Host: www.cydas.org" --data @request.xml
服务器响应了以下消息:" Karyotype del(3((P11(无效:染色体计数元素(DEL(3((P11((中的未指定错误
这是完整的响应消息:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<analyseKaryotypeResponse xmlns="http://www.cydas.org/OnlineAnalysis/">
<analyseKaryotypeResult>
<Original_ISCN_Formula>del(3)(p11)</Original_ISCN_Formula>
<IsPolyClonal>false</IsPolyClonal>
<IsValidKaryotype>false</IsValidKaryotype>
<Corrected_ISCN_Formula/>
<CloneSize>0</CloneSize>
<IsIncompleteKaryotype>false</IsIncompleteKaryotype>
<Ploidy>0</Ploidy>
<ErrorMessages>The Karyotype del(3)(p11) is not valid:
Non-specified error in chromosome count element (del(3)(p11))</ErrorMessages>
</analyseKaryotypeResult>
</analyseKaryotypeResponse>
</soap:Body>
</soap:Envelope>
卷曲是一个很棒的工具,但是如果您想要一个不错的GUI,则可以尝试其他工具(例如Soapui或Postman(来测试API。Soapui是独立的Java应用程序,Postman是Chrome的插件。他们俩都免费。