web services - How to call an ASP.NET webservice from Oracle? -


how call asp.net webservice oracle, can have stored procedure calling asp.net webservice?

here simple stored procedure calls simple asp.net addition web service oracle gives result of addition of 2 numbers supply oracle.

create or replace procedure sp_wsadd (    p_num1 number,   p_num2 number ) v_invelop_temp varchar2(32767); v_invelop      varchar2(32767); v_request      utl_http.req; v_response utl_http.resp;   v_wsdl_url varchar2(2000):='address of webservice'; v_xml xmltype;  begin     v_invelop:='<?xml version="1.0" encoding="utf-8"?>   <soap:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">  <soap:body>    <add xmlns="http://tempuri.org/">      <num1>'||p_num1||'</num1>      <num2>'||p_num2||'</num2>    </add>  </soap:body> </soap:envelope>';    v_request:= utl_http.begin_request(v_wsdl_url, 'post','http/1.1');               utl_http.set_body_charset(v_request, 'utf-8');     utl_http.set_header(v_request, 'content-type', 'text/xml');    utl_http.set_header(v_request, 'content-length', length(v_invelop));    utl_http.set_header(v_request, 'soapaction', 'http://tempuri.org/add');    utl_http.write_text(v_request, v_invelop);    v_response := utl_http.get_response(v_request);             dbms_output.put_line('response received');             dbms_output.put_line('--------------------------');                                                                                                                                                                                                                             dbms_output.put_line ( 'status code: ' || v_response.status_code );             dbms_output.put_line ( 'reason phrase: ' || v_response.reason_phrase );    utl_http.read_text(v_response, v_invelop);   utl_http.end_response(v_response);                  v_invelop := replace(v_invelop,'xmlns="http://tempuri.org/"','');                 v_xml:=  xmltype(v_invelop);                 dbms_output.put_line('value='||v_xml.extract('//addresult/text()').getstringval());     commit;     end;     / 

the web service stored procedure is

  [webmethod]   public string add(int num1, int num2)   {     return (num1 + num2).tostring();   } 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -