Home » SQL & PL/SQL » SQL & PL/SQL » Calling webservice and send request in plsql (Oracle 10g,Windows XP)
Calling webservice and send request in plsql [message #407875] Fri, 12 June 2009 02:43 Go to next message
rakeshramm
Messages: 175
Registered: September 2006
Location: Oracle4u.com
Senior Member

declare 
 http_req utl_http.req; 
 http_resp utl_http.resp;
  request_env varchar2(32767); 
  response_env varchar2(32767); 
  begin 
 request_env:='9';
<device-list><device device_type="mac">00:11:1A:2C:B3:9C</device></device-list></query></request>'; 
  dbms_output.put_line('Length of Request:' || length(request_env)); 
  dbms_output.put_line ('Request: ' || request_env); 
  http_req := utl_http.begin_request('http://216.24.167.5:8080/scoutWS/services','GET', utl_http.HTTP_VERSION_1_1); 
  utl_http.set_header(http_req, 'Content-Type', 'text/xml; charset=utf-8'); 
  utl_http.set_header(http_req, 'Content-Length', length(request_env)); 
  utl_http.set_header(http_req, 'SOAPAction', ''); -- required to specify this is a SOAP communication
  utl_http.write_text(http_req, request_env); 
  dbms_output.put_line('');
  http_resp := utl_http.get_response(http_req);
  dbms_output.put_line('Response Received'); 
  dbms_output.put_line('--------------------------'); 
  dbms_output.put_line ( 'Status code: ' || http_resp.status_code ); 
  dbms_output.put_line ( 'Reason phrase: ' || http_resp.reason_phrase );
  utl_http.read_text(http_resp, response_env); 
  dbms_output.put_line('Response: '); 
  dbms_output.put_line(response_env); 
  utl_http.end_response(http_resp); 
  end; 


when i execute the code i got response but when i supply different request in 'request_env' variable i am getting same response .What i done wrong please help me i am new to this Webservice . The request what i want to pass is This


<?xml version="1.0"?>
<request>
<query app_key="GS_CLIENT">
<device-list>
<device device_type="mac">00:11:1A:2C:B3:9C</device>
</device-list>
</query>
</request>




Re: Calling webservice and send request in plsql [message #407878 is a reply to message #407875] Fri, 12 June 2009 02:49 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
http://www.lmgtfy.com/?q=oracle+plsql+soap

Regards
Michel
Re: Calling webservice and send request in plsql [message #407892 is a reply to message #407878] Fri, 12 June 2009 04:19 Go to previous messageGo to next message
rakeshramm
Messages: 175
Registered: September 2006
Location: Oracle4u.com
Senior Member

<?xml version="1.0"?>
<request>
<query app_key="GS_CLIENT">
<device-list>
<device device_type="mac">00:11:1A:2C:B3:9C</device>
</device-list>
</query>
</request>


Sir how to convert this XML to SOAP format ,ts my main issue
ie:
<?xml version = "1.0" encoding = "UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:getRate xmlns:ns1="urn:xmethods-CurrencyExchange" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<country1 xsi:type="xsd:string">us</country1>
<country2 xsi:type="xsd:string">uk</country2>
</ns1:getRate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Re: Calling webservice and send request in plsql [message #408183 is a reply to message #407892] Mon, 15 June 2009 02:22 Go to previous messageGo to next message
rakeshramm
Messages: 175
Registered: September 2006
Location: Oracle4u.com
Senior Member

Any Idea Please
Re: Calling webservice and send request in plsql [message #408240 is a reply to message #408183] Mon, 15 June 2009 07:23 Go to previous message
c_stenersen
Messages: 255
Registered: August 2007
Senior Member
I've used this in the past:

http://akdora.wordpress.com/2007/08/03/calling-a-web-service-by-plsql-utl_http/

http://www.oracle-base.com/dba/miscellaneous/soap_api.sql
Previous Topic: Help! How to calculate the balance daily without manually key in Date
Next Topic: Syntax to create table space
Goto Forum:
  


Current Time: Thu Dec 08 19:54:26 CST 2016

Total time taken to generate the page: 0.26914 seconds