Call MTOM web service using pl/sql (utl_http)
Hi All,
Is anyone able to call a MTOM web service using utl_http from pl/sql ?
A typical request looks like this:
--uuid:fd1fbed8-7042-4673-a304-becc1ffb037f+id=1
Content-ID: <http://tempuri.org/0>
Content-Transfer-Encoding: 8bit
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body>......</s:Body></s:Envelope>
uuid:fd1fbed8-7042-4673-a304-becc1ffb037f+id=1
A microsoft C# tool is provided to generate some requests and using fiddler I can see the content type is in the header as well as in the request. In the requests it doesn't contain the UID. Connection is set to keep-alive, is that possible using pl/sql ?
The part that builds the header looks like:
l_http_request := UTL_HTTP.begin_request(url => 'http://' || l_host_name || ':' || l_port || '/CRUDService.svc', method => 'POST', http_version => 'HTTP/1.1');
UTL_HTTP.set_header(l_http_request, 'Host', l_host_name || ':' || l_port);
UTL_HTTP.set_header(l_http_request, 'SOAPAction', '"action"');
UTL_HTTP.set_header(l_http_request, 'Content-Length', LENGTH(l_string_request));
UTL_HTTP.set_header(l_http_request, 'Content-ID', '<http://tempuri.org/0>');
UTL_HTTP.set_header(l_http_request, 'Content-Transfer-Encoding', '8bit');
UTL_HTTP.set_header(l_http_request, 'Content-Type', 'multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:fd1fbed8-7042-4673-a304-becc1ffb037f+id=1";start-info="text/xml"');
I've played with the request by adding or removing information, the http response is (400) "Bad Request - Invalid Header", so should be somewhere in the header? Anyone ideas?
Kind regards,
Michiel
HI Michiel
I am also trying to achieve something similar to that. I am trying to call a web service that sends an xml attachment over MTOM? Kindly, let me know if this was achievable from your end? I mean how did the issue got resolved.
thanks
vijay
Similar Messages
-
Error invoking SSL web service using pl sql UTL_HTTP
Web Services Gurus,
I am invoking a secure web service based on the following WSDL file from a pl/sql program using UTL_HTTP package.
The web service is secure and prompts for authentication.
The web services certificate is imported in Oracle Wallet on Database Server.
I am listing the WSDL file, the pl/sql code and error message as follows -
1. The WSDL file -
<definitions
name="Webservice"
targetNamespace="http://webservice.airclic.com/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://webservice.airclic.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>
<types>
<xs:schema targetNamespace="http://webservice.airclic.com/" version="1.0" xmlns:tns="http://webservice.airclic.com/"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Exception" type="tns:Exception"/>
<xs:element name="sendAuthenticationResponse" type="tns:sendAuthenticationResponse"/>
<xs:element name="sendAuthenticationResponseResponse" type="tns:sendAuthenticationResponseResponse"/>
<xs:complexType name="AuthenticationResponse">
<xs:complexContent>
<xs:extension base="tns:Response">
<xs:sequence>
<xs:element name="success" type="xs:boolean"/>
<xs:element name="username" type="xs:string"/>
<xs:element minOccurs="0" name="password" type="xs:string"/>
<xs:element minOccurs="0" name="firstName" type="xs:string"/>
<xs:element minOccurs="0" name="lastName" type="xs:string"/>
<xs:element minOccurs="0" name="email" type="xs:string"/>
<xs:element minOccurs="0" name="active" type="xs:boolean"/>
<xs:element minOccurs="0" name="timeZone" type="xs:string"/>
<xs:element minOccurs="0" name="group" type="xs:string"/>
<xs:element minOccurs="0" name="role" type="xs:string"/>
<xs:element minOccurs="0" name="errorCode" type="xs:string"/>
<xs:element minOccurs="0" name="errorMessage" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="DispatchEvent"></xs:complexType>
<xs:complexType name="sendAuthenticationResponse">
<xs:sequence>
<xs:element minOccurs="0" name="authenticationResponse" type="tns:AuthenticationResponse"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="sendAuthenticationResponseResponse">
<xs:sequence/>
</xs:complexType>
<xs:simpleType name="status"></xs:simpleType>
<xs:simpleType name="source"></xs:simpleType>
<xs:simpleType name="eventType"></xs:simpleType>
</xs:schema>
</types>
<message name="Webservice_sendAuthenticationResponse">
<part name="sendAuthenticationResponse" element="tns:sendAuthenticationResponse"/>
</message>
<message name="Webservice_sendAuthenticationResponseResponse">
<part name="sendAuthenticationResponseResponse" element="tns:sendAuthenticationResponseResponse"/>
</message>
<portType name="Webservice">
<operation name="sendAuthenticationResponse" parameterOrder="sendAuthenticationResponse">
<input message="tns:Webservice_sendAuthenticationResponse"/>
<output message="tns:Webservice_sendAuthenticationResponseResponse"/>
<fault name="Exception" message="tns:Exception"/>
</operation>
</portType>
<binding name="WebserviceBinding" type="tns:Webservice">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="sendAuthenticationResponse">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="Exception">
<soap:fault name="Exception" use="literal"/>
</fault>
</operation>
</binding>
<service name="Webservice">
<port name="WebservicePort" binding="tns:WebserviceBinding">
<soap:address location="https://host.airclic.com:443/webservice/product/fieldservice/v1/Webservice"/>
</port>
</service>
</definitions>
2. The pl/sql code that calls the web service operation sendAuthenticationResponse
procedure send_auth_response
as
soap_request varchar2(30000);
soap_respond varchar2(30000);
http_req utl_http.req;
http_resp utl_http.resp;
resp XMLType;
i integer;
begin
-- initiate wallet for AirClic certificate
dbms_output.put_line ('1');
utl_http.set_wallet('file:/etc/oracle/wallet','<wallet password>');
-- create soap request
dbms_output.put_line ('2');
soap_request:= '<?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:sendAuthenticationResponse xmlns="https://host.airclic.com:443/webservice/product/fieldservice/v1/Webservice" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<success xsi:type="xsd:boolean">true</success>
<username xsi:type="xsd:string">changlanih</username>
<password xsi:type="xsd:string">abcd1234</password>
<firstName xsi:type="xsd:string">hero</firstName>
<lastName xsi:type="xsd:string">changlani</lastName>
<email xsi:type="xsd:string">[email protected]</email>
<active xsi:type="xsd:boolean">true</active>
<timeZone xsi:type="xsd:string">eastern</timeZone>
<group xsi:type="xsd:string">Northeast</group>
<role xsi:type="xsd:string">Service Manager</role>
<errorCode xsi:type="xsd:string"></errorCode>
<errorMessage xsi:type="xsd:string"></errorMessage>
</ns1:sendAuthenticationResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>';
-- request that exceptions are raised for error Status Codes
dbms_output.put_line ('3');
utl_http.set_response_error_check (true);
-- allow testing for exceptions like UTL_HTTP.http_server_error
dbms_output.put_line ('4');
utl_http.set_detailed_excp_support (true);
--utl_http.set_transfer_timeout (ln_time_out);
dbms_output.put_line ('5');
utl_http.set_body_charset ('UTF-8');
-- begin request
dbms_output.put_line ('5.5');
http_req:= utl_http.begin_request
('https://host.airclic.com:443/webservice/product/fieldservice/v1/Webservice/sendAuthenticationResponse', ------ is the url correct here ?
'POST',
'HTTP/1.1'
dbms_output.put_line ('6');
utl_http.set_authentication(http_req, '<username for webservice>', '<password for webservice user>');
dbms_output.put_line ('7');
utl_http.set_persistent_conn_support (http_req, false);
dbms_output.put_line ('8');
utl_http.set_header(http_req, 'Content-Type', 'text/xml'); -- since we are dealing with plain text in XML documents
dbms_output.put_line ('9');
utl_http.set_header(http_req, 'Content-Length', length(soap_request));
dbms_output.put_line ('10');
utl_http.set_header(http_req, 'SOAPAction', ''); -- required to specify this is a SOAP communication
dbms_output.put_line ('11');
utl_http.write_text(http_req, soap_request);
dbms_output.put_line ('12');
http_resp := utl_http.get_response(http_req);
-- debug messages
DBMS_OUTPUT.PUT_LINE('-------utl_http.get_response---------------------');
DBMS_OUTPUT.PUT_LINE('http_resp.status_code is :'||http_resp.status_code );
DBMS_OUTPUT.PUT_LINE('http_resp.reason_phrase is :'||http_resp.reason_phrase);
DBMS_OUTPUT.PUT_LINE('http_resp.http_version is :'||http_resp.http_version);
DBMS_OUTPUT.PUT_LINE('http_resp.private_hndl is :'||http_resp.private_hndl);
DBMS_OUTPUT.PUT_LINE('-------utl_http.get_response----------------------');
utl_http.read_text(http_resp, soap_respond);
dbms_output.put_line ('13');
utl_http.end_response(http_resp);
dbms_output.put_line ('14');
resp := XMLType.createXML(soap_respond);
dbms_output.put_line ('15');
resp := resp.extract('/soap:Envelop/soap:Body/child::node()',
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"');
i:=0;
dbms_output.put_line ('16');
loop
dbms_output.put_line(substr(soap_respond, 1 + i * 255, 250));
i := i + 1;
if (i * 250) > length(soap_respond) then
exit;
end if;
end loop;
exception
when utl_http.request_failed then
dbms_output.put_line('request failed: ' || utl_http.get_detailed_sqlerrm);
when utl_http.http_server_error then
dbms_output.put_line('server error: ' || utl_http.get_detailed_sqlerrm);
when utl_http.http_client_error then
dbms_output.put_line('client error: ' || utl_http.get_detailed_sqlerrm);
when others then
dbms_output.put_line(sqlerrm);
end send_auth_response;
3. Output when I run the send_auth_response procedure
Connecting to the database cpdev.
1
2
3
4
5
5.5
ORA-12560: TNS:protocol adapter error
Process exited.
Disconnecting from the database cpdev.
Comments -
The web service operation only has input message. The input message consists of a complex type as seen in WSDL.
Questions -
1. This is my first attempt in invoking a web service from pl/sql program. Is the code in SOAP body correct as mapped to the complex type in WSDL ?
2. As seen from the dbms_out - the last message before ORA-12560 is 5.5, that means the call is erroring at following code line -
http_req:= utl_http.begin_request ------ what am I doing wrong here ?
3. The web service is SSL as seen from WSDLand needs a username/password for access - which is being performed by following code line -
utl_http.set_authentication(http_req, '<username for webservice>', '<password for webservice user>'); ------- is that correct ?
4. I am not using any proxy server - should I be using it ? When is it necessary to use proxy ?
Appreciate any help.
Thanx.Oracle is hosted by HOST A - this is where the pl/sql program resides.
The Web Service being accessed by pl/sql program is hosted by HOST B and there are 4 firewalls in between.
Oracle was not even able to establish connection to web services host.
Escalated the issue with networking folks and they resolved the connectivity problem.
Hope that helps. -
[SOLVED] Call an esb service using PL/SQL utl_http
I would like to call an esb service using the UTL_HTTP package but I'm always getting the following exception: ORA-29266: end-of-body reached.
My ESB uses an xml document as input-parameter and I'm not defining this in my procedure, how can I use a document-style parameter when calling the webservice.
Could someboy point me out how to accomplish this functionality?
If tried the examples about bpel procedures and utl_dbws and these work for bpel processes but not for esb services.Hi aprt of my article:
http://orasoa.blogspot.com/2006/10/calling-bpel-process-from-raw-plsql.html
Can you call the ESB service with the SOAPUi.org tool? If this works, than you must create the same request from PLSQL.
Marc -
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 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 -
Calling a web service using UTL_DBWS
Hello,
I am trying to call a web service froma PL/SQL procedure using UTL_DBWS. I've been able to use a different method to determine that the web service is working correctly, so I know my problem is somewhere within my UTL_DBWS call. It seems like my call to the web service is not authenticating correctly. What I would like to do is be able to take a look at the XML header that is created by UTL_DBWS based on the parameters I have supplied, in order to ensure that everything is correct. Does anyone know a way to do this?
Thanks,
JasonHello,
I am trying to call a web service froma PL/SQL procedure using UTL_DBWS. I've been able to use a different method to determine that the web service is working correctly, so I know my problem is somewhere within my UTL_DBWS call. It seems like my call to the web service is not authenticating correctly. What I would like to do is be able to take a look at the XML header that is created by UTL_DBWS based on the parameters I have supplied, in order to ensure that everything is correct. Does anyone know a way to do this?
Thanks,
Jason -
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;
/ -
URGENT: Content Services using PL/sql utl_http
I'm using Oracle Collaboration Suite Content Services Version 10.1.2.0.0 (Oracle 10g Enterprise Edition Release 10.1.0.4.0).
Using PL/sql, I want to be able to retrieve a html document stored in a folder in Content Services, and store the contents of that document in a table.
I can retrieve and store the contents of the document if it stored anywhere - I just can't when the document resides in Content Services.
Within PL/sql I am authenticating using utl_http.set_authentication, then using utl_http.request_pieces.
I'm not getting an error message, just the "<" character stored in my table.
Can I not use utl_http.request_pieces for retrieving a document in Content Services?
Thanks
PaulHI Michiel
I am also trying to achieve something similar to that. I am trying to call a web service that sends an xml attachment over MTOM? Kindly, let me know if this was achievable from your end? I mean how did the issue got resolved.
thanks
vijay -
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 -
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; -
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 -
How call a web service WCF pl/sql
Hi,
I developed a web services using Visual Studio .NET Framework 4.0, and I need call this web service from Store procedure in Oracle 10g, but I don't have Idea how. I have seen some examples in web but that examples not work when I've used.
My web service is developed using WCF and It has the address:
http://10.200.53.250/PeajeElect/Bcac.PeajeElect.Agente_Servicio_ETC.svc
The config specification is:
<endpoint address="" binding="basicHttpBinding" contract="Bcac.PeajeElect.IAgente_Servicio_ETC" bindingConfiguration="TheBasicBindingConfig">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
Somebody can helppe me, please
And the wsdl specification is:
<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions name="Agente_Servicio_ETC" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
- <wsdl:types>
- <xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://win-r6ddgayo3y4/PeajeElect/Bcac.PeajeElect.Agente_Servicio_ETC.svc?xsd=xsd0" namespace="http://tempuri.org/" />
<xsd:import schemaLocation="http://win-r6ddgayo3y4/PeajeElect/Bcac.PeajeElect.Agente_Servicio_ETC.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
</xsd:schema>
</wsdl:types>
- <wsdl:message name="IAgente_Servicio_ETC_ConsultaDeTransacciones_InputMessage">
<wsdl:part name="parameters" element="tns:ConsultaDeTransacciones" />
</wsdl:message>
- <wsdl:message name="IAgente_Servicio_ETC_ConsultaDeTransacciones_OutputMessage">
<wsdl:part name="parameters" element="tns:ConsultaDeTransaccionesResponse" />
</wsdl:message>
- <wsdl:message name="IAgente_Servicio_ETC_ListaDeTags_InputMessage">
<wsdl:part name="parameters" element="tns:ListaDeTags" />
</wsdl:message>
- <wsdl:message name="IAgente_Servicio_ETC_ListaDeTags_OutputMessage">
<wsdl:part name="parameters" element="tns:ListaDeTagsResponse" />
</wsdl:message>
- <wsdl:message name="IAgente_Servicio_ETC_ResultadoListasDeTags_InputMessage">
<wsdl:part name="parameters" element="tns:ResultadoListasDeTags" />
</wsdl:message>
- <wsdl:message name="IAgente_Servicio_ETC_ResultadoListasDeTags_OutputMessage">
<wsdl:part name="parameters" element="tns:ResultadoListasDeTagsResponse" />
</wsdl:message>
- <wsdl:message name="IAgente_Servicio_ETC_TagsPorNumeroDocumento_InputMessage">
<wsdl:part name="parameters" element="tns:TagsPorNumeroDocumento" />
</wsdl:message>
- <wsdl:message name="IAgente_Servicio_ETC_TagsPorNumeroDocumento_OutputMessage">
<wsdl:part name="parameters" element="tns:TagsPorNumeroDocumentoResponse" />
</wsdl:message>
- <wsdl:message name="IAgente_Servicio_ETC_Echo_InputMessage">
<wsdl:part name="parameters" element="tns:Echo" />
</wsdl:message>
- <wsdl:message name="IAgente_Servicio_ETC_Echo_OutputMessage">
<wsdl:part name="parameters" element="tns:EchoResponse" />
</wsdl:message>
- <wsdl:message name="IAgente_Servicio_ETC_ws_add_InputMessage">
<wsdl:part name="parameters" element="tns:ws_add" />
</wsdl:message>
- <wsdl:message name="IAgente_Servicio_ETC_ws_add_OutputMessage">
<wsdl:part name="parameters" element="tns:ws_addResponse" />
</wsdl:message>
- <wsdl:portType name="IAgente_Servicio_ETC">
- <wsdl:operation name="ConsultaDeTransacciones">
<wsdl:input wsaw:Action="http://tempuri.org/IAgente_Servicio_ETC/ConsultaDeTransacciones" message="tns:IAgente_Servicio_ETC_ConsultaDeTransacciones_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IAgente_Servicio_ETC/ConsultaDeTransaccionesResponse" message="tns:IAgente_Servicio_ETC_ConsultaDeTransacciones_OutputMessage" />
</wsdl:operation>
- <wsdl:operation name="ListaDeTags">
<wsdl:input wsaw:Action="http://tempuri.org/IAgente_Servicio_ETC/ListaDeTags" message="tns:IAgente_Servicio_ETC_ListaDeTags_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IAgente_Servicio_ETC/ListaDeTagsResponse" message="tns:IAgente_Servicio_ETC_ListaDeTags_OutputMessage" />
</wsdl:operation>
- <wsdl:operation name="ResultadoListasDeTags">
<wsdl:input wsaw:Action="http://tempuri.org/IAgente_Servicio_ETC/ResultadoListasDeTags" message="tns:IAgente_Servicio_ETC_ResultadoListasDeTags_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IAgente_Servicio_ETC/ResultadoListasDeTagsResponse" message="tns:IAgente_Servicio_ETC_ResultadoListasDeTags_OutputMessage" />
</wsdl:operation>
- <wsdl:operation name="TagsPorNumeroDocumento">
<wsdl:input wsaw:Action="http://tempuri.org/IAgente_Servicio_ETC/TagsPorNumeroDocumento" message="tns:IAgente_Servicio_ETC_TagsPorNumeroDocumento_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IAgente_Servicio_ETC/TagsPorNumeroDocumentoResponse" message="tns:IAgente_Servicio_ETC_TagsPorNumeroDocumento_OutputMessage" />
</wsdl:operation>
- <wsdl:operation name="Echo">
<wsdl:input wsaw:Action="http://tempuri.org/IAgente_Servicio_ETC/Echo" message="tns:IAgente_Servicio_ETC_Echo_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IAgente_Servicio_ETC/EchoResponse" message="tns:IAgente_Servicio_ETC_Echo_OutputMessage" />
</wsdl:operation>
- <wsdl:operation name="ws_add">
<wsdl:input wsaw:Action="http://tempuri.org/IAgente_Servicio_ETC/ws_add" message="tns:IAgente_Servicio_ETC_ws_add_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IAgente_Servicio_ETC/ws_addResponse" message="tns:IAgente_Servicio_ETC_ws_add_OutputMessage" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="BasicHttpBinding_IAgente_Servicio_ETC" type="tns:IAgente_Servicio_ETC">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="ConsultaDeTransacciones">
<soap:operation soapAction="http://tempuri.org/IAgente_Servicio_ETC/ConsultaDeTransacciones" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="ListaDeTags">
<soap:operation soapAction="http://tempuri.org/IAgente_Servicio_ETC/ListaDeTags" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="ResultadoListasDeTags">
<soap:operation soapAction="http://tempuri.org/IAgente_Servicio_ETC/ResultadoListasDeTags" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="TagsPorNumeroDocumento">
<soap:operation soapAction="http://tempuri.org/IAgente_Servicio_ETC/TagsPorNumeroDocumento" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="Echo">
<soap:operation soapAction="http://tempuri.org/IAgente_Servicio_ETC/Echo" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="ws_add">
<soap:operation soapAction="http://tempuri.org/IAgente_Servicio_ETC/ws_add" 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="Agente_Servicio_ETC">
- <wsdl:port name="BasicHttpBinding_IAgente_Servicio_ETC" binding="tns:BasicHttpBinding_IAgente_Servicio_ETC">
<soap:address location="http://win-r6ddgayo3y4/PeajeElect/Bcac.PeajeElect.Agente_Servicio_ETC.svc" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>user5514643 wrote:
Can you give some tip about how connect the web service ?The HTTP protocol obviously need to be used. Oracle provides a couple of HTTP client (web browser like) interfaces. Obviously there is no rendering engine/DOM in PL/SQL as this does not make much sense in a server side language. As a web service typically returns XML, that is not a problem as XML is something that servers need to deal with - and Oracle fully supports XML via SQL, PL/SQL and database structures.
A basic example of how to use the UTL_HTTP interface for interacting with a web service is in {message:id=4205205}. If you scroll up in that thread, you will also see more complex approaches of loading the web service WSDL and using that to make calls to the service - something that involves too many moving parts and Java unnecessarily. -
Asynchronous call to web servie using pl/sql
1) How do I make an aynschronous call uisng pl/sql. I am currently using utl_http.
But it is expecting me to get repsonse using utl_http.get_response.
Is there anyway I can make asynchronous call to web service? Please give me examples if any.Web services are NOT asynchronous as the HTTP application protocol is not asynchronous. A web service cannot (as an sync callback event) initiate a call to the web browser (client app) - as the web browser does not have a tcp listening endpoint. The web service must respond using the EXISTING tcp session established via a connect() call from the browser.
PL/SQL code executes in a dedicated or shared server process. Execution is serialised. So asynchronous calls are not supported and non-existent. Again, async processing requires some from of notification (callback event, message handler or signal interrupt handler) to inform the main process (while it is executing code), that the async call has completed.
And this does not exist in PL/SQL processing for very good reasons. (Oracle would have been one of the most unstable products on the market if it did support async PL/SQL processing, as 99% of developers would not understand how to use it correctly, and would have severely violated the fundamental concurrency and MVCC principles)
What can be done via PL/SQL (and SQL) is parallel processing - not to be confused with async processing. The API in PL/SQL to use for that is DBMS_PARALLEL_EXECUTE. You can also self roll this using DBMS_JOB or DBMS_SCHEDULER.
No default IPC exists for inter process communication between parallel processes. If IPC is needed, it needs to be manually coded using a standard SQL table (where row locking provides for mutexes and semaphores), or something like DBMS_PIPE. -
Fault while calling a Web service using SOAP 1.2
Hi ,
I have created a simple PL/SQL web service using Jdeveloper from PL/SQL using SOAP 1.2.
But while i call that from PL/SQL, i am getting a version mismatch.
While the same service created from SOAP 1.1 is working fine.
Can anyone Help???Yip - Acrobat or Reader Extensions are needed.
Try right click on the PDF and open in Internet Explorer and try your submit (hopefully the domain is trusted) -
How can I call a web service using JAVAscript in LCD
hi guys,
I know it can call a WSDL in LCD, but I have not any WSDL web service , and I have a REST web service ,how can I call this REST web service in LCD? I checked some documents and found nothing...if it's possible that it can call a REST web service using JAVAScript code, I mean I can program some code to call this web service ?
thanks,
JesseHi Jesse,
You can do GET, PUT and POST using FormCalc, so you should be able to access a REST web service.
There is a example of accessing a RSS feed in this thread, http://forums.adobe.com/message/5695433#5695433
Regards
Bruce
Maybe you are looking for
-
Updation of condition type in conditions tab while creation of sales order
Hi folks I have added one field called price key in Sales B screen of VA01 in item level. When user will input price key here and then put enter. Then the Price should be updated in Conditions tab i.e the condition type will be updated in conditions
-
Every time I click on my ebooks in the .epub format, I get a dialog box that asks me which program I want to use to open the file, or if I wish to save it. When I Firefox to open the file, Firefox simply opens another tab with another dialog box and
-
What technology to use to store a huge list of name-value pairs?
Hi: I have a list of name value pairs (the size of the list is ~500). I get the name from the request parameter, and depending on the value for that, I have to display images on my webpage. How should I go about this? Should I use a Hashtable to stor
-
Multiple CFFORMs in a page w/ binding CFSELECTS
Howdy all. I have a page that has two CFFORMs, each uniquely named (form1 & form2 for example). Each form is essentially the same - each one has a cfselect with States pulled from a common query and also has a bound cfselect that shows the Area Codes
-
I don't know if there's a definitive / specific answer for this question but it's one thing I can't seem to really understand. I've read the 11g R2 docs which advise you that if you're using Bash$ in Linux, then you're going to add entries in your $.