Wednesday, November 6, 2019

12C OSB - Leverage work manager for throttling

Work Manager vs Throttling:


Work Manager with Proxy Service:
Work Manager configured on Proxy Service is used to limit the number of threads running a Proxy Services.
Work Manager with Business Service:
Work Manager configured on Proxy Service is used to limit the number of threads that process responses from the back-end system.

Throttling with Business Service:
  • Throttling configured on Business Service only limited loads (requests) to back-end services and to avoid overloading the back-end.
  • Throttling is used to restrict the message flow to a business service however work managers are used to prioritize service work. Eg: The WorkManager with MaxThreadsConstraint only limits the number of threads which can be used for example to limit the number of listening threads on a queue.
  • In case of throttling there is possibility of message loss however with work manager setup there is no such possibility.
Implementation steps:
Domain⇾Environment⇾Work Managers
Create new and create a minimum thread constraint.
Minimum thread constraint: Ensure that whatever may be the load in the server this minimum number of threads will be allocated to the service.

Give it a logical name and assign minimum thread. by default it is -1 which mean infinite.
Click next and point it to the server.
Create a work manager


Next point it to server and finish the wizard
You can now go to your work manager and select the constraint you have defined



 Save the changes.
Nowyou just need to attach this created work manager to the business process in OSB.
Open up the osb console⇾Go to your Proxy/business service⇾go to transport details and select the work manager that you have created in the previous steps.

Save the changes and reactivate your session.

For configuring work manager in SOA we do not much options. SOA Services uses a default work manager called as wm/SOAWorkManager.You can configure your own constraints and update the work managers to use the constraints.

Tuesday, November 5, 2019

12c SOA - Move file using file adapter

Here i will show how to move file from one location to other without reading its content using file adapter.

Implementation steps:
Create a SOA Project


 Choose Composite with One way BPEL Process


 Right click on right swim lane and choose file adapter 



 Choose Operation Type as "Synchronous Read file"
 Provide a dummy directory and file name

 Here we will choose Opaque schema as we will not read the file content.

 Wire the the adpater with the BPEL process
 Open the JCA file
 Modify it as per below
 <adapter-config name="fileMoveAdapter" adapter="file" wsdlLocation="../WSDLs/fileMoveAdapter.wsdl"
                xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
  <connection-factory location="eis/FileAdapter"/>
  <endpoint-interaction portType="SynchRead_ptt" operation="SynchRead">
    <!--interaction-spec className="oracle.tip.adapter.file.outbound.FileReadInteractionSpec">
      <property name="PhysicalDirectory" value="dummy"/>
      <property name="FileName" value="dummy"/>
      <property name="DeleteFile" value="true"/>
    </interaction-spec-->
    <interaction-spec className="oracle.tip.adapter.file.outbound.FileIoInteractionSpec">
      <property name="SourcePhysicalDirectory" value="SourceDirectory"/>
      <property name="SourceFileName" value="SourceFileName.txt"/>
      <property name="TargetPhysicalDirectory" value="TargetDirectory"/>
      <property name="TargetFileName" value="TragetFileName.txt"/>
      <property name="Type" value="MOVE"/>
    </interaction-spec>
  </endpoint-interaction>
</adapter-config>
Create following 4 variables and assign the the real values.
    <variable name="sourceDirectory" type="xsd:string"/>
    <variable name="sourceFileName" type="xsd:string"/>
    <variable name="targetDirectory" type="xsd:string"/>
    <variable name="targetFileName" type="xsd:string"/>

 Invoke the file adapter partnerlink and add the JCA properties in the properties tab:

<invoke name="Invoke_fileMoveAdapter" partnerLink="fileMoveAdapter"
            portType="ns1:SynchRead_ptt" operation="SynchRead"
            inputVariable="Invoke_fileMoveAdapter_SynchRead_InputVariable"
            outputVariable="Invoke_fileMoveAdapter_SynchRead_OutputVariable" bpelx:invokeAsDetail="no">
      <bpelx:toProperties>
        <bpelx:toProperty name="jca.file.SourceDirectory" variable="sourceDirectory"/>
        <bpelx:toProperty name="jca.file.SourceFileName" variable="sourceFileName"/>
        <bpelx:toProperty name="jca.file.TargetDirectory" variable="targetDirectory"/>
        <bpelx:toProperty name="jca.file.TargetFileName" variable="targetFileName"/>
      </bpelx:toProperties>
    </invoke>
 Deploy the composite and place the file in the source directory and you test it.


