[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

Similar Messages

  • 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

  • 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.

  • 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
    Paul

    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

  • 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?
    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

  • 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,
    Jason

    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,
    Jason

  • Calling two Business service using split join in osb

    Hi,
    While trying to call two business service using Split Join in osb i am getting selection failure message in Bpel em console. i am using invoke activity to invoke the BS and assign to assign the input. in the assign i am assigning *$request.payload/input* to input.payload . In the em console i am getting input like this
    receiveInput
    Jun 19, 2012 5:05:45 PM Received "process" call from partner "bpelprocess1_client"
    <payload>
    <inputVariable>
    <part name="payload">
    <client:process>xxxxx</client:process>
    </part>
    </inputVariable>
    Assign (pending)
    Jun 19, 2012 5:05:48 PM Error in evaluate <from> expression at line "65". The result is empty for the XPath expression : "/client:process/client:input".
    <payload>
    <client:process>xxxxxx</client:process>
    Jun 19, 2012 5:05:48 PM The following exception occurred while attempting to execute operation copy at line 63
    <payload>
    <bpelFault>
    <faultType>0</faultType>
    <selectionFailure/>
    </bpelFault>
    Jun 19, 2012 5:05:57 PM "BPELFault" has not been caught by a catch block.
    Jun 19, 2012 5:06:00 PM The transaction was rolled back. The work performed for bpel instance "650002" was rolled back, but the audit trail has been saved for this instance.If this is a sync request, please resubmit the request from the client. If it is an async request, please recover from the recovery console by resubmitting the invoke message.
    Can anyone help on this?
    Thanks in Advance...

    maybe this one helps a bit, it's the same pattern
    http://www.xenta.nl/blog/2011/07/03/oracle-service-bus-implementing-aggregator-pattern-by-use-of-split-join/
    if you're using a dynamic split join easiest way is to do something like
    assing <yourresponse/> to $response
    at this moment your assign an empty placeholder to the response variable
    now you go into the for-each looping and for each iteration you need to insert the response of your bpel call in the $response variable
    so in the looping as last step you add something like
    insert $mybpelresponse/rootelement into $response/yourresponse
    with the insert it will insert the reponse 1..x times into the $response variable (so actually aggregating all the responses for you)

  • 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
    Rk

    Hi,
    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;
    /

  • Call web service (multipart MIME soap request) using pl/sql (utl_http)

    I've the following header and http request.
    POST http://deab/DexNETWebServices_4_0_0_4/LoginService.svc HTTP/1.1
    MIME-Version: 1.0
    Content-Type: multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1";start-info="application/soap+xml"
    VsDebuggerCausalityData: uIDPo5F/qXRc4YJImqB6Ard30cQAAAAAAjIXinpIVUulXLJOsSG7yyv7Lf2yHgpHlIxvc6oeqaAACQAA
    Host: deab
    Content-Length: 1017
    Expect: 100-continue
    Accept-Encoding: gzip, deflate
    Connection: Keep-Alive
    --uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1
    Content-ID: <http://tempuri.org/0>
    Content-Transfer-Encoding: 8bit
    Content-Type: application/xop+xml;charset=utf-8;type="application/soap+xml"
    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://tempuri.org/ILoginService/LoginByUserName</a:Action><a:MessageID>urn:uuid:cf410a05-23d4-4b92-a22c-329cbc19fbe7</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand="1">http://deab/DexNETWebServices_4_0_0_4/LoginService.svc</a:To></s:Header><s:Body><LoginByUserName xmlns="http://tempuri.org/"><systemId>19e0ddb4-5fa5-41ee-b624-aea762865a6c</systemId><strName>FirmwareUpdateLogQueryWorker</strName><productId>0af39a3e-6549-485b-872f-b73413203998</productId><password>abc</password></LoginByUserName></s:Body></s:Envelope>
    --uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1--
    I'm using the following code to set the header from PL/SQL and call the request. But UTL_HTTP.get_response returns the error 400 Bad Request.
    DECLARE
       l_request         CLOB;
       l_http_req        UTL_HTTP.req;
       l_http_resp       UTL_HTTP.resp;
       v_buffer          VARCHAR2 (32767);
       p_status_code     NUMBER (9);
       p_error_message   VARCHAR2 (32767);
       p_response        CLOB;
    BEGIN
      l_request :=
                '--uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1'
             || CHR (13)
             || 'Content-ID: <http://tempuri.org/0>'
             || CHR (13)
             || 'Content-Transfer-Encoding: 8bit'
             || CHR (13)
             || 'Content-Type: application/xop+xml;charset=utf-8;type="application/soap+xml"'
             || CHR (13)
             || CHR (13)
             || '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://tempuri.org/ILoginService/LoginByUserName</a:Action><a:MessageID>urn:uuid:cf410a05-23d4-4b92-a22c-329cbc19fbe7</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand="1">http://deab/DexNETWebServices_4_0_0_4/LoginService.svc</a:To></s:Header><s:Body><LoginByUserName xmlns="http://tempuri.org/"><systemId>'
             || '19e0ddb4-5fa5-41ee-b624-aea762865a6c'
             || '</systemId><strName>'
             || 'FirmwareUpdateLogQueryWorker'
             || '</strName><productId>'
             || '0af39a3e-6549-485b-872f-b73413203998'
             || '</productId><password>'
             || 'abc'
             || '</password></LoginByUserName></s:Body></s:Envelope>'
             || CHR (13)
             || '--uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1--';
          DBMS_OUTPUT.put_line ('request ' || l_request);
          l_http_req := UTL_HTTP.begin_request ('http://deab/DexNETWebServices_4_0_0_4/LoginService.svc', 'POST', 'HTTP/1.1');
          UTL_HTTP.set_header (l_http_req, 'MIME-Version', '1.0');
          UTL_HTTP.set_header (
             l_http_req,
             'Content-Type',
             'multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1";start-info="application/soap+xml"');
          --      UTL_HTTP.set_header (l_http_req, 'Content-ID', '<http://tempuri.org/0>');
          --      UTL_HTTP.set_header (l_http_req, 'Content-Transfer-Encoding', '8bit');
          UTL_HTTP.set_header (
             l_http_req,
             'VsDebuggerCausalityData',
             'uIDPo5F/qXRc4YJImqB6Ard30cQAAAAAAjIXinpIVUulXLJOsSG7yyv7Lf2yHgpHlIxvc6oeqaAACQAA');
          UTL_HTTP.set_header (l_http_req, 'Content-Length', LENGTH (l_request));
          --                  UTL_HTTP.set_header (l_http_req,
          --                                       'SOAPAction',
          --                                       'http://tempuri.org/ILoginService/LoginByUserName');
          UTL_HTTP.write_text (l_http_req, l_request);
          DBMS_LOB.createtemporary (p_response, FALSE);
          l_http_resp := UTL_HTTP.get_response (l_http_req);
       BEGIN
          LOOP
             UTL_HTTP.read_text (l_http_resp, v_buffer, 32767);
             DBMS_OUTPUT.put_line (v_buffer);
             DBMS_LOB.writeappend (p_response, LENGTH (v_buffer), v_buffer);
          END LOOP;
       EXCEPTION
          WHEN UTL_HTTP.end_of_body
          THEN
             NULL;
       END;
       UTL_HTTP.end_response (l_http_resp);
       p_status_code := l_http_resp.status_code;
       p_error_message := l_http_resp.reason_phrase;
       p_response := REPLACE (p_response, '&lt;', '<');
       p_response := REPLACE (p_response, '&gt;', '>');
       DBMS_OUTPUT.put_line (
          'Status: ' || p_status_code || '-' || p_error_message || ': ' || p_response);
    END;
    Thank you for your help on this.

    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

  • 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

  • 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 advance

    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;

  • 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 a web-service using JAX-WS client on the browser

    Hi,
    I created a basic web-service using netbeans/glassfish, which can be successfully called from a JavaFX application running stand-alone.
    But when I try to run the same JavaFX application on a browser, the web-service call does not work, and it is hard to get any information on where it is failing.
    I can see the error is a Throwable (not an Exception), but the message is null.
    What are the restrictions on being able to call a webservice using the JAX-WS libraries? Are there security issues? I am not using the javafx HTTP libraries.
    Also, if Java1.6u10 is available on the machine running the browser, do I still need to package all the JAX-WS libraries for the client?
    Any help is appreciated, even if it is just about how to track down the problem.

    Thank you very much for responding.
    There was no error due to WebService. Actually, I was using xmlbeans and I did not put those xmlbeans jar files into appropriate place. That is what caused the problem. I have solved it now and it is working fine.
    I put those xmlbeans jar files into my war file. It is working. Earlier, I had put them in tomcat 5.5's shared/lib directory. It was not working.
    Thank you once again for replying.
    Sasi.

Maybe you are looking for