2016-09-01 3 views
0

PL/SQLのSOAP呼び出しが動作しないと私はOracle 11gの を使用していますそれは以下のように出力を与えるSOAPのWebサービスでは動作しません。 )SOAP UIで正常に動作します:PL/SQLは

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

あなたはエラーメッセージを得るのですか? 「うまくいかない」とはどういう意味ですか? – Rene

+0

申し訳ありません.....私は期待どおりの応答を得ていないことを意味します。代わりに、私は以下のような応答を得ます: ns1:Client.NoSOAPAction SOAPActionヘッダーがありません!

答えて

0
を拡張してください。

は、あなたのHTTPリクエストにSOAPアクションヘッダーを追加します。

utl_http.set_header(http_req, 'SOAPAction', 'yourHeader'); 

あなたはサービスのWSDLでのSOAPAction値を見つける:

<wsdl:operation name="yourOperation"> 
    <soap:operation soapAction="yourSoapAction" ... />