2017-03-01 1 views
0

itemnumber를 입력 매개 변수로 허용하는 PL/SQL 코드에서 webservice를 호출하려고하는데 약 8 개의 출력 매개 변수를 반환합니다. 일부는 string입니다. 몇 개는 base64binay로 인코딩 된 PDF 파일에 저장됩니다.얻기 415 PL/SQL에서 SOAP 웹 서비스를 호출 할 때 지원되지 않는 미디어 유형 오류

SoapUI에서 동일한 WSDL을 테스트 할 때 적절한 응답을 반환합니다.

하지만 내 PL/SQL 코드에서 415 Unsupported Media Type Error가 발생합니다. 이 문제를 해결할 수 있도록 도와 주시겠습니까? 지난 5 일간이 오류가 발생했습니다. 미리 감사드립니다.

아래 코드는 제대로 작동하면 제대로 된 기능으로 변환해야합니다.

declare 
     soap_request varchar2(30000); 
     soap_respond CLOB; 
     soap_respond_temp CLOB; 
     http_req utl_http.req; 
     http_resp utl_http.resp; 
     l_resp XMLType; 
     i integer; 
     instr_start integer; 
     instr_end integer; 
     l_orgname varchar2(30000); 
     l_description   VARCHAR2(250); 
     l_long_description  VARCHAR2(1000); 
     l_segment1    VARCHAR2(250); 
     l_item_type    VARCHAR2(100); 
     l_isbn     VARCHAR2(100); 
     l_match_score   NUMBER; 
     l_pdh_id    NUMBER; 
     l_cross_reference_id NUMBER; 
     l_soap_request  CLOB; 
     l_soap_response CLOB; 
     l_soap_resp_raw LONG RAW; 
     l_buffer_size  NUMBER (10) := 512; 
     l_substring_msg VARCHAR2 (512); 
     l_string_request VARCHAR2 (512); 
     l_raw_data   RAW (512); 
     buffer    VARCHAR2 (32767); 
     i     NUMBER; 
     eob    BOOLEAN := FALSE; 
     resultvar VARCHAR2 (30000); 
    begin 
     --Item number 104PT is I/p parameter below to the SOAP webservice 
     soap_request:= '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:grad="http://grades.web.spec.quality.asmorg.com/"> 
     <soap:Header/> 
     <soap:Body> 
      <grad:getGradeInfoForRM> 
      <strRMItem>104PT</strRMItem> 
      </grad:getGradeInfoForRM> 
     </soap:Body> 
    </soap:Envelope>';  
    http_req:= utl_http.begin_request 
       ('http://112.18.28.38:81/Itemspec/ItemGradeWSPort' 
       , '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, 'SOAPAction', ''); 
     utl_http.write_text(http_req, soap_request); 
     http_resp:= utl_http.get_response(http_req); 
    --dbms_output.put_line('got the soap response');  
    dbms_output.put_line('Response> status_code: "' ||http_resp.status_code || '"'); 
    dbms_output.put_line('Response> reason_phrase: "' ||http_resp.reason_phrase || '"'); 
    dbms_output.put_line('Response> http_version: "' ||http_resp.http_version || '"'); 
    DBMS_LOB.createtemporary (l_soap_response, TRUE); 
    fnd_file.put_line(fnd_file.log,'After create temporary'); 
    WHILE NOT (eob) 
     LOOP 
      BEGIN 
      dbms_output.put_line ('before read_text'); 
      UTL_HTTP.read_text (http_resp, buffer, 32767); 
      fnd_file.put_line(fnd_file.log,'Printing Buffer '||buffer); 
      dbms_output.put_line('Printing Buffer '||buffer); 
      IF buffer IS NOT NULL AND LENGTH (buffer) > 0 
      THEN 
       fnd_file.put_line(fnd_file.log,'Appending to l_soap_response using DBMS writeappend'); 
       dbms_output.put_line (' Appending to l_soap_response using DBMS writeappend'); 
       DBMS_LOB.writeappend (l_soap_response, LENGTH (buffer), buffer); 
      END IF; 
      EXCEPTION 
      WHEN UTL_HTTP.end_of_body 
      THEN 
      fnd_file.put_line(fnd_file.log,'end of body'); 
       eob := TRUE; 
      END; 
     END LOOP; 
    UTL_HTTP.end_response (http_resp); 
    fnd_file.put_line (fnd_file.log,'before XMLTYPE Call'); 
    dbms_output.put_line ('before XMLTYPE Call'); 
    l_resp := XMLTYPE.createxml (l_soap_response); 
    DBMS_LOB.freetemporary (l_soap_response); 
    fnd_file.put_line(fnd_file.log,'--after XMLTYPE Call'); 
    dbms_output.put_line ('after XMLTYPE Call'); 
    resultvar := l_resp.getstringval(); 
    fnd_file.put_line(fnd_file.log,'--after getstringval Call'); 
    fnd_file.put_line (fnd_file.log,resultvar); 
    fnd_file.put_line (fnd_file.log,'End DateTime:- ' || SYSTIMESTAMP); 
     EXCEPTION 
     WHEN UTL_HTTP.end_of_body THEN 
      dbms_output.put_line('end of body'); 
     UTL_HTTP.end_response(http_resp); 
      WHEN UTL_HTTP.TOO_MANY_REQUESTS THEN 
     UTL_HTTP.END_RESPONSE(http_resp); 
     WHEN OTHERS THEN 
      dbms_output.put_line('others eception '||SQLERRM); 
    end;  

여기에 인쇄 된 로그 메시지 :

응답> STATUS_CODE : "415" 응답> reason_phrase : 다른 ORA-31011를 우유 공급 "지원되지 않는 미디어 유형" XMLTYPE 호출하기 전에 read_text 전에 : XML 파싱 오류 : ORA-19202 : XML 처리에서 오류가 발생했습니다. : 입력 소스가 비어 있습니다.

답변

0

이 문제는 이제 해결되었습니다. 문제는 헤더가 SO AP 웹 서비스 유형.

sys.UTL_HTTP.SET_HEADER(http_req, 'Content-Type', 'application/soap+xml;charset=UTF-8'); 
    utl_http.set_header(http_req, 'Content-Length', length(soap_request)); 
utl_http.set_header (http_req, 'Transfer-Encoding', 'chunked'); 
sys.utl_http.set_header(http_req, 'User-Agent', 'Apache-HttpClient/4.1.1 (java 1.5)'); 
    utl_http.set_header(http_req, 'SOAPAction', ''); 

정확한 헤더 유형, 즉 'Content-type'및 'User-Agent'에 대한 단서, 원시 탭을보고있는 동안 SoapUI에서 가져 왔습니다.

감사합니다. Pradeep

관련 문제