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?
Thanks
AB,
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
Similar Messages
-
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 -
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 -
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;
/ -
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. -
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 -
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 -
New to Web Services - need to call a HTTPS web service from PL/SQL
I am new to Web Services and need to call HTTPS web service from PL/SQL program. I am using 10g Database.
I have been reading there are 2 options -
1. UTL_HTTP - with this package its possible to call HTTPS web services
2. UTL_DBWS
Questions -
1. Is it possible to call a HTTPS web service using UTL_DBWS ? I have not been able to find any information on it.
2. Can someone point me to UTL_HTTP and UTL_DBWS examples calling a HTTPS web service ?
3. The HTTPS web service that I need to call needs username/password to connect - how will I incorporate this in the pl/sql code ?
Appreciate the help.
Cheers,
newWebServicesUserHi,
1. UTL_DBWS not work for https from what I understand
2. Here is a sample example:
[http://www.oracle-base.com/articles/9i/ConsumingWebServices9i.php#]
Be careful, you must change http/1.0 IN 1.1 inside package SOAP_API.
Here is an example for a prime number where the SOAP message is already construct:
CREATE OR REPLACE procedure test_ws_2
IS
http_req utl_http.req;
http_resp utl_http.resp;
request_env varchar2(32767);
response_env varchar2(32767);
begin
-- Set proxy details if no direct net connection.
UTL_HTTP.set_proxy('http://<USER>:<PASS>@10.0.2.21:8070', NULL);
UTL_HTTP.set_persistent_conn_support(TRUE);
request_env:='<?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/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">'||
'<SOAP-ENV:Body><GetPrimeNumbers xmlns="http://microsoft.com/webservices/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'||
'<max xsi:type="xsd:int">10</max>'||
'</GetPrimeNumbers></SOAP-ENV:Body></SOAP-ENV:Envelope>';
dbms_output.put_line('Length of Request:' || length(request_env));
dbms_output.put_line ('Request: ' || request_env);
http_req := utl_http.begin_request('http://www50.brinkster.com/vbfacileinpt/np.asmx','POST', 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', '"http://microsoft.com/webservices/GetPrimeNumbers"');
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 test_ws_2;
Otherwice for testing url, i recommand you to use that function: Re: Error using UTL_HTTP over HTTPS
it's a verry helpful function when you have an error.
wrote:
When testing using UTL_HTTP, you MUST ensure that you open a new session after importing the SSL certificates into your Wallet,
as I've learned (the hard way) that existing sessions point to the wallet contents that were present when the session was opened.
If you don't realise/know this, it can cause a lot of additional frustration during testing, when you keep getting the ORA-29024 exception AFTER
you've imported the SSL certificates................. ;) 3. i think you can use that after the begin_request but not sure :
UTL_HTTP.set_authentication(r => http_req,
username => ,
password => ,
scheme => ,
for_proxy => );
Edited by: Malebodja on Oct 22, 2009 6:53 AM
Edited by: Malebodja on Oct 22, 2009 6:55 AM -
Create an SAP Web Service Consumer (calling External Sharepoint Web Service from ABAP)
hi all,
i am trying to
Create an SAP Web Service Consumer (calling sharepoint Web Service from ABAP) using blog given on following link
Create an SAP Web Service Consumer (calling External Web Service from ABAP)
but when i am using my url at the end of step 3, i am getting error as follows:
i dont want to use local file option. Can anyone help me in this??
thanks in advance
regards,
SDSHi SDS,
you recieved a http 404 error when trying to access the Sharepoint Web service. Http 404 indicates that the resource is not reachable (cf. HTTP 404 - Wikipedia, the free encyclopedia). There could be different reasons for that. I'd suggest rubble checking the URL of the Web service first. Try to access it from a browser on you desktop. If the URL is correc. Most likely the SAP system is not able to connect to the URL. This could, for example, be due to some firewall restrictions. You should ask a SAP Basis colleague if they are able to access the URL of the Web service from the server on which the SAP system is running.
Christian -
How to call COPY web service from sharepoint in SAP
Hello Experts,
I want to call COPY web service from SharePoint in SAP web dynpro / JAVA application.
However, when I try to connect to web service and download wsdl using http:// <hostname:port>/_vti_bin/copy.asmx?wsdl
it results in Unauthorized error and doesnt complete the setup. Detail error is :
Error occurred while downloading WSIL file. Error message: Deserializing xml stream http:// <hostname:port>/_vti_bin/copy.asmx?wsdl
failed.com.sap.engine.services.webservices.espbase.wsdl.exceptions.WSDLException: Invalid Response Code: (401) Unauthorized. The requested URL was:"Connect to
http:// <hostname:port>/_vti_bin/copy.asmx?wsdl , used user to connect: userid"
I am trying to connect with server user account. Any idea on what authorizations might be required or any help on the scenario .
-AbhijeetHere's an example on how to delete a list item, hopefully this helps
package com.jw.sharepoint.examples;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.microsoft.sharepoint.webservices.CopySoap;
import com.microsoft.sharepoint.webservices.GetListItems;
import com.microsoft.sharepoint.webservices.GetListItemsResponse;
import com.microsoft.sharepoint.webservices.ListsSoap;
import com.microsoft.sharepoint.webservices.UpdateListItems.Updates;
import com.microsoft.sharepoint.webservices.UpdateListItemsResponse.UpdateListItemsResult;
public class SharePointDeleteListItemExample extends SharePointBaseExample {
private String delete = null;
private String deleteListItemQuery = null;
private String queryOptions = null;
private static final Log logger = LogFactory.getLog(SharePointUploadDocumentExample.class);
private static Properties properties = new Properties();
public Properties getProperties() {
return properties;
* @param args
public static void main(String[] args) {
logger.debug("main...");
SharePointDeleteListItemExample example = new SharePointDeleteListItemExample();
try {
example.initialize();
CopySoap cp = example.getCopySoap();
example.uploadDocument(cp, properties.getProperty("copy.sourceFile"));
ListsSoap ls = example.getListsSoap();
example.executeQueryAndDelete(ls);
} catch (Exception ex) {
logger.error("Error caught in main: ", ex);
public void executeQueryAndDelete(ListsSoap ls) throws Exception {
Date today = Calendar.getInstance().getTime();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String formattedDate = simpleDateFormat.format(today);
String queryFormatted = String.format(deleteListItemQuery,formattedDate);
GetListItems.QueryOptions msQueryOptions = new GetListItems.QueryOptions();
GetListItems.Query msQuery = new GetListItems.Query();
msQuery.getContent().add(createSharePointCAMLNode(queryFormatted));
msQueryOptions.getContent().add(createSharePointCAMLNode(this.queryOptions));
GetListItemsResponse.GetListItemsResult result = ls.getListItems(
properties.getProperty("folder"), "", msQuery, null, "",
msQueryOptions, "");
writeResult(result.getContent().get(0), System.out);
Element element = (Element) result.getContent().get(0);
NodeList nl = element.getElementsByTagName("z:row");
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
String id = node.getAttributes().getNamedItem("ows_ID").getNodeValue();
String fileRefRelativePath = node.getAttributes().getNamedItem("ows_FileRef").getNodeValue();
logger.debug("id: " + id);
logger.debug("fileRefRelativePath: " + fileRefRelativePath);
String fileRef = properties.getProperty("delete.FileRef.base") + fileRefRelativePath.split("#")[1];
logger.debug("fileRef: " + fileRef);
deleteListItem(ls, properties.getProperty("folder"), id, fileRef);
public void deleteListItem(ListsSoap ls, String listName, String listId, String fileRef) throws Exception {
String deleteFormatted = String.format(delete, listId, fileRef);
Updates u = new Updates();
u.getContent().add(createSharePointCAMLNode(deleteFormatted));
UpdateListItemsResult ret = ls.updateListItems(listName, u);
writeResult(ret.getContent().get(0), System.out);
public void initialize() throws Exception {
logger.info("initialize()...");
properties.load(getClass().getResourceAsStream("/SharePointDeleteListItemExample.properties"));
super.initialize();
this.delete = new String(readAll(new File(this.getClass().getResource("/Delete.xml").toURI())));
this.deleteListItemQuery = new String(readAll(new File(this.getClass().getResource("/DeleteListItemQuery.xml").toURI())));
this.queryOptions = new String(readAll(new File(this.getClass().getResource("/QueryOptions.xml").toURI())));
Brandon James SharePoint Developer/Administrator -
Calling BI Publisher Web Service from pl/sql
I am trying to call the BI publisher web service from pl/sql.
I get the following response back
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
<faultstring>no SOAPAction header!</faultstring>
<detail>
<ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">my-obiee</ns2:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
The bit that concerns me is
<faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
<faultstring>no SOAPAction header!</faultstring>
The code that I used to call this is
DECLARE
req utl_http.req;
resp utl_http.resp;
value VARCHAR2(1024);
p_data_type varchar2(4000):= 'application/soap+xml;';
p_data_in VARCHAR2(3000) :=
'<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pub="http://xmlns.oracle.com/oxp/service/PublicReportService">
<soapenv:Body>
<pub:scheduleReport xmlns:pub="http://xmlns.oracle.com/oxp/service/PublicReportService">
<scheduleRequest>
<deliveryRequest>
<ftpOption>
<ftpServerName>ino-ed-oel2.inoapps.com</ftpServerName>
<ftpUserName>*******</ftpUserName>
<ftpUserPassword>*****</ftpUserPassword>
<remoteFile>/opt/UAT/db/tech_st/11.1.0/employees.pdf</remoteFile>
</ftpOption>
</deliveryRequest>
<reportRequest>
<attributeFormat>pdf</attributeFormat>
<reportAbsolutePath>http://10.100.100.44:9704/xmlpserver/~administrator/XXXXXXX.xdo</reportAbsolutePath>
<parameterNameValues>
<item>
<name>dname</name>
<multiValuesAllowed>false</multiValuesAllowed>
<values>
<item>153002</item>
</values>
</item>
</parameterNameValues>
</reportRequest>
<userJobName>BILL</userJobName>
</scheduleRequest>
<userID>******</userID>
<password>******</password>
</pub:scheduleReport>
</soapenv:Body>
</soapenv:Envelope>';
BEGIN
--utl_http.set_proxy('proxy.my-company.com', 'corp.my-company.com');
req := utl_http.begin_request('http://10.100.100.44:9704/xmlpserver/services/PublicReportService?wsdl', 'POST');
utl_http.set_header(req, 'content-type', p_data_type);
utl_http.set_header(req, 'content-length', length(p_data_in));
utl_http.set_header(req, 'User-Agent', 'Mozilla/4.0');
utl_http.write_text(req, p_data_in);
resp := utl_http.get_response(req);
dbms_output.put_line ('status code: ' || resp .status_code);
dbms_output.put_line ('reason phrase: ' || resp .reason_phrase);
LOOP
utl_http.read_line(resp, value, TRUE);
dbms_output.put_line(value);
END LOOP;
utl_http.end_response(resp);
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
END;
Any help would be greatly receivedI had the same problem this morning. You need to add a line to the HTTP header to declare a value for SOAPAction.
You can set this as an empty string, but for some reason it is required.
Try adding this among your header declarations:
utl_http.set_header(req, 'SOAPAction', '');
Maybe you are looking for
-
Billing document creation problem
Hi All, i am not able create a billing document (vf01)with reference to a delivery order.It is giving error as billing document can not be saved due to error in account determination.can u please tell me how can i solve this problem.
-
How to go from M4V to DVD?
Hi all - I created a Slideshow in iPhoto and exported it to mobile, medium and display versions of M4V. I can now view them from iPhone and iPad and within iTunes, but I'd really prefer to get the Display version to DVD so I can distribute it to the
-
"failed to respond/connect" fix
I have a Dual G4 Mirror Drive Door running Tiger. After upgrading to Tiger, iChat AV wasn't working, like I've seen in many other posts. After culling this discussion board for a setup like mine: iChat via tower connected to Airport Extreme base stat
-
"Reporting a problem" doesn't let you report a problem
I go to my account, click purchase history, click report a problem, click report a problem next to the billing item that is the problem and end up at the iTunes general support page. From there I try to find a contact us. I do but it takes me to a se
-
About CallByteMethodA Function
Hi you all: I have some problem about CallByteMethodA function. This is what my java code looks like: public void setDS_INFO_mac(byte[] mac) { for( int i = 0; i < mac.length; ++i ) { this.ds_info.mac[i] = mac; This is what my c code looks like: jobje