Sunday, 24 April 2016

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.





Sunday, 13 September 2015

java.security.AccessControlException: access denied

In Oracle SOA 12c when we deploy composite to default partition or any other partition then we may get below error.

Error:

[09:40:14 PM] Error deploying archive sca_HelloWorld_rev1.0.jar to partition "default" on server DefaultServer [http://localhost:7101]
[09:40:14 PM] HTTP error code returned [500]
[09:40:14 PM] Error message from server:
There was an error deploying the composite on DefaultServer: java.security.AccessControlException: access denied ("oracle.fabric.permission.CompositePermission" "default" "provision"): access denied ("oracle.fabric.permission.CompositePermission" "default" "provision").
- See more at: http://www.soawork.com/2014/07/oracle-fabric-permission-composite.html#sthash.GZEzTwej.dpuf




Cause:

This error occurs when you use JDK 8 to install Oracle SOA 12c in your machine, JDK 8 has some extra security features that causing this issue.

Resolution:


Uninstall your Oracle SOA 12c and re-install with JDK 7 version.



Oracle 12c Soa Suite Installation In Windows

In this blog I will explain you how to install Oracle Soa 12c.It very simple and need less time consuming  as compared to other versions.

Step1 :

Go to google and  search with "Oracle SOA  Suite Downloads"

Step2 :

Pick up the 1st link navigate to oracle website,"Accept license agreements" ,expand "Recommended install process" and start downloading the complete pack "SOA Suite 12.1.3 Size: 2.97 GB, Check Sum: 1579850769"




Step 3:


Once downloaded go to the folder path where its saved in your disk.Next go to command prompt by right clicking 
"RUN AS ADMINISTARTOR" and locate to the path where its actually downloaded.

For example in my case to run the downloaded  exe file its below commands in command prompt :

F:\softwares\12c_downloads> "C:\Program Files\Java\jdk1.7.0_67\bin\java.exe"   -jar  fmw_12.1.3.0.0_soa_quickstart.jar



Note--> You need to provide java/ jdk path as mentioned in bold.





Step 4:

Wait for few seconds it will start installing.Click -> next-> next as suggested to complete the installation



Step5:

Once done open jdeveloper --> Navigate To Run-->Start Server Instance.

Provide details 1st time when you configure like--> host,port,username, password

Click OK,,wait for few minutes your 12c server will get configured.

This is last step once server in running mode you can build applications and deploy to weblogic 12c server.














Sunday, 14 June 2015

How to enable System.out.println messages in Weblogic server



Using System.out.println is common practice to debug issues in Java applications.

By default Weblogic server does not display the standard System.out.println messages. To enable those go to weblogic console http://<server-name>:port/console

Click Domain Name > Environments > Servers  > <Server-name> > Logging  and check the following options underAdvanced option.


Redirect stdout Logging enabled.(check mark)

Redirect stderr Logging enabled.(check mark)



Restart the specific managed server and now the System.out.println messages will be visible on the ServerName.log file which is commonly under domain_directory/servers/<server-name>/logs






Saturday, 4 April 2015

Error occurred during initialization of VM & Could not reserve enough space for object heap during weblogic server Startup

This works :

this exists :



set JAVA_OPTIONS=%JAVA_OPTIONS% set DEFAULT_MEM_ARGS=-Xms512m -Xmx1024m set PORT_MEM_ARGS=-Xms768m -Xmx1536m


Set this :

 To: set JAVA_OPTIONS=%JAVA_OPTIONS% set DEFAULT_MEM_ARGS=-Xms512m -Xmx768m set PORT_MEM_ARGS=-Xms768m -Xmx1536m



Monday, 29 December 2014

XSLT-SOME GUIDE

<xsl:apply-template> tag signals the XSLT processor to find the appropriate template to apply, based on the type and context of each selected node.

Following is the example of xslt template :

<xsl:apply-template
   select = Expression
   mode = QName
</xsl:apply-template>
 
 
 
select--> used to process nodes selected by an XPath expression, instead of processing all children
mode--> Allows an element as specified by its Qualified Names to be processed multiple times, each time producing a different result



Simple Example  1 :

Consider this xml :
 <?xml version="1.0"?><?xml-stylesheet type="text/xsl"?><hello-world><greeter>An XSLT Programmer</greeter><greeter1>An XSLT Programmers</greeter1><greeting>Hello, World!</greeting> </hello-world>

XSLT :

<?xml version="1.0"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:template match="/"><xsl:apply-templates select="hello-world/greeter"/></xsl:template><xsl:template match="hello-world/greeter"><xsl:value-of select="." /></xsl:template></xsl:stylesheet>

OUTPUT :

<?xml version="1.0" encoding="UTF-8"?>An XSLT Programmer

Here apply templates calls : template match which in turns displays the value.




good link:


http://www.informit.com/library/content.aspx?b=STY_XML_21days&seqNum=109