REST web service using PL/SQL

Hello,
I am trying to learn how a REST web service can be created using PL/SQL and how it can be used.
I am using this as a starting point.
Also, I am using the pre-build "Oracle Developer Days" setup for this (which means I have 11.2 version of oracle database installed).
I have done all the steps mentioned in the above blog post but when I try to access the web service in browser, I get the
"404 Not found - The requested URL /devtest/rest-demo/departments was not found on this server" message.
Here is my DAD setup :
SQL> declare
  l_name dbms_epg.varchar2_table;
  l_value dbms_epg.varchar2_table;
begin
  DBMS_EPG.GET_ALL_DAD_ATTRIBUTES (dad_name => 'devtest', attr_names => l_name, attr_values => l_value);
  for i in l_name.first..l_name.last
  loop
    dbms_output.put_line(l_name(i)||' => '||l_value(i));
  end loop;
end;
  2    3    4    5    6    7    8    9   10   11  database-username => HR1
path-alias => rest-demo
path-alias-procedure => rest_handler.handle_requestI have created the package and procedures as mentioned in that blog post
SQL> desc hr1.rest_handler
PROCEDURE HANDLE_REQUEST
Argument Name                  Type                    In/Out Default?
P_PATH                         VARCHAR2                INHave I missed something ?
Any help will be appreciated.
Thanks