Friday, November 1, 2019

12c SOA - Rename a SOA Composite using template

Rename a SOA Composite using template

Follow the steps:
Right click on the composite to be renamed ⇾Create SOA Template
 Provide a template name
 Finish
 New⇾Project
 SOA project
 Provide the new name
 Choose the SOA template created
 Composite is successfully renamed.

Thursday, October 31, 2019

12c SOA - Rest vs SOAP WebServices

SOAP(Simple Object Access Protocol):
  • SOAP is a protocol. SOAP was designed with a specification. It includes a WSDL file which has the required information on what the web service does in addition to the location of the web service.
  • SOAP relies exclusively on XML to provide messaging services. Microsoft originally developed SOAP to take the place of older technologies that don’t work well on the Internet such as the Distributed Component Object Model (DCOM) and Common Object Request Broker Architecture (CORBA).
  • SOAP cannot make use of REST since SOAP is a protocol and REST is an architectural pattern.
  • SOAP uses service interfaces to expose its functionality to client applications. In SOAP, the WSDL file provides the client with the necessary information which can be used to understand what services the web service can offer.
  • SOAP requires more bandwidth for its usage. Since SOAP Messages contain a lot of information inside of it, the amount of data transfer using SOAP is generally a lot.
          <?xml version="1.0"?>
         <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope" 
SOAP-ENV:encodingStyle=" http://www.w3.org/2001/12/soap-encoding">
          <soap:Body>
         <EmployeeID>int</EmployeeID>
         ......
       </soap:Body>
      </SOAP-ENV:Envelope>

REST(Representational State Transfer):
  • REST is an Architectural style in which a web service can only be treated as a RESTful service if it follows the constraints of being
          Client Server
          Stateless
          Cacheable
          Layered System
          Uniform Interface
  • REST can make use of SOAP as the underlying protocol for web services, because in the end it is just an architectural pattern.
  • REST use Uniform Service locators to access to the components on the hardware device. For example, if there is an object which represents the data of an employee hosted on a URL as http://demo.guru99 , the below are some of URI that can exist to access them
         http://demo.guru99.com/Employee
         http://demo.guru99.com/Employee/1
  • REST does not need much bandwidth when requests are sent to the server. REST messages mostly just consist of JSON messages. Below is an example of a JSON message passed to a web server. You can see that the size of the message is comparatively smaller to SOAP.
          {"city":"Mumbai","state":"Maharastra"}
  • REST permits different data format such as Plain text, HTML, XML, JSON, etc. But the most preferred format for transferring data is JSON.
When to use REST and when to use SOAP

REST services should be used in the following instances

Limited resources and bandwidth – Since SOAP messages are heavier in content and consume a far greater bandwidth, REST should be used in instances where network bandwidth is a constraint.

Statelessness – If there is no need to maintain a state of information from one request to another then REST should be used. If you need a proper information flow wherein some information from one request needs to flow into another then SOAP is more suited for that purpose. We can take the example of any online purchasing site. These sites normally need the user first to add items which need to be purchased to a cart. All of the cart items are then transferred to the payment page in order to complete the purchase. This is an example of an application which needs the state feature. The state of the cart items needs to be transferred to the payment page for further processing.

Caching – If there is a need to cache a lot of requests then REST is the perfect solution. At times, clients could request for the same resource multiple times. This can increase the number of requests which are sent to the server. By implementing a cache, the most frequent queries results can be stored in an intermediate location. So whenever the client requests for a resource, it will first check the cache. If the resources exist then, it will not proceed to the server. So caching can help in minimizing the amount of trips which are made to the web server.

Ease of coding – Coding REST Services and subsequent implementation is far easier than SOAP. So if a quick win solution is required for web services, then REST is the way to go.

SOAP should be used in the following instances

Asynchronous processing and subsequent invocation – if there is a requirement that the client needs a guaranteed level of reliability and security then the new SOAP standard of SOAP 1.2 provides a lot of additional features, especially when it comes to security.

A Formal means of communication – if both the client and server have an agreement on the exchange format then SOAP 1.2 gives the rigid specifications for this type of interaction. An example is an online purchasing site in which users add items to a cart before the payment is made. Let's assume we have a web service that does the final payment. There can be a firm agreement that the web service will only accept the cart item name, unit price, and quantity. If such a scenario exists then, it's always better to use the SOAP protocol.

