Advertisements

Archive for August, 2015

SOA 12c – Using Schedule Job activity in BPEL

In this post, we will learn how to use the Schedule Job activity to submit a ESS request from BPEL process during orchestration. And we will use the ESS job created from this post.

Create a Sync BPEL process and drag Schedule Job activity into BPEL from Components –> Oracle Extensions as shown below.

jobactivity

jobactinbpel

We need to create a MDS connection so that we can do the lookup for the ESS jobs. Create a new SOA-MDS Connection in Resources –> IDE Connections and select MDS partition essUserMetadata as shown below.

mdsconn

Double click on Schedule Job activity in BPEL to being up the below editor and select the required ESS job as shown in following screenshots. This way, we can also explore ESS jobs deployed to partition using different namespaces.

selectjob

selectjob2

selectedjob

Similarly, we can select Schedule if required as shown below.

selectsch

Navigate to Application Properties tab and give the value for Job Propetires using XPath expression as shown below.

jobargs1

jobargs2

jobargs3

We can also verify the ESS Job system properties in System Properties tab.

sysprop

Click OK to observe a sequence of activities are created in your BPEL flow as shown below. We can click each of these activities and observe what has been done automatically for us.

essexpand

essservice

On selecting the job, we will see following artifacts get created automatically in our project.

esswsdl

Since our composite using ESS abstract WSDL it will result into build errors. So modify your ESS partner link entry in composite.xml to add bindings and port as highlighted below.

<reference name="EssService"
           ui:wsdlLocation="WSDLs/ESSWebServiceAbstract.wsdl">
  <interface.wsdl interface="
http://xmlns.oracle.com/scheduler#wsdl.interface(ESSWebService)"
                  callbackInterface="http://xmlns.oracle.com/scheduler#wsdl.interface(ESSWebServiceCallback)"/>
  <binding.ws port="
http://xmlns.oracle.com/scheduler#wsdl.endpoint(ESSWebService/SchedulerServiceImplPort)"
        location="WSDLs/ESSWebServiceAbstract.wsdl"/>
  <callback>
    <binding.ws port="
http://xmlns.oracle.com/scheduler#wsdl.endpoint(ESSWebServiceCallback/ESSWebServiceCallback_pt)"/>
  </callback>
</reference>

Or generate configuration plan for composite and give port and binding along with ESS Webservice location as shown below.

<reference name="EssService">
      <binding type="ws">
        <attribute name="port">
          <replace>
http://xmlns.oracle.com/scheduler#wsdl.endpoint(ESSWebService/SchedulerServiceImplPort)</replace>
        </attribute>
        <attribute name="location">
          <replace>
http://localhost:7015/ess/esswebservice?wsdl</replace>
        </attribute>
      </binding>
      <callback>
        <binding type="ws">
          <attribute name="port">
            <replace>
http://xmlns.oracle.com/scheduler#wsdl.endpoint(ESSWebServiceCallback/ESSWebServiceCallback_pt)</replace>
          </attribute>
        </binding>
      </callback>
    </reference>

We can always verify ESS Webservice WSDLs by navigating to Webservices section in url >:>/ess">http://<<host>>:<<port>>/ess.

Deploy your SOA project using above configuration plan and Test.  Now we will observe the following error as ESS Webservices can’t be run with anonymous user credentials. To get away with that, modify the ESS webservice by attaching OWSM policy as detailed by Lucas in his blog.

svcerror

Since ESS Webservice is secured we need to attach the corresponding client policy to our Partner link and need to pass on the credentials of valid user. So as a first step, create a credential store key ESS_KEY_USER with weblogic credentials using the following steps in EM Console.

security

credkey

credkey1

Now attach the corresponding client policy to our partner link as shown below.

owsm4req

attchedowsm

Click pencil icon and modify OWSM policy to specify csf-key as shown below.

csfkey

This would populate wsm-assembly.xml file with the policy details as below.

owsmpolicy

Now again deploy the SOA composite and run. This time composite run will be successful and can observe the Request ID of ESS job as the response.

