0
叫肥皂web服務我使用谷歌Apps腳本與開源平臺的OpenClinica工作,我想用下面的下面的代碼來消耗他們的SOAP Web服務:如何使用谷歌Apps腳本
var xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:v1=\"http://openclinica.org/ws/studySubject/v1\" xmlns:bean=\"http://openclinica.org/ws/beans\">"
+"<soapenv:Header>"
+"<wsse:Security soapenv:mustUnderstand=\"1\" xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">"
+"<wsse:UsernameToken wsu:Id=\"UsernameToken-27777511\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">"
+"<wsse:Username>xxx</wsse:Username>"
+"<wsse:Password>yyy</wsse:Password>"
+"</wsse:UsernameToken>"
+"</wsse:Security>"
+"</soapenv:Header>"
+"<soapenv:Body>"
+"<v1:importRequest>"
+"<ODM>"
+"<ClinicalData StudyOID=\"S_PROSPER2\" MetaDataVersionOID=\"v1.0.0\">"
+"<SubjectData SubjectKey=\"SS_UU001\">"
+"<StudyEventData StudyEventOID=\"SE_QUESW4\" StudyEventRepeatKey=\"0\">"
+"<FormData FormOID=\"F_RANDANDQUEST_11\">"
+"<ItemGroupData ItemGroupOID=\"IG_RANDA_UNGROUPED\" ItemGroupRepeatKey=\"1\" TransactionType=\"Insert\">"
+"<ItemData ItemOID=\"I_RANDA_RAND01\" Value=\"1\"/>"
+"<ItemData ItemOID=\"I_RANDA_RAND02\" Value=\"1\"/>"
+"<ItemData ItemOID=\"I_RANDA_RAND03\" Value=\"1\"/>"
+"<ItemData ItemOID=\"I_RANDA_RAND04\" Value=\"1\"/>"
+"</ItemGroupData>"
+"</FormData>"
+"</StudyEventData>"
+"</SubjectData>"
+"</ClinicalData>"
+"</ODM>"
+"</v1:importRequest>"
+"</soapenv:Body>"
+"</soapenv:Envelope>";
var options =
{
"method" : "post",
"contentType" : "text/xml",
"payload" : xml
};
var result = UrlFetchApp.fetch("http://89.221.253.174:8080/OpenClinica-ws/ws/data/v1/dataWsdl.wsdl", options);
出於某種原因,我收到此錯誤信息:
請求失敗 http://89.221.253.174:8080/OpenClinica-ws/ws/data/v1/dataWsdl.wsdl 返回代碼404(行147文件 「守則」)
所以錯誤實際上是在這條線:
var result = UrlFetchApp.fetch("http://89.221.253.174:8080/OpenClinica-ws/ws/data/v1/dataWsdl.wsdl", options);
如果我試圖從soapUI的工具相同的代碼它工作一切正常:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://openclinica.org/ws/data/v1">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-27777511" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>xxx</wsse:Username>
<wsse:Password>yyy</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<v1:importRequest>
<ODM>
<ClinicalData StudyOID="S_PROSPER2" MetaDataVersionOID="v1.0.0">
<SubjectData SubjectKey="SS_UU001">
<StudyEventData StudyEventOID="SE_QUESW4" StudyEventRepeatKey="0">
<FormData FormOID="F_RANDANDQUEST_11">
<ItemGroupData ItemGroupOID="IG_RANDA_UNGROUPED" ItemGroupRepeatKey="1" TransactionType="Insert">
<ItemData ItemOID="I_RANDA_RAND01" Value="1"/>
<ItemData ItemOID="I_RANDA_RAND02" Value="1"/>
<ItemData ItemOID="I_RANDA_RAND03" Value="1"/>
<ItemData ItemOID="I_RANDA_RAND04" Value="1"/>
</ItemGroupData>
</FormData>
</StudyEventData>
</SubjectData>
</ClinicalData>
</ODM>
</v1:importRequest>
</soapenv:Body>
</soapenv:Envelope>
這不是一個解決方案! –
您期望什麼解決方案?我已經用app腳本測試了你的代碼,它的工作。 –