Stateful operations – if the application has a requirement that state needs to be maintained from one request to another, then the SOAP 1.2 standard provides the WS* structure to support such requirements.

SOAP vs. REST API challenges

Challenges with the SOAP API

WSDL file - One of the key challenges of the SOAP API is the WSDL document itself. The WSDL document is what tells the client of all the operations that can be performed by the web service. The WSDL document will contain all information such as the data types being used in the SOAP messages and what all operations are available via the web service. The biggest challenge of the WSDL file which is the tight contract between the client and the server and that one change could cause a large impact, on the whole, client applications.

Document size – The other key challenge is the size of the SOAP messages which get transferred from the client to the server. Because of the large messages, using SOAP in places where bandwidth is a constraint can be a big issue.

Challenges with the REST API

Lack of Security – REST does not impose any sort of security like SOAP. This is why REST is very appropriate for public available URL's, but when it comes down to confidential data being passed between the client and the server, REST is the worst mechanism to be used for web services.

Lack of state – Most web applications require a stateful mechanism. For example, if you had a purchasing site which had the mechanism of having a shopping cart, it is required to know the number of items in the shopping cart before the actual purchase is made. Unfortunately, the burden of maintaining this state lies with the client, which just makes the client application heavier and difficult to maintain.

Tuesday, October 22, 2019

12c SOA - File based MDS or MDS reference locally using designTimeRepository and adf_config_xml

Create a local MDS or file based MDS using design time Repository and use in services. It helps us to achieve faster development without moving the artifacts in the db based MDS.

Step1: Create local soamds and view artifacts structure from file mds.
Go to Resources⇾SOA-MDS⇾ right click and click properties.
Now you can see the default soamds path.
Copy the path: C:\JDeveloper\mywork\soamds\ and go to that folder and Paste that apps folder containing all artifacts with a proper structure.s 
Now go to Jdeveloper and refresh the DesignTimeRepository
 Now if you expand the DesignTimeRepository, you can see the artifacts structure as below.
Step2: create adf-config.xml connection with local mds
Go to Application resourcesàDescriptorsàadf-config.xml
 By default this file looks like below
 Add the below line under metadata-namespaces
<namespace metadata-store-usage="mstore-usage_2" path="/apps"/>
Add the below code of lines under metadata-store-usages
 <metadata-store-usage id="mstore-usage_2">
      <metadata-store class-name="oracle.mds.persistence.stores.file.FileMetadataStore">
          <property name="partition-name" value="mds"/>
           <property name="metadata-path" value="C:\JDeveloper\mywork\soamds\"/>
       </metadata-store>
   </metadata-store-usage>
 Step3: Now open a project/composite and remove the shareable artifacts from that project one by one and kept in local mds with proper naming convention (if not exists) and give mds reference in that project for that artifacts.

Example for – WSDL:
Generally we should give mds reference in wrapper wsdl and in composite.xml.
Step i: Remove TicketingService.wsdl
Step ii: Go to TicketingServiceWrapper.wsdl and change the location with mds path
Replace TicketingService.wsdl with oramds:/apps/soa/wsdl/AskNow/V1/TicketingService.wsdl

Step iii: Go to Composite.xml and search with the wsdl name like “TicketingService.wsdl” and replace each one with mds path oramds:/apps/soa/wsdl/AskNow/V1/TicketingService.wsdl
For referenceàBinding.wsà location   Keep it as same like endpoint URL

Note: If any WSDL needs to import in MDS then first remove the Service part to make it abstract.

Monday, October 21, 2019

12c SOA - how to create csf-key

Credential Store Framework (CSF) is used in OWSM to manage the secure credentials.
  • CSF provides a way to store, retrieve, and delete credentials for a Web service and other applications. For example, the oracle/wss_username_token_client_policy policy includes the csf-key property, with a default value of basic.credentials. This credential is stored in the CSF.
  • A password credential can store a username and password. A generic credential can store any credential object.Each credential is stored in the store using the alias and the key pair. The alias, called the map name, is a logical name that defines a group of various keys and one credential associated with that key. That is, the map name and the key name are combined to make a primary key in the store.
Typically the map name is the name of the application or component to make it easy to identify. By convention, Web services should use oracle.wsm.security.

EM console⇾SOA OSB domain⇾Security⇾Credentials
Create map⇾map name : oracle.wsm.security
If map is already created or map creation done then Create Key ⇾
Provide the user and password for the key pii-csf-key.
csk key is ready to be used.

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...