flowtrace

Navigate to ESSAPP –> Search Job Requests to see our job is submitted as expected and shows user as weblogic which is used in csf-key.

jobrequest

You can find sample project here.

Observation:

There is some run time error coming during BPEL process testing when we specified job description for Schedule Job activity as above. This is due to the missing quotes around so we have to manually open assign activity and surround your job description in quotes as shown below.

essissue

Advertisements

OAC 12c Articles

OAC 12c–Consuming API Assets in SOA/OSB Projects

In this post, we will see how to lookup Oracle API Catalog (OAC) for API assets using JDeveloper and consume it in SOA/OSB projects. Note that as mentioned in post, we need to install patch 19721053 to get JDeveloper extension for OAC/OER.

Creating OAC Connection

Select File –> New –> General –> Connections.

oerconn1

Enter required information as shown below. Note that any user with Developer role would be able to connect to OAC.

oerconn2

Click OK. Observe that new OER connection is shown in Resources as shown below and able to see all the published API assets.

oerconn

We must associate a JDeveloper application with a default OAC Connection to consume assets. Without this, we will see the following error when trying to consume assets.

lookup

To associate OAC Connection, select Tools –> Oracle Enterprise Repository and select the above OAC connection as shown below.

oacassoc

Now we can consume API asset in SOAP Project as shown below for partner link creation.

oacplink

Similarly, while creating business service in OSB we can select the OAC asset as shown below.

bizservice

oacbiz

OAC 12c:Harvesting SOA/OSB Projects

In this post, we will see how to use harvester to populate Oracle API Catalog (OAC) with Oracle SOA Suite projects.

Harvester can be used to collect services from Oracle SOA Suite and Oracle Service Bus and creates OAC API assets. Initially API assets gets created in Draft status. User can modify these assets to add metadata and publish so that users can search and use.

Before getting into nuances of Harvester, let us understand little but about the roles supported by OAC. OAC supports Developer, Curator and Admin roles for the users.

Developer: Users with this role can search for API assets in OAC console or using OER Jdeveloper plugin. And also can submit ratings and reviews for API assets.

Curator: Users with this role can run harvester to create API assets, add metadata and publish along with the capabilities provided by Developer role.

Admin:Users with this role can access the admin page to manage users, departments, settings and security along with  capabilities provided by Curator role.

It’s always recommended to run harvester with admin role. Before running the harvester, make sure that services are deployed to server Weblogic 11g or higher. Harvester can be found in %MW_HOME/oer/tools/harvester and we can run it from command line, Ant or WLST. Here in this blog, we will look at command line usage. Refer to documentation here for more information.

As a prerequisite, set JAVA_HOME variable and harvester requires Java 6 or later. Open configuration file  HarvesterSettings.xml from above location and modify repository section as shown below which points to your OAC server.

<repository>
<uri>
http://localhost:8111/oac</uri>
<credentials>
<user>admin</user>
<password>admin123</password>
</credentials>
<timeout>30000</timeout>
</repository>

Now, we should tell harvester about the location from where it can collect the resources. This can be done either using remoteQuery section in configuration file or can mention as options in command line itself.

To use remoteQuery section, modify  as shown below by giving remote server URL and the required credentials.  Make sure that your SOA server is running.

<remoteQuery>
<serverType>SOASuite</serverType>
<uri>
http://localhost:7004/</uri>
<credentials>
<user>weblogic</user>
<password>weblogic1</password>
</credentials>
<soaPartition>default</soaPartition>
</remoteQuery>

Harvester needs  passwords to be mentioned in encrypted form always so run encrypt.bat as below to take care of this requirement.

encrypt.bat HarvesterSettings.xml  HarvesterSettings.xml

Now just run  harvest.bat and see that new API assets have been created as shown below with initial status as Draft.

draftapi

We can achieve the same results from command line by running the following command;

.\harvest.bat -remote_url http://localhost:7004 -remote_username weblogic -remote_server_type SOASuite  -soa_partition default

