您的位置:首页 > 数据库 > Oracle

Oracle APEX calls web service

2013-03-10 10:30 453 查看
Oracle APEX calls web service:

1)     Create web service reference in sharedcomponents and invoke.

You can follow the following demo:

Creating and Using a Manual SOAP Web Servicein Your Application

http://apex.oracle.com/pls/apex/f?p=44785:24:7736223348442:::24:P24_CONTENT_ID,P24_PREV_PAGE:5815,24

 

2)     Invoke web service API in PLSQL block: APEX_WEB_SERVICE

You can refer the doc:

http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_web_service.htm#BABFFDEH

 

APEX_WEB_SERVICE.MAKE_REQUEST(

    p_url               IN VARCHAR2,

    p_action            IN VARCHAR2 default null,

    p_version           IN VARCHAR2 default '1.1',

    p_envelope          IN CLOB,

    p_username          IN VARCHAR2 default null,

    p_password          IN VARCHAR2 default null,

    p_proxy_override    IN VARCHAR2 default null,

    p_transfer_timeout  IN NUMBER  default 180,

    p_wallet_path       IN VARCHAR2 default null,

    p_wallet_pwd        IN VARCHAR2 default null )

RETURN XMLTYPE;

 

Table 22-4 MAKE_REQUEST Function Parameters

Parameter

Description

p_url

The URL endpoint of the Web service.

p_action

The SOAP Action corresponding to the operation to be invoked.

p_version

The SOAP version, 1.1 or 1.2. The default is 1.1.

p_envelope

The SOAP envelope to post to the service.

p_username

The username if basic authentication is required for this service.

p_password

The password if basic authentication is required for this service

p_proxy_override

The proxy to use for the request. The proxy supplied overrides the proxy defined in the application attributes.

p_transfer_timeout

The amount of time in seconds to wait for a response.

p_wallet_path

The file system path to a wallet if the URL endpoint is https. For example, file:/usr/home/oracle/WALLETS. The wallet path provided overrides the wallet defined in the instance settings.

p_wallet_pwd

The password to access the wallet.

 

·        p_wallet_path to a wallet if the URL endpoint ishttps.

For windows: file:c\oracle\wallets

For linux : file:/usr/home/oracle/wallets

For Oracle Cloud: you don’t need to configthe wallets, since Oracle Cloud already has a lot of certification.

 

Eg. https://xxx:443/opptyMgmtOpportunities/OpportunityService?WSDL

You need to export the root/parentcertificate.

Refer (http://blog.whitehorses.nl/2010/05/27/access-to-https-via-utl_http-using-the-orapki-wallet-command/)

·        p_username/p_password is needed for https site.

 

Here is the PLSQL procedure to invoke the web service:

You need to add the WSSE:security policy in the HTTP headerfor username-token security policy web service

 

--------------------------- PLSQL Block---------------------------

DECLARE

  l_envelope CLOB;

  l_xml XMLTYPE;

BEGIN

  l_envelope :='<?xml version="1.0" encoding="utf-8"?>

<soapenv:Envelopexmlns:act="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/"xmlns:not="http://xmlns.oracle.com/apps/crmCommon/notes/noteService"xmlns:not1="http://xmlns.oracle.com/apps/crmCommon/notes/flex/noteDff/"xmlns:opp="http://xmlns.oracle.com/apps/sales/opptyMgmt/opportunities/opportunityService/"xmlns:rev="http://xmlns.oracle.com/apps/sales/opptyMgmt/revenues/revenueService/"xmlns:rev1="http://xmlns.oracle.com/oracle/apps/sales/opptyMgmt/revenues/revenueService/"xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:typ="http://xmlns.oracle.com/apps/sales/opptyMgmt/opportunities/opportunityService/types/">

  <soapenv:Header>

<wsse:Security soapenv:mustUnderstand="1"xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">

<wsse:UsernameToken wsu:Id="UsernameToken-2">

<wsse:Username><username></wsse:Username>

<wsse:PasswordType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>

</wsse:UsernameToken>

</wsse:Security>

</soapenv:Header>

  <soapenv:Body>

     <typ:updateOpportunity>

         <typ:opportunity>           

           <opp:OptyId>'||:OPTYID||'</opp:OptyId>

           <opp:OperatingCompany_c>'||:P2_OPERATING_COMPANY||'</opp:OperatingCompany_c>

           <opp:ProspectNumber_c>'||:P2_PROSPECT_NUMBER||'</opp:ProspectNumber_c>

           <opp:ProspectName_c>'||:P2_PROSPECT_NAME||'</opp:ProspectName_c>

           <opp:TenderNumber_c>'||:P2_TENDER_NUMBER||'</opp:TenderNumber_c>

        </typ:opportunity>

     </typ:updateOpportunity>

  </soapenv:Body>

</soapenv:Envelope>';

 

  l_xml :=apex_web_service.make_request(

  p_url => 'https://<hostname>:443/opptyMgmtOpportunities/OpportunityService?WSDL',

  p_action =>'http://xmlns.oracle.com/apps/sales/opptyMgmt/opportunities/opportunityService/updateOpportunity',

  p_envelope => l_envelope,

  p_username  => ‘<username>’,

  p_password  => ‘password’);

 

end;

 

--------------------------- PLSQL Block---------------------------

 

Refer: SOAP
UI test Oracle Fusion web service guide
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: