Saturday 30 April 2016

How To Import SOA Composite Into JDEV



Open Jdev, File --> Import --> SOA Archive into SOA Project
























Provide an appropriate project name




















Import the jar file and finish





















This will import all the project resources from the jar file into your current project





What Is adf-config.xml file In SOA

The common adf-config.xml file can be used to deploy all the composites instead of using the adf-config file from the individual composite applications.


The adf-config file configurations can be changed at runtime through ant script to deploy the composites to different environments.


By this approach, we can reduce the maintenance of individual adf-config files also by using the same adf-config file the composites can be deployed to different environments.


How To Get ADf.Config.xml file :


1) Go to any bel project,referred from mds.

2) Navigate to --> projectname -->sca_inf--> classes-->meta-inf--> adf-config(xml file)



3)Typical Adf-Config.xml file :



<?xml version='1.0' encoding='windows-1252'?>
<adf-config xmlns="http://xmlns.oracle.com/adf/config" xmlns:config="http://xmlns.oracle.com/bc4j/configuration" xmlns:adf="http://xmlns.oracle.com/adf/config/properties" xmlns:sec="http://xmlns.oracle.com/adf/security/config">
   <adf-adfm-config xmlns="http://xmlns.oracle.com/adfm/config">
      <defaults useBindVarsForViewCriteriaLiterals="true" useBindValuesInFindByKey="true" executeEmptyOnException="true"/>
      <startup>
         <amconfig-overrides>
            <config:Database jbo.locking.mode="optimistic"/>
         </amconfig-overrides>
      </startup>
   </adf-adfm-config>
   <adf:adf-properties-child xmlns="http://xmlns.oracle.com/adf/config/properties">
         </adf:adf-properties-child>
   <sec:adf-security-child xmlns="http://xmlns.oracle.com/adf/security/config">
      <CredentialStoreContext credentialStoreClass="oracle.adf.share.security.providers.jps.CSFCredentialStore" />
   </sec:adf-security-child>
   <adf-mds-config xmlns="http://xmlns.oracle.com/adf/mds/config">
      <mds-config xmlns="http://xmlns.oracle.com/mds/config">
         <persistence-config>
            <metadata-namespaces>
               <namespace path="/apps/abcd" metadata-store-usage="mstore"/>
            </metadata-namespaces>
            <metadata-store-usages>
               <metadata-store-usage id="mstore-usage_2">
                  <metadata-store class-name="oracle.mds.persistence.stores.db.DBMetadataStore">
                     <property name="jdbc-userid" value="@username"/>
                     <property name="jdbc-url" value="@dburl"/>
                     <property name="partition-name" value="@soapartition"/>
                  </metadata-store>
               </metadata-store-usage>
            </metadata-store-usages>
         </persistence-config>
      </mds-config>
   </adf-mds-config>
</adf-config>



4)Create a Build.properties file for each environment and specify the MDS details as mentioned below.
Build.properties


oa.partition=soa-infra
db.user=SOA_MDS
db.password=xxxx



5)

Replace the tokens with the environment actual value during deployment in adf-config.xml file. 
The below Ant script can be used to replace the tokens.

adfconfigbasedir should be changed to the parent folder where the .adf folder is copied.
<loadproperties srcFile="build.properties"/>
<replace dir="${ adfconfigbasedir }/ .adf/ META-INF" token="@db.user@" value="${db.user}">
<include name="adf-config.xml"/>
</replace> 
<replace dir="${ adfconfigbasedir }/ .adf/META-INF" token="@db.password@" value="${db.password}">
<include name="adf-config.xml"/>
</replace> 
<replace dir="${ adfconfigbasedir }/ .adf/META-INF" token="@db.url@" value="${db.url}">
<include name="adf-config.xml"/>
</replace> 
<replace dir="${adfconfigbasedir}/ .adf/META-INF" token="@partition@" value="${soa. partition }">
<include name="adf-config.xml"/>
</replace>






    

Friday 29 April 2016

oracle.webservices Authentication

HTTP basic authentication can have two types of authentication handshake methods, one is Reactive another one is Preemptive,



Reactive:
  • The client makes a request for a resource which needs authentication;
  • The server returns an HTTP 401 Authorization required response (indicating the authentication scheme and realm) with WWW-Authenticate header.
  • The client re-submits the request with an Authentication header;
  • The server verifies client credentials and returns the resource if authenticated successfully..

Preemptive:

The client can preemptively pass the credentials on the first request. The server returns immediately the resource if authenticated successfully.

Not all the authentication server accepts the Preemptive authentication mode, The NTLM authentication will not support the Preemptive handshake method it should be Reactive.

In Oracle SOA 11g the parnerlink binding property oracle.webservices.preemptiveBasicAuth will help us to set the handshake method accordingly.
  • oracle.webservices.preemptiveBasicAuth=false - Reactive mode
  • oracle.webservices.preemptiveBasicAuth=true - Preemptive mode

Sunday 24 April 2016

Oracle OSB New And Changed Features

Below are the list of changes along with new entry in osb 12 version :



1)Support for cross-reference tables and domain value maps, both features from
Oracle SOA Suite.

2) Pipelines are now a separate component from proxy services, and can be created
and configured separately.


3) Resequencing messages using the same resequencer engine as Oracle Mediator.


4) Sharing variables among all pipelines in a chain, which allows them to read and
modify the same variable.


5)Creating pipeline templates on which to base new pipelines, allowing you to reuse
your already developed message processing logic.



6)Enabling and disabling a stage, which effectively allows you to skip certain
actions.


7)Split-joins are a separate component, and can be created and configured separately.


8) Support for cross-reference tables and domain value maps, both features from
Oracle SOA Suite.


9)Importing and exporting resources and configurations from both JDeveloper and
the Oracle Service Bus Console to either a configuration JAR file or to a WebLogic
Server.


10) The ability to log malformed XML payloads in the $fault variable through a new
PayloadDetail element.


oracle.fabric.common.FabricInvocationException: Unable to find the WSDL service defined for service name

I was working on an integration with siebel system .When I am trying to invoke their service,

it used throw the below mentioned error :

 <fault>
<bpelFault>
<faultType>0</faultType>
<remoteFault>
<part  name="summary">
<summary>oracle.fabric.common.FabricInvocationException: Unable to find the WSDL service defined for service name {http://abcd.com/}CC_spcDC_spcNotifications. Please make sure that the port attribute for the binding defined in the composite file is correct by checking the namespace and service name in the #wsdl.endpoint element. In addition, check that the WSDL associated with the binding namespace is imported and currently reachable (check the import nodes at the top of the composite file). Finally, validate any HTTP proxy settings for the server.</summary>
</part>
<part  name="detail">
<detail>Unable to find the WSDL service defined for service name {http://abcd.com}CC_spcDC_spcNotifications. Please make sure that the port attribute for the binding defined in the composite file is correct by checking the namespace and service name in the #wsdl.endpoint element. In addition, check that the WSDL associated with the binding namespace is imported and currently reachable (check the import nodes at the top of the composite file). Finally, validate any HTTP proxy settings for the server.</detail>
</part>
<part  name="code">
<code>null</code>
</part>
</remoteFault>
</bpelFault>
</fault>


How To Tackle This Problem :


1) First take out the wsdl file and put in xml spy  or any online validator to check whether structure is of correct format.


2) The wsdl file should have a structure called "service" at bottom like mentioned below.If its missing it throws out  mentioned error intermittently(ideally it should not) :


<service name="Notifications">
      <port binding="tns:spcNotifications" name="C_spcNotifications">
         <soap:address location="http://abcd.com"/>
      </port>
   </service

3) Check with target partner system whether their service is up or running.


4) Most Imp:


This  can be resolved temporarily by bouncing the SOA Server.Issue might come up again if same wsdl is uploaded again.



I have spent nights in resolving this issue....happy programming!! :) 



ESS Job Request from BPEL in SOA 12c


Introduction

SOA Suite 12c added a new component: Oracle Enterprise Scheduler Service (ESS). ESS provides the ability to run different job types distributed across the nodes in an Oracle WebLogic Server cluster. Oracle Enterprise Scheduler runs these jobs securely, with high availability and scalability, with load balancing and provides monitoring and management through Fusion Middleware Control. ESS was available as part of the Fusion Applications product offering. Now it is available in SOA Suite 12c. In this blog, I will demonstrate how to use a new Oracle extension, “Schedule Job”, in JDeveloper 12c to submit an ESS job request from a BPEL process.

Set up a scheduled job in Enterprise Scheduler Service

1. Create a SOA composite with a simple synchronous BPEL process, HelloWorld.
2. Deploy HelloWorld to Weblogic.
3. Logon to Fusion Middleware Enterprise Manager.
4. Go to Scheduling Services -> ESSAPP -> Job Metadata -> Job Definitions. This takes you to the Job Definitions page.
2

5. Click the “Create” button, this takes you to Create Job Definition page. Enter:
Name: HelloWorldJob
Display Name: Hello World Job
Description: Hello World Job
Job Type: SyncWebserviceJobType
Then click “Select Web Service…”. It pops up a window for the web service.
39
6. On the “Select Web Service” page, select Web Service Type, Port Type, Operation, and Payload. Click “Ok” to finish creating job definition.
8

Secure the Oracle Enterprise Scheduler Web Service

The ESS job cannot be run as an anonymous user, you need to attach a WSM security policy to the ESS Web Service:
1. In Fusion Middleware Enterprise Manager, go to Scheduling Services -> ESSAPP, right click, select “Web Services”.
3
2. In Web Service Details, click on the link “ScheduleServiceImplPort”.
4
3. Open tab “WSM Policies” and click on “Attach/Detach”.
5
4. In “Available Policies”, select “oracle/wss_username_token_service_policy”, click “Attach” button to attach the policy and then click on “Ok” to finish the policy attachment.
6
5. You should see the policy attached and enabled.
7

Create a SOA Composite to Submit a HelloWorldJob

1. Create a new SOA Application/Project with an asynchronous BPEL (2.0) process, InvokeEssJobDemo, in JDeveloper 12c.
2. Create a SOA_MDS connection.
14
3. Enter SOA MDS database connection and test connection successfully.
15
4. Add a Schedule Job from Oracle Extensions to InvokeEssJobDemo BPEL process.
16
5. Double click the newly added Schedule Job activity. This brings up the Edit Schedule Job window.
6. Enter Name “ScheduleJobHelloWorld”, then click “Select Job” button.
17
7. This brings up the Enterprise Scheduler Browser. Select the MDS Connection and navigate down the ESS Metadata to find and select “HelloWorldJob”.
18
8. To keep it simple, we did not create a job schedule. So there is no job schedule to choose. If you have job schedules defined and would like to use them, you can choose a Schedule from the MDS connections.
9. Set Start Time as current date time, and click OK.
19
10. You may see this pop up message.
20
11. Click “Yes” to continue. In the next several steps we will replace WSDL URL with concrete binding on the reference binding later to fix this.
12. In EM, go to Scheduling Services -> Web Services.
21
13. Click on link “SchedulerServiceImplPort”
22
14. Click on link “WSDL Document SchedulerServiceImplPort”.
23
15. It launches a new browser window displaying the ESSWebService wsdl. WSDL URL is in the browser address.
24
16. Update EssService WSDL URL.
25
17. You need to attach WSM security policy to EssService request.
26
18. Add Security Policy: oracle/wss_username_token_client_policy.
27
19. Setting up the credential store for policy framework is beyond the scope of this blog. We will use a short cut, the default weblogic user and password, as Binding Properties on the EssService reference binding to which the security policy is attached.
40

20. Build and deploy InvokeEssJobDemo.
21. Test InvokeEssJobDemo web service.
29
22. It should show that the web service invocation was successful.
34
23. Launch flow trace. We can see that Job 601 was successfully submitted.
32
24. Go ESSAPP -> Job Requests -> Search Job Requests. Find Job 601. Job was executed successfully.


35
 Actual document URL:

http://www.ateam-oracle.com/submitting-ess-job-from-bpel-in-soa-12c/


12c-SOAINFRA database connection in Default domain of SOA12c IntegratedWeblogicServer


Follow the below steps to connect to SOAINFRA database:

1. To connect to weblogic server connection details are required. These connection details can be found from the SOADataSource. For this login to weblogic admin console.


2) After login, click on Data Sources.


3. Open SOADataSource and click on Connection Pool. Copy the connection URL. URL will be like
jdbc:derby://localhost:1527/soainfra;ServerName=localhost;databaseName=soainfra

Description of URL :

  • HostName : localhost
  • Port Number : 1527
  • UserName : soainfra
  • Database Name : soainfra


4)Now open JDeveloper or any other tool to acess the SOAINFRA database.

5) Create a new database connection and and fill details as mentioned in the step 3. Select Connection Type as "Java DB (Derby)".

6) Connection will get created as shown below :













XPath by example in Oracle Service Bus

"Growing old ...So copied the below reference from Chris Tompkins blog as a reference  :)  "