Probably an security issue, I guess. The article (http://ora-00001.blogspot.com/2009/07/creating-rest-web-service-with-plsql.html) mentioned is a very good one (if not only I like what the site has become in recent years - much good tips and articles). As an alternative for your problems, have a look at the explaination of how Tim Hall has done it...
http://www.oracle-base.com/articles/misc/XMLOverHTTP.php
Edited by: Marco Gralike on Nov 21, 2011 11:31 AM

Similar Messages

  • Issue with Calling Rest Web Service using Designer workflow

    Hello all
    I am calling a Rest web service- HTTP Post (yammer API)-
    http://www.yammer.com/api/v1/messages.json?data-app-id=myappid&group_id=groupid&body=MyPost in yammer  using sharepoint 2013 designer workflow.(My Requirement is to create a yammer post when I approve an item in sharepoint).
    but my header parameters are creating issue while executing workflow.
    Currently I have these many parameters configured in request header
    Accept -application/json; odata=verbose
    Content Type -application/json; odata=verbose
    content length header -255
    Is there anything wrong or I need to additionally pass some values in call web service action?
    Any help would be highly appreciated

    Hi Mahesh,
    One you are missing is authentication token or credentials.
    Please refer to the following articles.
    http://www.cleverworkarounds.com/2014/02/05/tips-for-using-spd-workflows-to-talk-to-3rd-party-web-services/
    A Series of articles related to Web Service in SPD Workflow
    Trials or tribulation?
    Inside SharePoint 2013 workflows–Part 1
    Trials or tribulation?
    Inside SharePoint 2013 workflows–Part 2
    Trials or tribulation?
    Inside SharePoint 2013 workflows–Part 3
    Trials or tribulation?
    Inside SharePoint 2013 workflows–Part 4
    Trials or tribulation?
    Inside SharePoint 2013 workflows–Part 5
    Trials or tribulation?
    Inside SharePoint 2013 workflows–Part 6
    Trials or tribulation?
    Inside SharePoint 2013 workflows–Part 7
    Trials or tribulation?
    Inside SharePoint 2013 workflows–Part 8
    Trials or tribulation?
    Inside SharePoint 2013 workflows–Part 9
    Trials or tribulation?
    Inside SharePoint 2013 workflows–Part 10
    Trials or tribulation?
    Inside SharePoint 2013 workflows–Part 11
    Trials or tribulation?
    Inside SharePoint 2013 workflows–Part 12
    Please don't forget to mark it answered, if your problem resolved or helpful

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

  • Invoking P6 web services using PL/SQL block

    Hi Team,
    We have requirement like
    Oracle jobs will invoke PL/SQL code to authenticate and establish a session with the P6 Web services.
    Web service will export Project data from One Primavera database as an XML and copy to common location.
    Then this XML project files will be imported into archive database.
    Could anyone help me how I can establish sessio between Pl/SQL and P6 webservices?
    Please let me know if you need any more information.
    Regards,
    Santosh
    Edited by: SantoshV Singh on Apr 29, 2013 10:09 PM

    It will be no different than connecting to any web services through PL/SQL which is pretty hard to do and if you are asking how to do it then you have a steep learning curve ahead of you and not a great deal in the way of good examples out there.
    I wouldn't even attempt the approach you suggest.  Instead I would probably write a Java application to do it and use your PL/SQL to enqueue a message that routed to the Java application.  Then the java application with the Web Services support and P6 client would be easier to do what you want with web services.

  • 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

  • Have Error invoking SSL web service using pl sql procedure

    Hi All,
    Please any one can tell where i am going wrong,in calling ssl soa web service from plsql procedure.
    Below steps i followed ssl configure in soa server
    1- For configuring ssl in soa 11g, i am going to weblogic console->environment-> servers-> soa_server1-> check ssl box of port 8002.
    2- restart the server.
    3- One process i devloped, deployed in em console, while trying to acces the service with 8002 port, i need to use https://servicepath.
    Is there is any problem in the above approch for configuring ssl in soa server.
    Now coming to the procedure part, in below i given the deatails
    DECLARE
    HTTP_REQ UTL_HTTP.REQ;
    HTTP_RESP UTL_HTTP.RESP;
    URL_TEXT VARCHAR2(32767);
    lv_process_xml_body varchar2(4000);
    BEGIN
    DBMS_OUTPUT.ENABLE(1000000);
    lv_process_xml_body:='<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
         <soap:Body xmlns:ns1="http://xmlns.oracle.com/SOA_RND_jws/Sample/DemoBPELProcess">
              <ns1:process>
                   <ns1:input></ns1:input>
    </ns1:process>
    </soap:Body>
    </soap:Envelope>';
    UTL_HTTP.SET_WALLET('file:/db/oracle/app/oradb/product/11.2.0/dbhome_1/bin/client', 'abcd123');
    HTTP_REQ := UTL_HTTP.BEGIN_REQUEST('https://172.28.40.20:8002/soa-infra/services/Client/Sample/demobpelprocess_client_ep', 'POST' , 'HTTP/1.0');
    UTL_HTTP.set_header(http_req, 'Content-Type', 'text/xml');
    UTL_HTTP.set_header(http_req, 'Content-Length', LENGTH(lv_process_xml_body));
    UTL_HTTP.SET_HEADER(HTTP_REQ, 'SOAPAction', 'process');
    UTL_HTTP.write_text(http_req, lv_process_xml_body);
    HTTP_RESP := UTL_HTTP.GET_RESPONSE(HTTP_REQ);
    UTL_HTTP.END_RESPONSE(HTTP_RESP);
    dbms_output.put_line('success');
    exception
    when others then
    dbms_output.put_line(sqlerrm);
    END;
    But i am getting the error, unable to open the file
    Regarding certificate i have taken from the browser while running the above soa service in browser with 8002 port.
    Please let me know where i am doing wrong...
    Please if some one knows about steps ...... to do it to work
    Its urgent please help me out on this
    Thanks
    Dillip
    Edited by: 903915 on Dec 21, 2011 9:51 PM
    Edited by: 903915 on Dec 21, 2011 10:11 PM

    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.

  • Java web service using pl/sql DB package - JDev 10.1.3.1

    Hi All,
    I wanted to create a java web service, instead of a pl/sql web service, that calls a pl/sql package in my DB.
    Jdev (10.1.3.1) can generate java code for my pl/sql package. But the generated code can't be used with a java web service. I've found that the generated code uses types that can't be serialized for a webservice (ie. java.sql.Timestamp).
    Does anyone know of a work around?
    Thanks!

    http://www.oracle.com/technology/obe/obe1013jdev/10131/wsfromplsqlpackage/devwsfrom%20plsql.htm
    It's pretty well documented within Jdev also.
    Thanks, Rob

  • Invoking RESTful Web Service using APEX_WEB_SERVICE.MAKE_REST_REQUEST

    Hello All,
    APEX Version: 4.0.2.00.07
    DB: Oracle 11G R2
    WebServer: EPG
    Wallet info has been configured at APEX Instance Level, so APEX can access SSL enabled sites.
    When I run following code in page process, to make SOAP request to our intranet JIRA instance, everything just works fine.
    DECLARE
         l_envelope CLOB;
         l_xml XMLTYPE;
         lv_faultcode VARCHAR2(4000);
         lv_faultstring VARCHAR2(4000);     
    BEGIN
         l_envelope := '<?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" xmlns:m0="http://beans.soap.rpc.jira.atlassian.com">'
      ||'<SOAP-ENV:Body>'
      ||'  <m:getIssuesFromFilterWithLimit xmlns:m="http://soap.rpc.jira.atlassian.com" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'
      ||'            <in0>'||:F_JIRA_TOKEN||'</in0>'
      ||'         <in1>'||HTF.escape_sc(:P4_IN1)||'</in1>'
      ||'         <in2>'||HTF.escape_sc(:P4_IN2)||'</in2>'
      ||'         <in3>'||HTF.escape_sc(:P4_IN3)||'</in3>'     
      ||'  </m:getIssuesFromFilterWithLimit>'
      ||'  </SOAP-ENV:Body>'
         ||'</SOAP-ENV:Envelope>';
         l_xml := APEX_WEB_SERVICE.MAKE_REQUEST(
                                  p_url => 'https://jira.xyz.com/tracker/rpc/soap/jirasoapservice-v2',
                                  p_action => 'https://jira.xyz.com/tracker/rpc/soap/jirasoapservice-v2/getIssuesFromFilterWithLimit',
                                  p_envelope => l_envelope
    END;However If i'm calling a RESTful webserivce using "apex_web_service" API then I always end-up with following error message.
    The webservice was unreachable because either the URL you supplied was invalid, your environment requires a valid proxy server address for HTTP requests, or a wallet needs to be configured for HTTPS requests.Code (RESTful call)
    DECLARE
         lc_response CLOB;
    BEGIN     
         apex_web_service.g_request_headers(1).name := 'Authorization';
         apex_web_service.g_request_headers(1).value := 'Basic '||:F_JIRA_TOKEN_REST;
         lc_response:= APEX_WEB_SERVICE.MAKE_REST_REQUEST(
                                                                     p_url => 'https://jira.xyz.com/tracker/rest/api/2.0.alpha1/search?jql=assignee=John&startAt=1&maxResults=5',
                                                                     p_http_method => 'GET'
    END;As you can see, both requests are made to same server. However during SOAP request I'm not getting any error, but during RESTful request I'm getting error. Can anyone tell me what could be wrong?
    Best Regards,
    Hari

    Hi Hari,
    this was bug 16212066 - apex_web_service make_rest_request doesn't use instance wallet if not specified
    which will be fixed in APEX 4.2.2.
    As a workaround you can specify the p_wallet_path and p_wallet_pwd parameter when calling apex_web_service.make_rest_request.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Problem getting RESTful web service reference working with header value

    Hi,
    I posted this on Apex Listener forum but since I am not sure problem is with my Application RESTful web service reference or a Listener issue, I am posting here as well:
    I am on Apex 4.2.2 and Listener 2.1 and the listener is on WEblogic.
    I succeeded to get a RESTful web service working in an application with no header to obtain a full set of data. The data set is very large, so I am now just trying to set up a web service to get a set of data based on a student ID.
    I followed the examples shown in the RESTful web service module of SQL Workshop and set up a handler of this type:
    https://ourweblogicserver/apex/bnr/ace/students/course_grades/{stid}
    The test for this handler succeeded both for JSON output and CSV output in the Workshop test environment.
    However, when I try it from a Web Service Reference that I created for my application following what looked like the same approach used on the example video, I get NO data back. If I put a 'stid' directly into a URL of a web browser and do the basic authentication I get the data!!
    This is what I have for the Web service reference:
    https://ourweblogicserver/apex/bnr/ace/students/course_grades/{stid}
    Basic auth set to Yes -- and this is working -- I am able to authenticate
    HTTP method Get
    output format Text
    no response Xpath
    no response namespace
    defaults for new record and parameter delimiter
    NO REST input parameters
    Output set for all the fields in the data set queried (same set of data as in my rest service which does not have any http header)
    REST HTTP Header : Name stid
    I there something I am missing. I am not sure how to troubleshoot this further.
    I also tried exactly following the example shown on the Oracle Video for RESTFul web services at
    http://www.youtube.com/watch?v=gkCvd6P8_OU
    and I can't get the 2nd example to work either-- where the header has the bind variable parameter.
    Pat

    I was able to resolve the problem -- in the latest version of the RESTful web service that I created, I had left out the creation of the Header Parameter bind variable. Once I did that everything works fine!! I was able to test in the application and got the record of an individual student.
    Thanks,
    PM

  • Problem with RESTful web service with header value

    Hi,
    I am on Apex 4.2.2 and Listener 2.1 and the listener is on WEblogic.
    I succeeded to get a RESTful web service working in an application with no header to obtain a full set of data. The data set is very large, so I am now just trying to set up a web service to get a set of data based on a student ID.
    I followed the examples shown in the RESTful web service module of SQL Workshop and set up a handler of this type:
    https://ourweblogicserver/apex/bnr/ace/students/course_grades/{stid}
    The test for this handler succeeded both for JSON output and CSV output in the Workshop test environment.
    However, when I try it from a Web Service Reference that I created for my application following what looked like the same approach used on the example video, I get NO data back. If I put a 'stid' directly into a URL of a web browser and do the basic authentication I get the data!!
    This is what I have for the Web service reference:
    https://ourweblogicserver/apex/bnr/ace/students/course_grades/{stid}
    Basic auth set to Yes -- and this is working -- I am able to authenticate
    HTTP method Get
    output format Text
    no response Xpath
    no response namespace
    defaults for new record and parameter delimiter
    NO REST input parameters
    Output set for all the fields in the data set queried (same set of data as in my rest service which does not have any http header)
    REST HTTP Header : Name stid
    I there something I am missing. I am not sure how to troubleshoot this further.
    Pat

    Hi,
    I have posted a simple application with the RESTful reference:
    http://apex.oracle.com/pls/apex/f?p=13758
    I can give you full privileges on this so you can look at the WEB service reference. Shall I send to you separately for login user?
    It is using the RESTful service: http://apex.oracle.com/pls/apex/nd_pat_miller/demo/employee/{deptno}
    This RESTful service tests fine when I test from within the RESTful web service module of the Workspace.
    I based this on the Video demo tutorial for RESTful web service that Oracle published for 4.2 release. The video seemed to exclude the {deptno} in the URL but when I try that, it doesn't work either.
    This is the error I am getting when I run this on my Apex environment: (it, of course, will not run the web service in the apex.oracle.com environment)
    class="statusMessage">Bad Request</span>                                         
    </h3>                                         
    </div>                                         
    </div>                                         
    <div id="xWhiteContentContainer" class="xContentWide">                                         
    <div class="xWhiteContent">                                         
    <div class="errorPage">                                         
    <p>                                         
    <ul class="reasons"><li class="badRequestReason"><span class="target" style="display:none;">uri</span><span class="reason">Request path contains unbound parameters: deptno</span></li>                                    
    </ul>Thanks,
    Pat
    Edited by: patfmnd on May 8, 2013 3:33 AM

  • Accessing Restful Web Services in APEX?

    Hi I am new to this forum so I hope you will bear with me. I have been looking at how to create RESTful web services through the SQL Workshop Resful Services wizard but every single article I look at refers to a test button which I cannot see anywhere (I am using APEX 4.2) so how do I test the service?
    Also, how can I get the URL of the service so I can call it from another application?
    Thanks in advance
    Malcolm

    Oracle® Application Express
    SQL Workshop Guide
    Release 4.2
    RESTful Service Requirements
    In order for the RESTful Service utility to be available and function properly, the
    following requirements must be met:
    ■ The instance administrator must enable RESTful Services for this Application
       Express instance. See Oracle Application Express Administration Guide.
    ■ The Oracle Application Express Listener version 2.0 or higher must be used. The
      Oracle XML DB HTTP Server with the embedded PL/SQL gateway and Oracle
      HTTP Server with mod_plsql do not support this functionality. See Oracle
      Application Express Listener Installation and Developer Guide.
    Regards
    Zack

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

    Hi 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

  • How to register Rest web services in Cold Fusion 9 administration console?

    I am building a Rest web service using Cold Fusion 9 and Cold Fusion Builder 3 and now I want to register it on Cold Fusion 9 admin console, but I didn't see any option there as in CF 10 and CF 11 Data Services ---> Rest Web service. So, please tell me how to register my Rest web service in CF 9 either through admin console or through code?

    Simple answer: you can't.  REST services were a new feature released with CF10.  Alternatively, you can use a community-supported framework to provide REST services, such as:
    Taffy (a dedicated REST framework)
    FW/1 (an MVC framework with REST capabilities)
    ColdBox (an MVC framework with REST capabilities)
    -Carl V.

  • How to register Rest web services in Cold Fusion 9 ?

    I am building a Rest web service using Cold Fusion 9 and Cold Fusion Builder 3 and now I want to register it on Cold Fusion 9 admin console, but I didn't see any option there as in CF 10 and CF 11 Data Services ---> Rest Web service. So, please tell me how to register my Rest web service in CF 9 either through admin console or through code?

    You've posted this question twice.  Please delete this one and people can respond to the other one.
    -Carl V.

  • RESTful web services : Accessing the param id resource URI parameter.

    Hello all,
    I created restful web services using Netbeans 6.1--->New RESTful web services from patterns-->Container-Item.
    This gives me 2 class files, for example : MyWSsResource and MyWSResource.
    Now in MyWSResource there are 3 generated methods GET, PUT and Delete.
    Here is an example of the GET
    @Path("/myws/{arg1}")
        @GET
        @ProduceMime("application/xml")
        public String getXml(@PathParam("id")
        String id) {
            if(context.equals(null)) {
            throw new UnsupportedOperationException();
           //My code below
            FpkSentDB fpkSent = new FpkSentDB();
            MultivaluedMap<String, String> params = context.getTemplateParameters();
            String arg1       = params.getFirst("arg1");
            return fpkSent.getFPKSent(arg1).toString();
    {code}I am not understanding the following code:
      {code:java} (@PathParam("id") String id) {code}
    .... I can access arg1 using the URI/arg1value.
    How is PathParam("id")  meant to be accessed?
    If I do a {code:java} logger.debug("ID equals:" + id);{code}
    id returns null always.
    My code works just fine as it is but I am new to REST and wanted to follow spec as closely as possible.
    Any Ideas?
    TIA!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Any possible solution for the issue?, so much thanks for it.

Maybe you are looking for

  • ITunes could not play songs, automatically open and quit the itunes app

    I have encountered a problem recently. Once I click any song of my itunes library, itunes will quite immediately. Then an error message pops out, saying that the application itunes quit unexpectedly. After i close the error message, itunes will open

  • My iPod Touch 5th generation battery drains extremely fast.

    I have a iPod Touch 5th generation, with iOS 8.0.2 and the battery life goes down in less than 15 minutes. I have experienced this since I first bought it, which was 10 months ago. My brother and sister just bought the same iPod as me but in differen

  • BPM alerts

    Hi masters..... i am doing one scenario where i have to pick data from source side and send it to target system then from the target system i wil be getting response that data is successfully inserted in target system ... if it is not inserted then i

  • Transaction MR8M

    Hi, Currently, when cancelling an invoice document via MR8M, you have to then manually do the clearing through F-44. When saving the cancellation, there is an information message below which says "Please manually clear FI Documents". We have had a re

  • Unable to uninstall and update iTunes 10

    What happened!! 1st. I was not able to uninstall iTunes by going to the "Uninstall and Change a program" . Every time it will pop up a window saying "error getting file security C:/User/LIng/AppData/Roaming/Microsoft/Internet Explorer/Quick Launch Ge