PL / SQL SOAP调用不起作用,我正在使用Oracle 11g 它给出了如下输出:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org /soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
<faultstring>no SOAPAction header!</faultstring>
<detail>
<ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">testvm564.de.test.com</ns2:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
PL / SQL是(在SOAP UI中工作正常):
declare
soap_request VARCHAR2(30000);
soap_respond CLOB;
http_req utl_http.req;
http_resp utl_http.resp;
resp XMLType;
soap_err exception;
v_code VARCHAR2(200);
v_msg VARCHAR2(1800);
v_len number;
v_txt Varchar2(32767);
BEGIN
-- Define the SOAP request according the the definition of the web service being called
soap_request:= '<?xml version = "1.0" encoding = "UTF-8"?>'||
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.test.com/dta/TestData/2/0" xmlns:urn="urn:core.bo.service.sim.test.com">'||
'<soapenv:Header/>'||
' <soapenv:Body>'||
' <ns:GetRoleAssignmentRequest>'||
' <ns:auth>'||
' <urn:user>'||'testUser'||'</urn:user>'||
' <urn:password>'||'testPass'||'</urn:password>'||
' </ns:auth>'||
' </ns:GetRoleAssignmentRequest>'||
' </soapenv:Body>'||
'</soapenv:Envelope>';
http_req:= utl_http.begin_request
( 'http://test.test.com/testWebService/services/testService20SOAP?wsdl/getRoleAssignment'
, 'POST'
, 'HTTP/1.1'
);
utl_http.set_header(http_req, 'Content-Type', 'text/xml');
utl_http.set_header(http_req, 'Content-Length', length(soap_request));
utl_http.set_header(http_req, 'Download', ''); -- header requirements of particular web service
utl_http.write_text(http_req, soap_request);
http_resp:= utl_http.get_response(http_req);
utl_http.get_header_by_name(http_resp, 'Content-Length', v_len, 1); -- Obtain the length of the response
FOR i in 1..CEIL(v_len/32767) -- obtain response in 32K blocks just in case it is greater than 32K
LOOP
utl_http.read_text(http_resp, v_txt, case when i < CEIL(v_len/32767) then 32767 else mod(v_len,32767) end);
soap_respond := soap_respond || v_txt; -- build up CLOB
dbms_output.put_line('Aneesh'||soap_respond);
END LOOP;
utl_http.end_response(http_resp);
resp:= XMLType.createXML(soap_respond); -- Convert CLOB to XMLTYPE
END;
请扩展您的帮助 (如果需要,我可以添加预期的输出) (如果需要,我可以添加预期的输出)
答案 0 :(得分:0)
将SOAPAction标头添加到您的HTTP请求中:
fp = popen("echo "xyz" > /dev/ttyACM0 | cat - /dev/ttyACM0", "r");
while (fgets(ret_val, sizeof(ret_val)-1, fp) != NULL)
{
if (strcmp(ret_val, "response") == 0)
{
close(fp);
return ret_val;
}
}
您将在服务WSDL中找到SOAPAction值:
utl_http.set_header(http_req, 'SOAPAction', 'yourHeader');