However, harvester always picks up passwords from configuration file, so we should have remoteQuery section as below for this command to work.

<remoteQuery>
<!–<serverType>SOASuite</serverType>
<projectName>AsyncBPEL</projectName>
<uri>
http://localhost:7004/</uri> –>
<credentials>
<!–<user>weblogic</user>–>
<password>v2_1.X5z9eOo0v4+a+uyeUS7Avg==</password>
</credentials>
<!–<soaPartition>default</soaPartition>–>
</remoteQuery>

To harvest a specific project, you can include project name in remoteQuery section as shown below. We can mention revision along with project name or can just mention project name if we have single version of the project.

<remoteQuery>
<serverType>SOASuite</serverType>
      <projectName>AsyncBPEL_rev1.0</projectName>
      <uri>
http://localhost:7004/</uri>
<credentials>
<user>weblogic</user>
<password>v2_1.X5z9eOo0v4+a+uyeUS7Avg==</password>
</credentials>
<soaPartition>default</soaPartition>
</remoteQuery>

The command would look like below, if we want to harvest single project:

.\harvest.bat -remote_url http://localhost:7004 -remote_username weblogic -remote_server_type SOASuite  -soa_partition default –remote_project AsyncBPEL

We can always find usage information by using –help option as shown below.

soaharvest

We should use –remote_server_type SOASuite11g to harvest SOA Suite 11g projects.

Adding Metadata for API Assets

Search in OAC using Draft status and click individual asset to edit.

draftapi1

adpiedit

In this details page, we will observe following icons used to get link to view API details, to toggle the view, to add to list of My APIs, to edit and to delete the assets respectively.

options

Clicking Toggle view brings up following to show API asset information.

toggle

Clicking Add to My APIs will add this asset to list of My APIs.

myapis

Click Edit and add/modify required metadata for an asset and Save.

edit

Publishing API Asset

To Publish API, go to Edit page and modify the status to Published as shown below.

publishapi

And the OAC Home page will show the published APIs.

publishedlist

publishedlist1

Harvesting OSB Projects

The harvesting process, adding and publishing API assets will remain same for OSB Projects but we should use harvester from location %MW_HOME$/oer/ tools/osbharvester. Please Make sure that harvester and OSB are installed in the same middleware home.

Modify the repository and remoteQuery sections in HarvesterSettings.xml as shown below. As above, use encrypt.bat to encrypt passwords. Note that we have given the Admin server port in remoteQuery section.

<repository>
<uri>
http://localhost:8111/oac</uri>
<credentials>
<user>admin</user>
<password>admin123</password>
</credentials>
<timeout>30000</timeout>
</repository>

<remoteQuery>
<serverType>OSB</serverType>
<uri>
http://localhost:7001/</uri>
<credentials>
<user>weblogic</user>
<password>weblogic1</password>
</credentials>
</remoteQuery>

Run osb-harvest.bat to do harvest of OSB Projects and you can see the new API assets got created in OAC as shown below with initial status as Draft.

osbassets

To harvest single OSB project, add projectName to remoteQuery section as shown below.

<remoteQuery>
<serverType>OSB</serverType>
    <projectName>TestESS</projectName>
<uri>
http://localhost:7001/</uri>
<credentials>
<user>weblogic</user>
<password>v2_1.X5z9eOo0v4+a+uyeUS7Avg==</password>
</credentials>
</remoteQuery>

osbsigle

Note that I had to change following highlighted line in setenv.bat file to include tools in OER path before running harvester otherwise encrypt and harvester commands were throwing the errors.

@rem    OSB / ConfigJar Tool Home directories

set OSB_HOME=%MW_HOME%\osb
set OER_HOME=%MW_HOME%\oer\tools
set HARVESTER_HOME=%OER_HOME%\osbharvester

Similarly, API assets can be created for REST services as shown below.

osbrest

osbrest1


Advertisements

Pages

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 337 other followers

Enter your email address to follow this blog and receive notifications of new posts by email.