Calling a WCF service from pl sql using a scheduler.
Hi
I am completely new to everything pl sql related. Right now, I need to call a WCF service method that returns a dataset. Then i need to take that dataset and insert the data into a table in the database. I want to do this by having a scheduler be called once a day.
Does anyone have any code, examples etc?
thanks
And WCF stands for what? In what version of the product?
First rule for someone new ... don't make the assumption that we can look over your shoulder or read your mind.
What you seem to want is the built-in scheduler. The docs are at http://tahiti.oracle.com.
Demos are at:
http://www.psoug.org/reference/dbms_scheduler.html
Similar Messages
-
Error while calling .svc web service from pl/sql using utl_dbws
Hello Folks,
I am calling a .svc web service from pl/sql using utl_dbws and encountering the following error
javax.xml.rpc.soap.SOAPFaultException: The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
Can you help me find what am I doing wrong?
Thanks
RkHi,
Here are the details
1. What version?
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for 64-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
2. What error message ... we need the full and complete error stack not your interpretation of it.
ORA-29532: Java call terminated by uncaught Java exception: javax.xml.rpc.soap.SOAPFaultException: The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Messag
3. "I am calling means what?" We need the full and complete statement showing the values of all parameters.
The input to the web-service is a xmltype containing address information and the web-service returns a string
CREATE OR REPLACE FUNCTION get_id
RETURN VARCHAR2
AS
l_service UTL_DBWS.service;
l_call UTL_DBWS.CALL;
l_wsdl_url VARCHAR2 (32767);
l_namespace VARCHAR2 (32767);
l_service_qname UTL_DBWS.qname;
l_port_qname UTL_DBWS.qname;
l_operation_qname UTL_DBWS.qname;
l_xmltype_in SYS.XMLTYPE;
l_xmltype_out SYS.XMLTYPE;
l_return VARCHAR2 (32767);
BEGIN
l_wsdl_url := 'http://test.com/test.svc?wsdl';
l_namespace := 'http://test.org/';
l_service_qname := UTL_DBWS.to_qname (l_namespace, 'SName');
l_port_qname := UTL_DBWS.to_qname (l_namespace, 'BasicHttpBinding_ISName');
l_operation_qname := UTL_DBWS.to_qname (l_namespace, 'Iden');
l_service :=
UTL_DBWS.create_service
(wsdl_document_location => urifactory.geturi
(l_wsdl_url),
service_name => l_service_qname
l_call :=
UTL_DBWS.create_call (service_handle => l_service,
port_name => l_port_qname,
operation_name => l_operation_qname
l_xmltype_in :=
SYS.XMLTYPE
('<IdenRequest xmlns:i="http://www.w3.org/XMLSchema-instance" xmlns="http://test.org/SNameIden.WCFService">
<address />
<zip>12345</zip>
<state>AA</state>
<street>W Test </street>
</address>
</IdenRequest>'
l_xmltype_out :=
UTL_DBWS.invoke (call_handle => l_call,
request => l_xmltype_in);
UTL_DBWS.release_call (call_handle => l_call);
UTL_DBWS.release_service (service_handle => l_service);
l_return := l_xmltype_out.EXTRACT ('//Iden/text()').getstringval();
RETURN l_return;
END;
/ -
Calling secured web service from Pl SQL
Hi
I am trying to call a secured web service from pl/sql using utl_http.
Is there a sample pl/sql program that i can refer to call a secured web service.
sample soap header that am trying to acheive.
<soap:Header>
<wsa:Action>http://myactaction</wsa:Action>
<wsa:MessageID>uuid:asdfadrewrwqr</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>
</wsa:ReplyTo>
<wsa:To>http://myact</wsa:To>
<wsse:Security soap:mustUnderstand="1">
<wsse:UsernameToken wsu:Id="SecurityToken-321321">
<wsse:Username>mordfsafsdae</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">werwqrewrwe</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soap:Header>
Thanks a ton in advanceHi,
On way we can call a web service is to pass the Web Service URL to UTL_HTTP package:
Sample Web Service URL
===================
lv_url :=
'http://67.97.189.151:8888/plsqlsample/dbfunc?invoke=placeOrder'
|| '&'
|| 'param0=1'
|| '&'
|| 'param1=1'
|| '&'
|| 'param2=1';
Sample Call using UTL_HTTP
=====================
SELECT UTL_HTTP.request (lv_url)
INTO lv_result
FROM DUAL;
Thank you.
Regards,
Balu -
Calling a Web Service from PL/SQL Procedure
How can you call a web service from a pl/sql package , also is it valid to call a web service from pl/sql according to Fusion Standards..
Hi,
On way we can call a web service is to pass the Web Service URL to UTL_HTTP package:
Sample Web Service URL
===================
lv_url :=
'http://67.97.189.151:8888/plsqlsample/dbfunc?invoke=placeOrder'
|| '&'
|| 'param0=1'
|| '&'
|| 'param1=1'
|| '&'
|| 'param2=1';
Sample Call using UTL_HTTP
=====================
SELECT UTL_HTTP.request (lv_url)
INTO lv_result
FROM DUAL;
Thank you.
Regards,
Balu -
Help calling a web service from pl/sql
Hi, i have a web service that is called from a php, i needed to do this but from pl sql:
this is the call of web service from php:
<?PHP
//Variables de prueba - Se tienen que tomar los valores de la base de datos, de la compra y el usuario
$p_id_emec=urlencode("33355555"); //Identificador del sitio dentro de Pago Fácil
$p_id_operacion=urlencode("151"); //Identificador unívoco de la compra en el sitio
$p_id_mone_ecom=urlencode("01"); //Identificador de moneda - '01'=pesos - '02=dolares
//Inicializa Variables de URL
$serviceName="Pago XX";
$protocol="http://";
// DESARROLLO
$ipUrl="desa.e-pagoxx.com";
$port=80;
//Llamada
$call="/2130/index.php";
//Abro la conexion al port
$URLsola = $protocol.$ipUrl;
//Concatenacion del string
$txtURL = $protocol.$ipUrl.$call;
$txtURL .="?p_id_emec=".$p_id_emec;
$txtURL .="&p_id_operacion=".$p_id_operacion;
$txtURL .="&p_id_mone_ecom=".$p_id_mone_ecom;
$txtURL = $txtURL;
//* Se comunica con el servidor, pasa los datos y recibe el HTML con el comprobante *//
$fp = fsockopen($ipUrl, $port, &$errno, &$errstr, 30);
if(!$fp)
echo "No me puedo comunicar con $serviceName";
exit;
else
$file=@fopen($URLsola,"r");
$pageData=file($txtURL);
for($i=0;$i<count($pageData);$i++)
$sText.=$pageData[$i];
@fclose($file);
@fclose($fp);
echo($sText);
?>
I need to call this webservice from pl sql
any ideas?
thanks!!Madhu BR wrote:
You might want to try the webservice call using utl_http specified here : http://orclpps.blogspot.com/2007/12/invoking-webservices-from-oracle-9i-or.html
Or even to expand on that to deal with responses larger than 32K...
-- skeleton code
PROCEDURE p_soap_request(p_username IN VARCHAR2, p_password IN VARCHAR2, p_proxy IN VARCHAR2) IS
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
IF p_proxy IS NOT NULL THEN
UTL_HTTP.SET_PROXY(p_proxy);
END IF;
-- Define the SOAP request according the the definition of the web service being called
soap_request:= '<?xml version = "1.0" encoding = "UTF-8"?>'||
'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">'||
' <SOAP-ENV:Body>'||
' <m:DownloadRequest xmlns:m="http://www.website.net/messages/GetDetails">'||
' <m:UserName>'||p_username||'</m:UserName>'||
' <m:Password>'||p_password||'</m:Password>'||
' </m:DownloadRequest>'||
' </SOAP-ENV:Body>'||
'</SOAP-ENV:Envelope>';
http_req:= utl_http.begin_request
( 'http://www.website.net/webservices/GetDetailsService.asmx'
, '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
END LOOP;
utl_http.end_response(http_resp);
resp:= XMLType.createXML(soap_respond); -- Convert CLOB to XMLTYPE
END; -
Calling https web service from pl/sql
hi,
i've to call a web service from my database, after some research, i've tryed to use utl_dbws package to get the job, i've managed to put to work some of the examples i saw, that allways use http. My webservice is invoked using https with some user credentials.
i'me getting the following message:
ORA-29532: Java call terminated by uncaught Java exception: HTTP transport error:
javax.xml.soap.SOAPException: java.security.PrivilegedActionException:
javax.xml.soap.SOAPException: Message send failed: Socket is closed
ORA-06512: at "SYS.UTL_DBWS", line 388
ORA-06512: at "SYS.UTL_DBWS", line 385
ORA-06512: at line 85
i've tryed with this 2 procedures:
declare
service_ sys.utl_dbws.SERVICE;
call_ sys.utl_dbws.CALL;
service_qname sys.utl_dbws.QNAME;
port_qname sys.utl_dbws.QNAME;
operation_qname sys.utl_dbws.QNAME;
string_type_qname sys.utl_dbws.QNAME;
retx ANYDATA;
retx_string VARCHAR2(100);
retx_len number;
params sys.utl_dbws.ANYDATA_LIST;
wsm varchar2(4000);
config varchar2(4000);
request sys.XMLTYPE;
response sys.XMLTYPE;
begin
Request := sys.XMLTYPE('<?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:Header>'||
' <UserCredentials xmlns="http://tempuri.org/">'||
' <UserID>username</UserID>'||
' <Password>password</Password>'||
' </UserCredentials>'||
' </soap:Header>'||
' <soap:Body>'||
' <GetInfo xmlns="http://tempuri.org/">'||
' <wsID>13</wsID>'||
' </GetInfo>'||
' </soap:Body>'||
' </soap:Envelope>');
service_qname := sys.utl_dbws.to_qname(null, 'GetInfo');
service_ := sys.utl_dbws.create_service(service_qname);
operation_qname := sys.utl_dbws.to_qname('http://tempuri.org/', 'GetInfo');
call_ := sys.utl_dbws.create_call(service_);
sys.utl_dbws.set_target_endpoint_address(call_, 'https://ws.livesolutions.pt:8800/wsLivesolutions.asmx');
sys.utl_dbws.set_property( call_
, 'OPERATION_STYLE'
, 'document'
sys.utl_dbws.set_property( call_
, 'SOAPACTION_URI'
,' https://ws.livesolutions.pt:8800/wsLivesolutions');
response:= sys.utl_dbws.invoke(call_, request);
END;
declare
service_ utl_dbws.SERVICE;
call_ utl_dbws.CALL;
service_qname utl_dbws.QNAME;
port_qname utl_dbws.QNAME;
operation_qname utl_dbws.QNAME;
string_type_qname utl_dbws.QNAME;
retx ANYDATA;
retx_string VARCHAR2(1000);
retx_double number;
retx_len number;
params utl_dbws.ANYDATA_LIST;
l_input_params utl_dbws.anydata_list;
l_result ANYDATA;
l_namespace VARCHAR2(1000);
request sys.XMLTYPE;
response sys.XMLTYPE;
begin
l_namespace := 'http://tempuri.org/';
service_qname := utl_dbws.to_qname(l_namespace, 'wsLivesolutions');
service_ := utl_dbws.create_service(service_qname);
port_qname := utl_dbws.to_qname(l_namespace, 'wsLivesolutionsSoap');
operation_qname := utl_dbws.to_qname(l_namespace, 'GetInfo');
call_ := utl_dbws.create_call(service_, port_qname, operation_qname);
utl_dbws.set_target_endpoint_address(call_, 'https://ws.livesolutions.pt:8800/wsLivesolutions.asmx');
utl_dbws.set_property(call_, 'SOAPACTION_USE', 'TRUE');
utl_dbws.set_property(call_, 'SOAPACTION_URI', 'http://tempuri.org/GetInfo');
utl_dbws.set_property(call_, 'OPERATION_STYLE', 'document');
UTL_DBWS.set_property(call_, 'USERNAME', 'username');
UTL_DBWS.set_property(call_, 'PASSWORD', 'password');
string_type_qname := utl_dbws.to_qname('http://www.w3.org/2001/XMLSchema', 'schema');
utl_dbws.add_parameter(call_, 'wsID', string_type_qname, 'ParameterMode.IN');
utl_dbws.set_return_type(call_, string_type_qname);
params(0) := ANYDATA.convertnumber(13);
retx := utl_dbws.invoke(call_, params);
utl_dbws.release_service(service_);
end;
can anyone help me in this?
thxAre you expecting us to guess at the message you received when you got the 28868?
I guess: "the wallet is closed."
If I guessed correctly then open it.
ALTER SYSTEM SET ENCRYPTION WALLET OPEN IDENTIFIED BY "<your_wallet_password_here>";If I didn't guess correctly then you need to provide all of the information you neglected in your original post.
Start with the version number. -
Calling a web service from BPM without using bridge S/A
Hi Experts,
I want to call a web service from a BPM and I want to call it asyncronously. That is by having my request and my response as a separate interface.
I already did it by calling another BPM, this one with a bridge, but I don't like this solution.
Any ideas?
Regards
GonzaloHi Sanjeev,
EDIT: I was wrong, I have to reconsider your scenario.
Leela,
Watch this:
http://img74.imageshack.us/img74/3536/presentacin2vm9.jpg
The points of my scenario:
-There's a BPM
-Send and Receive in BPM have to be asynchronous
-It have to comunicate with a WS wich is synchronous
-I thought that, may be, playing with the receiver SOAP adapter modules I will achieve to send the response to another SOAP adapter, a sender one, and then have my ASYNC/SINC scenario as it's described here: File - RFC - File without a BPM - Possible from SP 19.
Regards
Gonzalo
Edited by: Gonzalo del Castillo on Nov 20, 2008 11:29 AM -
Calling Operating System Commands from PL/SQL using java
Calling Operating System Commands from PL/SQL - The Java Way
wlth help of given thread link,
Calling OS Commands from Plsql
but i had user privilege problem
Declare
x Varchar2(2000);
Begin
x := OSCommand_Run('/tmp/sri/GROUP_ho.sh');
DBMS_OUTPUT.Put_Line(x);
End;
o/p;
can't exec: /tmp/sri/GROUP_ho.sh lacks user privilege
i done the grant privillage also
part
dbms_java.grant_permission('abcd', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
dbms_java.grant_permission('abcd', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
dbms_java.grant_permission('
abcd', 'SYS:java.io.FilePermission','<<ALL FILES>>', 'execute');
again
get
can't exec: /tmp/sri/GROUP_ho.sh lacks user privilege
same error;Process management at the OS level should prevent execution continuing in the calling code until the command has completed (either successfully or with error).
If the low level java code were to spawn child process threads then execution could continue, but I'm guessing the Java function your talking about doesn't do that and just calls the operating system to execute the command and waits for the returning code to come back. -
Errors calling oracle web service from pl/sql
Oracle application server version 10.1.2.2.0
Jdeveloper version 10.1.2.1.0
I have published a function of an oracle database package as a web service using jdeveloper by creating a connection to my database and right clicking on the package and selecting publish as a web service. I accepted all the defaults and deployed the web service to my application server also using jdeveloper. I have been able to invoke the web service from the url which was generated.
I now want to invoke this web service from another pl/sql procedure in the same database as the function I've published as a web service using the utl_dbws facility but get the following error
ORA-29532: Java call terminated by uncaught Java exception: javax.xml.rpc.soap.SOAPFaultException: No Deserializer found to deserialize a 'http://fujibox09/FinalTestWS-Project-context-root/FinalTestWS/:p_group_id' using encoding style 'null'. [java.lang.IllegalArgumentException]
I have amended the wsdl to look like this
<?xml version = '1.0' encoding = 'UTF-8'?>
<!--Generated by the Oracle JDeveloper 10g Web Services WSDL Generator-->
<!--Date Created: Tue Sep 29 12:32:20 BST 2009-->
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://fujibox09/FinalTestWS-Project-context-root/FinalTestWS/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://fujibox09/FinalTestWS-Project-context-root/FinalTestWS/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified"
targetNamespace="http://fujibox09/FinalTestWS-Project-context-root/FinalTestWS/">
<s:element name="totalliveusers">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="p_group_id" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="totalliveusersResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="totalliveusersResult" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="p_group_desc" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="totalliveusersSoapIn">
<wsdl:part name="parameters" element="tns:totalliveusers"/>
</wsdl:message>
<wsdl:message name="totalliveusersSoapOut">
<wsdl:part name="parameters" element="tns:totalliveusersResponse"/>
</wsdl:message>
<wsdl:portType name="totalliveusersSoap">
<wsdl:operation name="totalliveusers">
<wsdl:input message="tns:totalliveusersSoapIn"/>
<wsdl:output message="tns:totalliveusersSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="totalliveusersSoap" type="tns:totalliveusersSoap">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="totalliveusers">
<soap:operation
soapAction="http://fujibox09/FinalTestWS-Project-context-root/FinalTestWS/totalliveusers"
style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="totalliveusers">
<wsdl:port name="totalliveusersSoap" binding="tns:totalliveusersSoap">
<soap:address location="http://fujibox09/FinalTestWS-Project-context-root/FinalTestWS"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
The function has an in varchar2 parameter and an out varchar2 parameter and returns a number
Can anyone help?Hi,
On way we can call a web service is to pass the Web Service URL to UTL_HTTP package:
Sample Web Service URL
===================
lv_url :=
'http://67.97.189.151:8888/plsqlsample/dbfunc?invoke=placeOrder'
|| '&'
|| 'param0=1'
|| '&'
|| 'param1=1'
|| '&'
|| 'param2=1';
Sample Call using UTL_HTTP
=====================
SELECT UTL_HTTP.request (lv_url)
INTO lv_result
FROM DUAL;
Thank you.
Regards,
Balu -
Calling SharePoint Web Services from PL/SQL
We are trying to call SharePoint Web Services with UTL_DBWS or UTL_HTTP. We are able to call some test web services, but when it comes to using SharePoint services, we keep getting 401 errors..even when we use set_authorization.
Has anyone been able to use UTL_DBWS or UTL_HTTP to call SharePoint web services? If so, can you point us in the right direction?
ThanksAB,
I didn't realize you cannot attach documents to your post. You will have to provide me with an email address that I can send the documents to. They are a little rough (ie not commented etc) but they do illustrate the point. The basic idea is to build up the payload of the soap envelope using pl/sql. Meaning as I loop through the cursor I use each record in the cursor to build an xml string. This string of xml becomes the payload of the soap message. This could also be done using xml functionality provided by the db meaning xmlelement, xmlforest etc. The issue I ran into was the size of the message. That is why I elected to build the xml message by string concatenation as I moved through the cursor.
Ryan -
Connection close exception while calling HTTPS web service from BlackBerry 8100 using KSOAP
Hi
I am trying to call HTTPS we services using J2ME Polish application and using KSOAP.
My Application works fine on other device Blackberry Bold, curve. But on BlackBerry 8100 pearl it gives me
net.rim.device.api.io.connectionclosed exception.
Device Description : BlackBerry Pearl 8100
OS : 4.2
Please help me out in this issue.
Regards
Amit DeshpandeHi
I am trying to call HTTPS we services using J2ME Polish application and using KSOAP.
My Application works fine on other device Blackberry Bold, curve. But on BlackBerry 8100 pearl it gives me
net.rim.device.api.io.connectionclosed exception.
Device Description : BlackBerry Pearl 8100
OS : 4.2
Please help me out in this issue.
Regards
Amit Deshpande -
Oracle 9i: Help with loadjava jar files to call out web service from pl/sql
I'm trying to build a web service client using dbws_callout_utility.zip (version used for prio 10g database). I followed the articles in oracle site to loadjava jar files (soap.jar, dms.jar, ejb.jar, jssl-1_1.jar, mail.jar, servlet.jar) into Oracle DB 9i before invoke jpub to gen stub class and wrappers in oracle 9i but i have many errors such as ora-29534 and ora-29521. As consequence i could not invoke jpublisher to generate code.
Pls. help my with detail guide to overcome these errors, thanks in advance! My DB is Oracle 9.2.0.5Dear,
I have read your article, it is useful for me. But I cannot Apply to my case. Please kindly help me. Thank you.
When running, the error occurs:
1:39:31 Execution failed: ORA-20000: soapenv:Server.userException - org.xml.sax.SAXParseException: Attribute name "password" associated with an element type "user" must be followed by the ' = ' character.
My webservice Url: http://abc.com.vn:81/axis/ABC_WS_TEST.jws?wsdl
I make PL/SQL (similiar as your example)
FUNCTION INVOKESENDMT
RETURN VARCHAR2
AS
l_request soap_api.t_request;
l_response soap_api.t_response;
l_return VARCHAR2(32767);
l_url VARCHAR2(32767);
l_namespace VARCHAR2(32767);
l_method VARCHAR2(32767);
l_soap_action VARCHAR2(32767);
l_result_name VARCHAR2(32767);
p_zipcode VARCHAR2(160);
BEGIN
--p_zipcode:='''TEST'' ; ''TEST'';''84912187098'';''84912187098'';''0'';''8118'';''1'';''000001'';''ThuNghiem'';''''';
p_zipcode:='TEST';
-- Set proxy details if no direct net connection.
--UTL_HTTP.set_proxy('myproxy:4480', NULL);
--UTL_HTTP.set_persistent_conn_support(TRUE);
-- Set proxy authentication if necessary.
--soap_api.set_proxy_authentication(p_username => 'TEST',
-- p_password => 'TEST');
l_url := 'http://abc.com.vn:81/axis/ABC_WS_TEST.jws';
l_namespace := 'xmlns="' || l_url || '"';
l_method := 'sendMT';
l_soap_action := l_url || '#sendMT';
l_result_name := 'sendMTResponse';
l_request := soap_api.new_request(p_method => l_method,
p_namespace => l_namespace);
soap_api.add_parameter(p_request => l_request,
p_name => 'user password sender receiver chargedflag servicenumber messagetype messageid textcontent binarycontent',
p_type => 'xsd:string',
p_value => p_zipcode);
l_response := soap_api.invoke(p_request => l_request,
p_url => l_url,
p_action => l_soap_action);
l_return := soap_api.get_return_value(p_response => l_response,
p_name => l_result_name,
p_namespace => l_namespace);
RETURN l_return;
END; -
How to call a web service from PL/SQL?
The link to this article seems to be gone, and I can't find much information out there? Does anyone have a link that works? Or perhaps archived the old article at the bottom of this page:
http://www.oracle-base.com/articles/9i/ConsumingWebServices9i.phpDear,
I have read your article, it is useful for me. But I cannot Apply to my case. Please kindly help me. Thank you.
When running, the error occurs:
1:39:31 Execution failed: ORA-20000: soapenv:Server.userException - org.xml.sax.SAXParseException: Attribute name "password" associated with an element type "user" must be followed by the ' = ' character.
My webservice Url: http://abc.com.vn:81/axis/ABC_WS_TEST.jws?wsdl
I make PL/SQL (similiar as your example)
FUNCTION INVOKESENDMT
RETURN VARCHAR2
AS
l_request soap_api.t_request;
l_response soap_api.t_response;
l_return VARCHAR2(32767);
l_url VARCHAR2(32767);
l_namespace VARCHAR2(32767);
l_method VARCHAR2(32767);
l_soap_action VARCHAR2(32767);
l_result_name VARCHAR2(32767);
p_zipcode VARCHAR2(160);
BEGIN
--p_zipcode:='''TEST'' ; ''TEST'';''84912187098'';''84912187098'';''0'';''8118'';''1'';''000001'';''ThuNghiem'';''''';
p_zipcode:='TEST';
-- Set proxy details if no direct net connection.
--UTL_HTTP.set_proxy('myproxy:4480', NULL);
--UTL_HTTP.set_persistent_conn_support(TRUE);
-- Set proxy authentication if necessary.
--soap_api.set_proxy_authentication(p_username => 'TEST',
-- p_password => 'TEST');
l_url := 'http://abc.com.vn:81/axis/ABC_WS_TEST.jws';
l_namespace := 'xmlns="' || l_url || '"';
l_method := 'sendMT';
l_soap_action := l_url || '#sendMT';
l_result_name := 'sendMTResponse';
l_request := soap_api.new_request(p_method => l_method,
p_namespace => l_namespace);
soap_api.add_parameter(p_request => l_request,
p_name => 'user password sender receiver chargedflag servicenumber messagetype messageid textcontent binarycontent',
p_type => 'xsd:string',
p_value => p_zipcode);
l_response := soap_api.invoke(p_request => l_request,
p_url => l_url,
p_action => l_soap_action);
l_return := soap_api.get_return_value(p_response => l_response,
p_name => l_result_name,
p_namespace => l_namespace);
RETURN l_return;
END; -
Urgent: Calling web service from PL/SQl fails with XML parsing
Hi,
I am trying to call a web service from PL/SQL (using SOAP protocol and UTL_HTTP built in Package).I am using Oracle 9i .I am calling from pl/sql block invoking web service method created in java.
I am getting the below response object as a SOAP protocol, but i couldn't able to parse the SOAP.
Could you please provide the values of FirstName, LastName and ErrorDescription
declare
request_env varchar2(32767);
v_xml XMLTYPE;
l_user_first_name varchar2(100);
l_user_last_name varchar2(100);
l_error_value varchar2(100);
begin
response_env:='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<UserInfoObjResponse xmlns:axis2ns1="http://www.test.com/services">
<axis2ns1:FirstName >First Name Output</axis2ns1:FirstName>
<axis2ns1:LastName>Last Name Output</axis2ns1:LastName>
<axis2ns1:ErrorDescription />
</UserInfoObjResponse>
</soapenv:Body>
</soapenv:Envelope>';
dbms_output.put_line('Length of Request:' || length(response_env));
dbms_output.put_line ('Request: ' || response_env);
v_xml := XMLTYPE(response_env);
-- SELECT EXTRACTVALUE(v_xml, '//UserInfoObjResponse/FirstName') INTO l_user_fast_name varchar2(100); FROM DUAL;
dbms_output.put_line ('l_user_first_name: ' || l_user_first_name);
dbms_output.put_line ('l_user_last_name : ' || l_user_last_name);
dbms_output.put_line ('l_error_value: ' || l_error_value);
end;In Oracle 9i:
SQL> declare
2 response_env varchar2(32767);
3 v_xml XMLTYPE;
4 l_user_first_name varchar2(100);
5 l_user_last_name varchar2(100);
6 l_error_value varchar2(100);
7 begin
8 response_env:='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
9 <soapenv:Body>
10 <UserInfoObjResponse xmlns:axis2ns1="http://www.test.com/services">
11 <axis2ns1:FirstName >First Name Output</axis2ns1:FirstName>
12 <axis2ns1:LastName>Last Name Output</axis2ns1:LastName>
13 <axis2ns1:ErrorDescription />
14 </UserInfoObjResponse>
15 </soapenv:Body>
16 </soapenv:Envelope>';
17
18 dbms_output.put_line('Length of Request:' || length(response_env));
19 -- dbms_output.put_line ('Request: ' || response_env);
20
21 v_xml := XMLTYPE(response_env);
22
23 select EXTRACTVALUE(v_xml,'/*:Envelope/*:Body/*:UserInfoObjResponse/*:FirstName/text()') first_name,
24 EXTRACTVALUE(v_xml,'/*:Envelope/*:Body/*:UserInfoObjResponse/*:LastName/text()') last_name,
25 EXTRACTVALUE(v_xml,'/*:Envelope/*:Body/*:UserInfoObjResponse/*:ErrorDescription/text()') error_description
26 into l_user_first_name, l_user_last_name, l_error_value
27 from dual;
28
29 dbms_output.put_line ('l_user_first_name: ' || l_user_first_name);
30 dbms_output.put_line ('l_user_last_name : ' || l_user_last_name);
31 dbms_output.put_line ('l_error_value: ' || l_error_value);
32 end;
33 /
Length of Request:530
l_user_first_name: First Name Output
l_user_last_name : Last Name Output
l_error_value:
PL/SQL procedure successfully completed.In Oracle 10g:
SQL> declare
2 response_env varchar2(32767);
3 v_xml XMLTYPE;
4 l_user_first_name varchar2(100);
5 l_user_last_name varchar2(100);
6 l_error_value varchar2(100);
7 begin
8 response_env:='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
9 <soapenv:Body>
10 <UserInfoObjResponse xmlns:axis2ns1="http://www.test.com/services">
11 <axis2ns1:FirstName >First Name Output</axis2ns1:FirstName>
12 <axis2ns1:LastName>Last Name Output</axis2ns1:LastName>
13 <axis2ns1:ErrorDescription />
14 </UserInfoObjResponse>
15 </soapenv:Body>
16 </soapenv:Envelope>';
17
18 dbms_output.put_line('Length of Request:' || length(response_env));
19 -- dbms_output.put_line ('Request: ' || response_env);
20
21 v_xml := XMLTYPE(response_env);
22
23 select r.*
24 into l_user_first_name, l_user_last_name, l_error_value
25 from XMLTABLE('/' PASSING v_xml
26 COLUMNS
27 first_name varchar2(30) PATH '/*:Envelope/*:Body/*:UserInfoObjResponse/*:FirstName/text()',
28 last_name varchar2(30) PATH '/*:Envelope/*:Body/*:UserInfoObjResponse/*:LastName/text()',
29 error_description varchar2(30) PATH '/*:Envelope/*:Body/*:UserInfoObjResponse/*:ErrorDescrition/text()'
30 ) r;
31
32 dbms_output.put_line ('l_user_first_name: ' || l_user_first_name);
33 dbms_output.put_line ('l_user_last_name : ' || l_user_last_name);
34 dbms_output.put_line ('l_error_value: ' || l_error_value);
35 end;
36 /
Length of Request:530
l_user_first_name: First Name Output
l_user_last_name : Last Name Output
l_error_value:
PL/SQL procedure successfully completed.Max
http://oracleitalia.wordpress.com
Edited by: Massimo Ruocchio on Feb 14, 2010 11:55 PM
Added the first one. -
Calling web services from PL/SQL
Hi,
We have a requirement where we need to call a web services from PL/SQL.
I believe we have a PL/SQL API that allows you to consume external web services.
I was looking for other possible options too to consume web Service from PL/SQL.
Can any one suggest the other possible options , and which option is best to consume web service.
Thanks
ABAB,
I didn't realize you cannot attach documents to your post. You will have to provide me with an email address that I can send the documents to. They are a little rough (ie not commented etc) but they do illustrate the point. The basic idea is to build up the payload of the soap envelope using pl/sql. Meaning as I loop through the cursor I use each record in the cursor to build an xml string. This string of xml becomes the payload of the soap message. This could also be done using xml functionality provided by the db meaning xmlelement, xmlforest etc. The issue I ran into was the size of the message. That is why I elected to build the xml message by string concatenation as I moved through the cursor.
Ryan
Maybe you are looking for
-
I was using TB on my XP machines and they went down so I was forced to move to a Vista based laptop. It eventually crashed and so I converted my computer from Vista to win 7, Home premium. In both iterations, I have been able to set up TB and transfe
-
Fixed Asset failed to do a capitalization credit memo
Hi All financial period April - Mar I have this fixed asset capitalized on 1 May 2014, from A/P invoice at the price of 14,649.37. I have done the depreciation run for May-Jul (period 2 - 4). Now I want to do a capitalization credit memo on 1 Aug 201
-
VR error message class, set as a warning message
Hi, How can we change an error message into a warning message.. In VF05, it requires either a payer or material.. Error message number VR436 (enter partner or material) .. How can we change this to a warning message instead of error?
-
Verifaction log-invoice /2011
hi all I ve a problame while doing miro in (third party process) everything is ok it calcullating the tax even but while simulating it show the window but couldnt post.while clicking the message box it shows an error stating that-ACCOUNT 892000 HAS B
-
When will Series 4 of true Blood be available?
Just wondering how long til the new series 4 of trueblood will be available on Itunes TV Show for download?