카테고리 없음

[웹 서비스] PL / SQL에서 웹 서비스 호출 실패

행복을전해요 2021. 2. 5. 06:36

문제는 웹 서비스가 SOAP이지만 SOAP 요청을 보내지 않는다는 것입니다. 이렇게하려면이 URL을 찾아서 웹 서비스의 wsdl을 확인하십시오. http://localhost:64955/Service1.asmx?wsdl거기에서 메서드를 호출하는 SOAP 봉투를 만드는 방법을 알 수 있습니다. 당신은 다음과 같이 할 것입니다.

soap_request :=
  '<SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
        <SOAP-ENV:Body>
          <m:add xmlns:m="Some-URI">
            <firstNum>1</firstNum>
              <secondNum>2</secondNum>
                </m:add>
                  </SOAP-ENV:Body>  
                    </SOAP-ENV:Envelope>';
                    
                      l_http_request := UTL_HTTP.begin_request ('http://localhost:64955/Service1.asmx?op=add'
                                                              ,'POST'
                                                                                                      ,'HTTP/1.1');
                                                                                                      
                                                                                                        --...set header's attributes
                                                                                                          UTL_HTTP.set_header(l_http_request,'Content-Type', 'application/xml');
                                                                                                            UTL_HTTP.set_header(l_http_request,'Content-Length', length(soap_request));
                                                                                                            
                                                                                                              --...set input parameters
                                                                                                                UTL_HTTP.write_text(l_http_request, soap_request);
                                                                                                                  -- get response and obtain received value
                                                                                                                    l_http_response := UTL_HTTP.get_response(l_http_request);
                                                                                                                      UTL_HTTP.read_text(l_http_response, l_response_text);
                                                                                                                        dbms_output.put_line(l_response_text);
                                                                                                                          dbms_output.put_line('test1');
                                                                                                                            --finalizing 
                                                                                                                              UTL_HTTP.end_response(l_http_response);
                                                                                                                              


출처
https://stackoverflow.com/questions/22050113