Oracle Service Bus (and the other products in the SOA Suite) is designed to help you solve the majority of common integration scenarios without writing any code. However, as one customer pointed out to me recently:
Lets assume the XML below forms the message payload (i.e. the contents of the body variable, $body) in Oracle Service Bus and we are just using a Log action to print out the result.
<?xml version="1.0" encoding="UTF-8"?>
<p:PurchaseOrder id="1234" xmlns:p="
http://www.someshop.com/PurchaseOrder"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.someshop.com/PurchaseOrder PurchaseOrder.xsd ">
  <p:date>2010-04-02</p:date>
  <p:custID>C7123843</p:custID>
  <p:items>
    <p:item id="GF234324">
      <p:description>Denim Jeans</p:description>
      <p:department>Clothing</p:department>
      <p:price>30.99</p:price>
      <p:quantity>2</p:quantity>
    </p:item>
    <p:item id="HD312782">
      <p:description>iPod 80Gb White</p:description>
      <p:department>Electrical</p:department>
      <p:price>99.99</p:price>
      <p:quantity>1</p:quantity>
    </p:item>
    <p:item id="HD998775">
      <p:description>iPod Headphones</p:description>
      <p:department>Electrical</p:department>
      <p:price>19.99</p:price>
      <p:quantity>1</p:quantity>
    </p:item>
    <p:item id="KD123984">
      <p:description>Frying Pan</p:description>
      <p:department>Home</p:department>
      <p:price>9.99</p:price>
      <p:quantity>1</p:quantity>
    </p:item>
  </p:items>
  <p:cardDetails>
    <p:type>Mastercard</p:type>
    <p:cardNumber>1234-5678-1234-5678</p:cardNumber>
  </p:cardDetails>
</p:PurchaseOrder>
Below are the XPath expressions you will need to log the various information from the payload:
a) The purchase order id:
$body/pur:PurchaseOrder/@id
Note: The actual namespace prefix, i.e. pur (the default assigned by Oracle Service Bus in this case), does not have to match the namespace prefix in the original XML document (p), however they both need to point to the namespace URL http://www.someshop.com/PurchaseOrder.
b) The customer id:
$body/pur:PurchaseOrder/pur:custID/text()
Note: In contrast to attributes, XML elements (nodes) can contain a variety of different types of data or even other complex elements, hence the use of the text() function to get the textual data from the element.
c) The card number (assuming you don’t know its path):
$body//pur:cardNumber/text()
Note: The use of // in XPath is not advised (unless absolutely necessary) as it does involve searching through the whole XML tree and so is not  very performant particularly for large payloads.
d) The card number (assuming you don’t know its path or namespace):
$body//*:cardNumber/text()
e) The number of items in the purchase order:
count($body/pur:PurchaseOrder/pur:items/pur:item)
Note: We are using the count function and pointing to the repeating item element in the XML payload.
f) The id of the first item in the order:
$body/pur:PurchaseOrder/pur:items/pur:item[1]/@id
Note: We are using the [1] to select the first item – XPath is unlike most programming languages which index  arrays from 0 rather than 1.
g) The item(s) with id GF234324:
$body/pur:PurchaseOrder/pur:items/pur:item[@id="GF234324"]
Note: This expression will actually return a list of all items whose id attribute is GF234324 – in our example there is only one item with this id.
h) The description of the item with id GF234324:
$body/pur:PurchaseOrder/pur:items/pur:item[@id="GF234324"]/pur:description/text()

Note: This works because there is only one item with this id in the payload.
i) The electrical items in the purchase order:
$body/pur:PurchaseOrder/pur:items/pur:item[pur:department="Electrical"]
j) The second electrical item in the purchase order:
$body/pur:PurchaseOrder/pur:items/pur:item[pur:department="Electrical"][2]
k) The last item in the purchase order:
$body/pur:PurchaseOrder/pur:items/pur:item[last()]
Note: We are using the last() function here to determine the last item in the purchase order.
l) The second item in the purchase order:
$body/pur:PurchaseOrder/pur:items/pur:item[position()=2]
Note: We are using the position() function here to determine the second item in the purchase order.
m) The purchase order date in UK date format (i.e. DD/MM/YYYY)
translate('AB/CD/EFGH','EFGH-CD-AB', xs:string($body/pur:PurchaseOrder/pur:date))
Note: We are using the translate function here to convert the date to UK format. The first argument represents the output format (i.e. UK date format), the second argument represents the incoming format (i.e. XML schema date format) and the third argument represents the thing we are translating (i.e. the purchase order date).
Note: The translate function only works on strings and so we need to convert the purchase order date into a string, hence the use of the xs:string function.




Jdev 12c not showing Property Window of Pipeline Component in JDeveloper 12c

Oracle SOA Suite 12c introduces a new development environment for Oracle Service Bus (OSB). While OSB development was supported by the web-based SB Console and an Eclipse Plugin in 11g, the development has been moved to JDeveloper in 12c. This is done by introduction of a new OSB editor, which looks quite similar to the SCA application composite editor.




When selecting a component of the pipeline, in the properties window below all properties to be defined will appear.


However, sometimes the properties will not show up when selecting the pipeline component in the pipeline editor



This behavior has been reported with JDeveloper 12c installed with QuickStart on a Microsoft Windows 7 x64 machine running JDK 1.7.0 Update 67 (x64). The properties windows actually does not capture the selection of the component in the main windows. The workaround is simply to close and reopen JDeveloper ... which might be annoying if you are running the integrated WebLogic Server.