<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8373228118181038400</id><updated>2012-02-16T18:49:25.645+04:00</updated><category term='Others'/><category term='Tools'/><category term='XML'/><category term='specifications'/><category term='Oracle SOA suite'/><category term='Java'/><category term='SOA'/><category term='BPEL'/><title type='text'>Sashwat Gupta's blog</title><subtitle type='html'>Software Consultant</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>46</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-447523351438532403</id><published>2011-05-16T13:25:00.001+04:00</published><updated>2011-05-16T13:25:34.361+04:00</updated><title type='text'>Using XPath with Oracle XMLType</title><content type='html'>Example below shows the extraction of details from an Oracle AQ queue with datatype of XML Type using XPath.&lt;br /&gt;&lt;br /&gt;&lt;div cellspacing="0" class="codewrap2"&gt;&lt;br /&gt;SELECT&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; w.user_data.extract('//m:DeclarationNo/text()', 'xmlns:m="http://namespace/DPWClearance/2.1"').getStringVal() "DeclarationNo"&lt;br /&gt;&amp;nbsp;&amp;nbsp;FROM CLEARANCE_QTAB w ORDER BY ENQ_TIME DESC&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-447523351438532403?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/447523351438532403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=447523351438532403' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/447523351438532403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/447523351438532403'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2011/05/using-xpath-with-oracle-xmltype.html' title='Using XPath with Oracle XMLType'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-4351713240834836033</id><published>2010-12-14T09:06:00.001+04:00</published><updated>2010-12-14T09:07:28.567+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SOA'/><category scheme='http://www.blogger.com/atom/ns#' term='BPEL'/><title type='text'>Dehydration store purging</title><content type='html'>Interesting post for purging the dehydration store:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.oracle.com/technetwork/middleware/bpel/learnmore/bpeldehydrationstorepurgestrategies-192217.pdf"&gt;http://www.oracle.com/technetwork/middleware/bpel/learnmore/bpeldehydrationstorepurgestrategies-192217.pdf&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Also a simple explanation of High watermark:&lt;br /&gt;&lt;a href="http://www.oracle.com/technetwork/middleware/bpel/learnmore/bpeldehydrationstorepurgestrategies-192217.pdf"&gt;http://www.oracle.com/technetwork/middleware/bpel/learnmore/bpeldehydrationstorepurgestrategies-192217.pdf&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-4351713240834836033?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/4351713240834836033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=4351713240834836033' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4351713240834836033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4351713240834836033'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2010/12/dehydration-store-purging.html' title='Dehydration store purging'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-6510419844401582689</id><published>2010-11-24T12:33:00.010+04:00</published><updated>2010-11-24T12:46:58.915+04:00</updated><title type='text'>Validating Date in java</title><content type='html'>I recently ran into a peculiar problem while working with Dates in java. I need to validate an input date provided in the format (dd-MM-yyyy). This seems a very simple requirement.&lt;br /&gt;&lt;br /&gt;Input: String&lt;br /&gt;Output: Boolean indicating whether the provided date is in provided format&lt;br /&gt;&lt;br /&gt;&lt;div cellspacing="0" class="codewrap2"&gt;&lt;pre&gt;private static String DATE_FORMAT = "dd-MM-yyyy";&lt;br /&gt;    public boolean validateDate(String date) {&lt;br /&gt;        try {&lt;br /&gt;            DateFormat df = new SimpleDateFormat(DATE_FORMAT);&lt;br /&gt;            df.parse(date);&lt;br /&gt;            return true;&lt;br /&gt;        } catch (ParseException e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;The following results were observed.&lt;br /&gt;&lt;br /&gt;&lt;table border="1" cellpadding="2" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;Input&lt;/th&gt;&lt;th&gt;Actual Output&lt;/th&gt;&lt;th&gt;Expected Output&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;01-01-9999&lt;/td&gt;&lt;td&gt;true&lt;/td&gt;&lt;td&gt;true&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;333-01-9999&lt;/td&gt;&lt;td&gt;true&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;As provided in the API documentation of DateFormat states&lt;br /&gt;&lt;blockquote&gt;&lt;i&gt;By default, parsing is lenient: If the input is not in the form used by this object's format method but can still be parsed as a date, then the parse succeeds. Clients may insist on strict adherence to the format by calling setLenient(false).&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;Thus the unexpected behavior while parsing the input '333-01-9999'. We now change the code to add &lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;private static String DATE_FORMAT = "dd-MM-yyyy";&lt;br /&gt;    public boolean validateDate(String date) {&lt;br /&gt;        try {&lt;br /&gt;            DateFormat df = new SimpleDateFormat(DATE_FORMAT);&lt;br /&gt;            df.setLenient(false);&lt;br /&gt;            df.parse(date);&lt;br /&gt;            return true;&lt;br /&gt;        } catch (ParseException e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;The following results were observed.&lt;br /&gt;&lt;br /&gt;&lt;table border="1" cellpadding="2" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;Input&lt;/th&gt;&lt;th&gt;Actual Output&lt;/th&gt;&lt;th&gt;Expected Output&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;01-01-9999&lt;/td&gt;&lt;td&gt;true&lt;/td&gt;&lt;td&gt;true&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;333-01-9999&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;3a-01-9999&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;02-03-1@@@&lt;/td&gt;&lt;td&gt;true&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;02-03-18&lt;/td&gt;&lt;td&gt;true&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;And boom. The parsing of '02-03-1@@@' and '02-03-18' again provides us with an unexpected result. This seems to be a bug in the validation.&lt;br /&gt;&lt;br /&gt;So I searched the Sun bug database. But strangely enough the bug has been rejected. The rationale provided is completely and utterly bull*&amp;amp;amp;(#.&lt;br /&gt;&lt;a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5055568"&gt;http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5055568&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The comments by the Bug submitter have been ignored. &lt;br /&gt;&lt;br /&gt;Suppose the input to the method is supposed to be '01-01-2010' and the user provides '01-01-2o10' then the data will be converted into the date 01-01-0002. This after the seeing the setLenient&lt;i&gt; &lt;/i&gt;documentation which states that:-&lt;br /&gt;&lt;blockquote&gt;&lt;i&gt;Specify whether or not date/time parsing is to be lenient. With lenient parsing, the parser may use heuristics to interpret inputs that do not precisely match this object's format. With strict parsing, inputs must match this object's format. &lt;/i&gt;&lt;/blockquote&gt;So the solution to this problem is to match the string using regular expression before validating with the parse method. &lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;private static String DATE_FORMAT = "dd-MM-yyyy";&lt;br /&gt;    private String REGEX_DATE_FORMAT = "^(0[1-9]|[12][0-9]|3[01])[- ](0[1-9]|1[012])[- ]\\d\\d\\d\\d$";&lt;br /&gt;    public boolean validateDate(String date) {&lt;br /&gt;        try {&lt;br /&gt;            if(!Pattern.matches(REGEX_DATE_FORMAT, date)) {&lt;br /&gt;                return false;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            DateFormat df = new SimpleDateFormat(DATE_FORMAT);&lt;br /&gt;            System.out.println(df.parse(date));&lt;br /&gt;            return true;&lt;br /&gt;        } catch (ParseException e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;table border="1" cellpadding="2" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;Input&lt;/th&gt;&lt;th&gt;Actual Output&lt;/th&gt;&lt;th&gt;Expected Output&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;01-01-9999&lt;/td&gt;&lt;td&gt;true&lt;/td&gt;&lt;td&gt;true&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;333-01-9999&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;3a-01-9999&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;02-03-1@@@&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;02-03-18&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;So we solve the problem.&lt;br /&gt;Hoping some day java will include a simpler way of validation of dates.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-6510419844401582689?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/6510419844401582689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=6510419844401582689' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/6510419844401582689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/6510419844401582689'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2010/11/validating-date-in-java.html' title='Validating Date in java'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-7079440185745100262</id><published>2010-07-08T12:17:00.000+04:00</published><updated>2010-07-08T14:17:52.209+04:00</updated><title type='text'>Extending schema with redefine and Java</title><content type='html'>&lt;b&gt;Requirement&lt;/b&gt;&lt;br /&gt;&lt;p&gt;In this case a system which has an external interface (say a web service exposed to external clients) let us only consider the xsd for this example. Assume that the xsd is imported in a wsdl and used.Internally it needs to maintain an enhanced information model which adds multiple attributes to the provided complex types. The internal information model is not a new one it is just an enhanced model.Any additions or changes to the external xsd will require the changes in the internal xsd as well.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_xWUcYX5ldbA/TDWOHGBnmDI/AAAAAAAAEzc/yULXvLyvTTY/s1600/untitled.bmp"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 211px;" src="http://3.bp.blogspot.com/_xWUcYX5ldbA/TDWOHGBnmDI/AAAAAAAAEzc/yULXvLyvTTY/s400/untitled.bmp" border="0" alt=""id="BLOGGER_PHOTO_ID_5491451573175818290" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Possible solutions&lt;/b&gt;&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Use a new xsd for external and internal interfaces copying all attributes. The disadvantage for this approach is the maitainanve of the xsds.Any change requires changes in both the places. The advantage is that the internal and external xsd become disconnected and can be maintained seperately. We do not require the advantage in our case since it would be a maintainance overhead&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Import the external xsd and reuse the elements whereever possible by extending them or using them as is. It is not a very clean approach lot of repeated code would result but it would be lesser than option 1.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Redefine the elements enhanced and use it for further processing. Much cleaner approach is expected.&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;p&gt;Detailed diffierence between xml schema extend vs redefine elements is explained below:&lt;p&gt;&lt;br /&gt;The external xsd and its sample xml is show below:-&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_xWUcYX5ldbA/TDWKPQF0GhI/AAAAAAAAEy0/XDoFgrJX1ao/s1600/DB.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 352px;" src="http://1.bp.blogspot.com/_xWUcYX5ldbA/TDWKPQF0GhI/AAAAAAAAEy0/XDoFgrJX1ao/s400/DB.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5491447315270212114" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;center&gt;Fig. external xsd&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_xWUcYX5ldbA/TDWKQJXOrhI/AAAAAAAAEzE/gKFfm5CRmVk/s1600/DB_xml.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 108px;" src="http://2.bp.blogspot.com/_xWUcYX5ldbA/TDWKQJXOrhI/AAAAAAAAEzE/gKFfm5CRmVk/s400/DB_xml.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5491447330644078098" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;center&gt;Fig. external sample xml&lt;/center&gt;&lt;br /&gt;&lt;p&gt;The external interface conatains an element Request with two elements name and child. The child is a complex type with an element t1. The internal interface needs to enhace the child complex type to add two more elements val1 and val2&lt;/p&gt;&lt;br /&gt;While using the extend element the schema and the example xml will look like:-&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_xWUcYX5ldbA/TDWKfIoMp-I/AAAAAAAAEzM/IoDlqaQmND4/s1600/DBExt.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 321px;" src="http://4.bp.blogspot.com/_xWUcYX5ldbA/TDWKfIoMp-I/AAAAAAAAEzM/IoDlqaQmND4/s400/DBExt.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5491447588144850914" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;center&gt;Fig. internal xsd using extends construct&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_xWUcYX5ldbA/TDWKfbGslPI/AAAAAAAAEzU/EHnS80Bujdg/s1600/DBExt_xml.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 122px;" src="http://1.bp.blogspot.com/_xWUcYX5ldbA/TDWKfbGslPI/AAAAAAAAEzU/EHnS80Bujdg/s400/DBExt_xml.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5491447593104610546" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;center&gt;Fig. internal sample xml&lt;/center&gt;&lt;br /&gt;&lt;p&gt;As seen above the extends needs to redefine the parent attribute if the child element is extended. This leads to a very complicated xsd and the reusability of the defined types becomes very limited. This problem can be overcome if redefine construct is used as shown below.&lt;/p&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_xWUcYX5ldbA/TDWKOclndnI/AAAAAAAAEyk/ivhYgOPPYc0/s1600/D.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 251px;" src="http://4.bp.blogspot.com/_xWUcYX5ldbA/TDWKOclndnI/AAAAAAAAEyk/ivhYgOPPYc0/s400/D.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5491447301444957810" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;center&gt;Fig. internal xsd using redefine and extends construct&lt;/center&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_xWUcYX5ldbA/TDWKPGQYZ_I/AAAAAAAAEys/Y_YtUaoCaQc/s1600/D_xml.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 144px;" src="http://4.bp.blogspot.com/_xWUcYX5ldbA/TDWKPGQYZ_I/AAAAAAAAEys/Y_YtUaoCaQc/s400/D_xml.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5491447312630179826" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;center&gt;Fig. sample xml for the above xsd&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Tool and API support:&lt;/b&gt;&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;&lt;dt&gt;&lt;b&gt;JAX-RPC and redefine&lt;/b&gt;&lt;/dt&gt;&lt;br /&gt;&lt;dd&gt;According to the JAX-RPC 1.1 specifications (http://test.javaranch.com/ulf/jaxrpc-1_1-fr-spec.pdf):-&lt;br/&gt;&lt;br /&gt;The following XML Schema features are not required to be supported and WSDL to Java mapping tools are allowed to reject documents that use them: xsd:redefine, xsd:notation, substitution groups.&lt;br/&gt;&lt;br /&gt;The JDeveloper does not generate the proxy for the web service that contains the redefine element.&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;&lt;b&gt;JAXB 1 and Redefine&lt;/b&gt;&lt;/dt&gt;&lt;br /&gt;&lt;dd&gt;The XML Schema redefine construct is not supported by JAXB and if such unsupported construct is included in a schema, an error will be generated when you try to generate Java classes from them with xjc.(ref:- http://onjava.com/pub/a/onjava/2004/12/15/jaxb.html)&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;&lt;b&gt;JAXB 2 and Redefine&lt;/b&gt;&lt;/dt&gt;&lt;br /&gt;&lt;dd&gt;XJC for JAXB 2 successfully generates the proxy for the web service&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;&lt;b&gt;SOAP-UI and redefine&lt;/b&gt;&lt;/dt&gt;&lt;br /&gt;&lt;dd&gt;SOAP UI does not support the use of redefine elements. I have raised the following bug&lt;br /&gt;http://sourceforge.net/tracker/index.php?func=detail&amp;aid=3019440&amp;group_id=136013&amp;atid=737763&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;&lt;b&gt;XML SPY and redefine&lt;/b&gt;&lt;/dt&gt;&lt;br /&gt;&lt;dd&gt;I am using XML Spy 2008. This successfully generates a sample SOAP message from a WSDL containing the redefine element.&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;&lt;b&gt;WS-Interoperability Basic Profile 1.1&lt;/b&gt;&lt;/dt&gt;&lt;br /&gt;&lt;dd&gt;This element is compliant and does not cause any errors.&lt;/dd&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;&lt;p&gt;The redefine construct does provide a flexible construct for extending the schema definations. The support is limited for the construct and is improving. The redefine schema construct cannot be used with JAX RPC, but is compliant with JAXB 2 so any other web services programming model that uses JAXB 2 like JAX WS or Spring Web Services can be used.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-7079440185745100262?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/7079440185745100262/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=7079440185745100262' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/7079440185745100262'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/7079440185745100262'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2010/07/using-xsdredefine-with-java.html' title='Extending schema with redefine and Java'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_xWUcYX5ldbA/TDWOHGBnmDI/AAAAAAAAEzc/yULXvLyvTTY/s72-c/untitled.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-6266803518324109807</id><published>2010-07-07T19:37:00.000+04:00</published><updated>2010-07-08T14:17:04.619+04:00</updated><title type='text'>Anatomy of a signed SOAP message</title><content type='html'>I will explain a WSS signed web service SOAP message,signed using a X509 certificate. &lt;br /&gt;&lt;br /&gt;The sample signed message is:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_xWUcYX5ldbA/TDVl5EEYByI/AAAAAAAAEyc/3P7u6LU8yxQ/s1600/example.bmp"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 237px;" src="http://4.bp.blogspot.com/_xWUcYX5ldbA/TDVl5EEYByI/AAAAAAAAEyc/3P7u6LU8yxQ/s400/example.bmp" border="0" alt=""id="BLOGGER_PHOTO_ID_5491407351667230498" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The following illustrates the anatomy of the message&lt;br /&gt;1. SignedInfo&lt;br /&gt;&lt;br /&gt;The SignedInfo element describes the signed content of the message.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_xWUcYX5ldbA/TDSgAX4BZzI/AAAAAAAAEx0/AkmJtd8zKto/s1600/image001.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 234px;" src="http://1.bp.blogspot.com/_xWUcYX5ldbA/TDSgAX4BZzI/AAAAAAAAEx0/AkmJtd8zKto/s400/image001.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5491189773940909874" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;1.1. CanonicalizationMethod&lt;br /&gt;The element CanonicalizationMethod is used to describe the canonicalization algorithm used on the xml for the generation of the digest.&lt;br /&gt;1.2. SignatureMethod&lt;br /&gt;The element SignatureMethod is used to describe the algorithm used for the generation of the SignatureValue from the output of the canonicalization algorithm.&lt;br /&gt;1.3. Reference&lt;br /&gt;The optional URI attribute for Reference element identifies the data object that was signed.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_xWUcYX5ldbA/TDSgA8aVxVI/AAAAAAAAEx8/LA1al4OOgYM/s1600/image003.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 237px;" src="http://3.bp.blogspot.com/_xWUcYX5ldbA/TDSgA8aVxVI/AAAAAAAAEx8/LA1al4OOgYM/s400/image003.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5491189783748527442" /&gt;&lt;/a&gt;&lt;br /&gt;In the above case the body is being signed thus the URI attribute refers to the soap body.&lt;br /&gt;Transform Algorithm indicates the transformation algorithm. I still need to understand why do we need a duplicate of the canonicalization algortithm?&lt;br /&gt;DigestMethod Algorithm indicates the algorithm used to generate the digest value and DigestValue contains the computed digest value.&lt;br /&gt;2.SignatureValue&lt;br /&gt;SignatureValue contain the signature value, which is actually the encrypted digest value. This value is the output of the Signature Method Algorithm indicated&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_xWUcYX5ldbA/TDSgBMmsGCI/AAAAAAAAEyE/u9ibSIT8QSY/s1600/image005.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 237px;" src="http://3.bp.blogspot.com/_xWUcYX5ldbA/TDSgBMmsGCI/AAAAAAAAEyE/u9ibSIT8QSY/s400/image005.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5491189788095289378" /&gt;&lt;/a&gt;&lt;br /&gt;3.BinarySecurityToken&lt;br /&gt;The signed data contain a core bare name reference (as defined by the XPointer specification [XPointer]) to the&lt;wsse:binarysecuritytoken&gt; element that contains the security token referenced, or a core reference to the external data source containing the security token.&lt;br /&gt;In this example the BinarySecurityToken contains the Base64Encoded public key that can be used for verification.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_xWUcYX5ldbA/TDSgBcIVAzI/AAAAAAAAEyM/nC7Wk2GYcl8/s1600/image007.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 237px;" src="http://1.bp.blogspot.com/_xWUcYX5ldbA/TDSgBcIVAzI/AAAAAAAAEyM/nC7Wk2GYcl8/s400/image007.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5491189792262914866" /&gt;&lt;/a&gt;&lt;br /&gt;The signed content was created using a Microsoft file (.pfx) containing x509 certificates. The public key can be regenerated using the BinarySecurityToken element.&lt;br /&gt;Sample code to generate .cer from BinarySecurityToken&lt;br /&gt;&lt;div class="codewrap"&gt;&lt;br /&gt;&lt;pre&gt;// from tag BinarySecurityToken&lt;br /&gt;    private static final String b64Str = "MIIECTCCAvGgAwIBAgICLy4wDQYJKoZIhvcNAQEFBQAwdjELMAkGA1UEBhMCQUUxETAPBgNVBAoTCEV0aXNhbGF0MSQwIgYDVQQLExtFdGlzYWxhdCBlQnVzaW5lc3MgU2VydmljZXMxLjAsBgNVBAMTJUNvbXRydXN0IFVzZXIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDkwMjEyMDQ0ODMxWhcNMTEwMjEyMDQ0ODMxWjCBqjELMAkGA1UEBhMCQUUxDjAMBgNVBAcTBUR1YmFpMQ8wDQYDVQQKEwZFVENEQzIxHjAcBgNVBAsTFURlbHV4ZSBJbnRsIENhcmdvIExMQzENMAsGA1UELhMENTgwODEnMCUGCSqGSIb3DQEJARYYZGVsdXhlcGFAZW1pcmF0ZXMubmV0LmFlMSIwIAYDVQQDExlBYmR1bCBTYXR0YXIgQWJkdWwgUmF3b29mMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDfge/HNFnO/SEVdvNPTQ0ziLEMDz/EKwSWWCBK94yU58y75AsTArK/QG4+wHSALd9HDW+wxaBLd7ZLz4mjMgAJgGEEWIP9XYMvSTO2li7SI9fKANQ3/uoXTgJU0N/CLyLBZkW2Z7Vb6bsdhN6HGzsFcd5SoDmxYDh+z26RenbtUQIDAQABo4HvMIHsMAkGA1UdEwQCMAAwIwYDVR0RBBwwGoEYZGVsdXhlcGFAZW1pcmF0ZXMubmV0LmFlMEwGA1UdIARFMEMwQQYLKwYBBAGyXQIBAQAwMjAwBggrBgEFBQcCARYkaHR0cDovL2NvbXRydXN0LmV0aXNhbGF0LmFlL2Nwcy5odG1sMA4GA1UdDwEB/wQEAwIE8DAfBgNVHSMEGDAWgBTOP/R2v2Tj4qbCev148AwSjFT9fjA7BgNVHR8ENDAyMDCgLqAshipodHRwOi8vY29tdHJ1c3QuZXRpc2FsYXQuYWUvY3JsL3VzZXJjYS5jcmwwDQYJKoZIhvcNAQEFBQADggEBAKO44b564tmzCLCZhlE5gQkGzQF1tgW954nJMcfthO89C9X3QuLbBoNLrrKeQoqumKYDMiODF5Rkn1pRlgJlGSWKOkjPwF+wB4PlHjd/BijNDnyv2VJUWw7gqE6uffu2E0c4kEfun2leNY03Qtcvu9FmUL7JDj0seibEhOXzy63r+o5rf5x5/vER8vUz1MBypHea3EWbCSJ2yAEw2fJ3Syq/vuihr4yP3VOb7KBeVXL353J5pdpql4UjAwlGAdmiihAAQMCKicE6qDZ2i4jC4bS+lSDv2wE/CiTCj1DN1eEyQnajuTWvFYq88ZAHtru7q5CrsMcHMa8WXENMrUzlKdM=";&lt;br /&gt; &lt;br /&gt;    public static int decode(char c) {&lt;br /&gt;        if (c &gt;= 'A' &amp;&amp; c &lt;= 'Z')&lt;br /&gt;            return c - 65;&lt;br /&gt;        else if (c &gt;= 'a' &amp;&amp; c &lt;= 'z')&lt;br /&gt;            return c - 97 + 26;&lt;br /&gt;        else if (c &gt;= '0' &amp;&amp; c &lt;= '9')&lt;br /&gt;            return c - 48 + 26 + 26;&lt;br /&gt;        else&lt;br /&gt;            switch (c) {&lt;br /&gt;            case '+':&lt;br /&gt;                return 62;&lt;br /&gt;            case '/':&lt;br /&gt;                return 63;&lt;br /&gt;            case '=':&lt;br /&gt;                return 0;&lt;br /&gt;            default:&lt;br /&gt;                throw new RuntimeException(&lt;br /&gt;                        new StringBuffer("unexpected code: ").append(c)&lt;br /&gt;                                .toString());&lt;br /&gt;            }&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;    public static byte[] decode(String s) {&lt;br /&gt; &lt;br /&gt;        int i = 0;&lt;br /&gt;        ByteArrayOutputStream bos = new ByteArrayOutputStream();&lt;br /&gt;        int len = s.length();&lt;br /&gt; &lt;br /&gt;        while (true) {&lt;br /&gt;            while (i &lt; len &amp;&amp; s.charAt(i) &lt;= ' ')&lt;br /&gt;                i++;&lt;br /&gt; &lt;br /&gt;            if (i == len)&lt;br /&gt;                break;&lt;br /&gt; &lt;br /&gt;            int tri = (decode(s.charAt(i)) &lt;&lt; 18)&lt;br /&gt;                    + (decode(s.charAt(i + 1)) &lt;&lt; 12)&lt;br /&gt;                    + (decode(s.charAt(i + 2)) &lt;&lt; 6)&lt;br /&gt;                    + (decode(s.charAt(i + 3)));&lt;br /&gt; &lt;br /&gt;            bos.write((tri &gt;&gt; 16) &amp; 255);&lt;br /&gt;            if (s.charAt(i + 2) == '=')&lt;br /&gt;                break;&lt;br /&gt;            bos.write((tri &gt;&gt; 8) &amp; 255);&lt;br /&gt;            if (s.charAt(i + 3) == '=')&lt;br /&gt;                break;&lt;br /&gt;            bos.write(tri &amp; 255);&lt;br /&gt; &lt;br /&gt;            i += 4;&lt;br /&gt;        }&lt;br /&gt;        return bos.toByteArray();&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;    public static void main(String[] args) throws Exception {&lt;br /&gt;        byte[] back = decode(b64Str);&lt;br /&gt;        OutputStream out = new FileOutputStream("aa.cer");&lt;br /&gt;        out.write(back);&lt;br /&gt;        //perform your exception handling  &lt;br /&gt;        out.close();&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;p class="MsoNormal" style="margin-right: 0cm; margin-left: 0cm; font-size: 10pt; font-family: Arial; color: windowtext; margin-top: 0cm; margin-bottom: 0.0001pt; "&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-style-span" style="font-size: 16px;"&gt;&lt;span class="Apple-style-span"   &gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;4.   KeyInfo&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_xWUcYX5ldbA/TDSgCyjRkpI/AAAAAAAAEyU/0W_dx97Kq0o/s1600/image009.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 237px;" src="http://3.bp.blogspot.com/_xWUcYX5ldbA/TDSgCyjRkpI/AAAAAAAAEyU/0W_dx97Kq0o/s400/image009.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5491189815461384850" /&gt;&lt;/a&gt;&lt;br /&gt;In order to ensure a consistent processing model across all the token types supported by WSS: SOAP Message&lt;br /&gt;Security, the &lt;wsse:securitytokenreference&gt; element specify all references to X.509 token types in signature or encryption elements that comply with this profile.&lt;br /&gt;The &lt;wsse:securitytokenreference&gt; element contains a &lt;wsse:keyidentifier&gt; element that specifies the token data by means of a X.509 SubjectKeyIdentifier reference.&lt;br /&gt;Reference:-&lt;br /&gt;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0.pdf&lt;/wsse:keyidentifier&gt;&lt;/wsse:securitytokenreference&gt;&lt;/wsse:securitytokenreference&gt;&lt;/wsse:binarysecuritytoken&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-6266803518324109807?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/6266803518324109807/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=6266803518324109807' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/6266803518324109807'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/6266803518324109807'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2010/07/anatomy-of-signed-soap-message.html' title='Anatomy of a signed SOAP message'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_xWUcYX5ldbA/TDVl5EEYByI/AAAAAAAAEyc/3P7u6LU8yxQ/s72-c/example.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-6918303018121320986</id><published>2010-07-07T09:16:00.001+04:00</published><updated>2010-07-07T10:12:47.240+04:00</updated><title type='text'>Normalization and Canonicalization of XML</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Normalized xml&lt;/span&gt; is the XML stripped of white spaces.&lt;br /&gt;Multiple methods can be applied by using the following schema types:-&lt;br /&gt;&lt;ul&gt;&lt;li&gt;xsd:normalizedString (http://www.w3.org/TR/xmlschema11-2/#normalizedString)&lt;/li&gt;&lt;li&gt;xsd:token(http://www.w3.org/TR/xmlschema11-2/#token)&lt;/li&gt;&lt;/ul&gt;These types do not restrict the use of white spaces rather are instructions to the processor to ignore the spaces (according to their respective rules).&lt;br /&gt;e.g xsd:token is supposed to merge multiple white spaces into one, so for an element defined in xsd as&lt;br /&gt;&lt;pre&gt;&amp;lt;xs:element name="tkn" type="xs:token"/&amp;gt;&lt;/pre&gt;&lt;br /&gt;the value can be provided as:-&lt;br /&gt;&lt;pre&gt;&amp;lt;tkn&amp;gt;toks        en     &amp;lt;/tkn&amp;gt;&lt;/pre&gt;&lt;br /&gt;This will not result in an schema validation error but the parser should treat it like a string with the following value:-&lt;br /&gt;&lt;pre&gt;&amp;lt;tkn&amp;gt;toks en&amp;lt;/tkn&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Canonical form of an XML&lt;/span&gt;&lt;br /&gt;The canonical form of an XML document is physical representation of the document produced by the following method:-&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The document is encoded in UTF-8&lt;/li&gt;&lt;li&gt;Line breaks normalized to #xA on input, before parsing&lt;/li&gt;&lt;li&gt;Attribute values are normalized, as if by a validating processor&lt;/li&gt;&lt;li&gt;Character and parsed entity references are replaced&lt;/li&gt;&lt;li&gt;CDATA sections are replaced with their character content&lt;/li&gt;&lt;li&gt;The XML declaration and document type declaration (DTD) are removed&lt;/li&gt;&lt;li&gt;Empty elements are converted to start-end tag pairs&lt;/li&gt;&lt;li&gt;Whitespace outside of the document element and within start and end tags is normalized&lt;/li&gt;&lt;li&gt;All whitespace in character content is retained (excluding characters removed during line feed normalization)&lt;/li&gt;&lt;li&gt;Attribute value delimiters are set to quotation marks (double quotes)&lt;/li&gt;&lt;li&gt;Special characters in attribute values and character content are replaced by character references&lt;/li&gt;&lt;li&gt;Superfluous namespace declarations are removed from each element&lt;/li&gt;&lt;li&gt;Default attributes are added to each element&lt;/li&gt;&lt;li&gt;Lexicographic order is imposed on the namespace declarations and attributes of each element&lt;/li&gt;&lt;/ul&gt;The rules for Canonical form of xsd are very detailed and do not cover the normalization of elements. Both of these forms supplement each other.&lt;br /&gt;&lt;br /&gt;Canonical form is very useful while generating hash for the xml and are used in generating the WS-Security BinarySecurityToken.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-6918303018121320986?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/6918303018121320986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=6918303018121320986' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/6918303018121320986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/6918303018121320986'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2010/07/normalization-and-canonicalization-of.html' title='Normalization and Canonicalization of XML'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-7843116001384049</id><published>2010-05-16T11:21:00.000+04:00</published><updated>2010-05-16T11:40:55.203+04:00</updated><title type='text'>Executable jar file from command line</title><content type='html'>Executing an executable jar (the jar contains the name of the main file in manifest) from command line.&lt;br /&gt;&lt;br /&gt;Simple?&lt;br /&gt;&lt;br /&gt;Say the jar name is exec.jar and is located in c:\java.&lt;br /&gt;Go to :-&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;c:\&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;cd c:\java&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;java -jar exec.jar&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This executes fine.&lt;br /&gt;But why do I need to go into the directory where the jar exists. Say I am in the drive c: I can always do:-&lt;br /&gt;java -classpath c:\java\exec.jar -jar exec.jar&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;Unable to access jarfile exec.jar&lt;/span&gt;&lt;br /&gt;No it does not work.&lt;br /&gt;&lt;br /&gt;Lets try &lt;span style="color: rgb(0, 0, 153);"&gt;set classpath=.;c:\java\exec.jar;&lt;/span&gt;&lt;br /&gt;and then execute&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;java -jar exec.jar&lt;/span&gt;&lt;br /&gt;Still the same error&lt;br /&gt;&lt;br /&gt;Now lets try&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;java -jar c:\java\exec.jar&lt;/span&gt;&lt;br /&gt;Works fine...&lt;br /&gt;&lt;br /&gt;But why is the classpath not working.&lt;br /&gt;The reason is provided in the java tool documentation from the Sun site.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;"&lt;/span&gt;&lt;b&gt;-jar&lt;/b&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;span style="font-style: italic;"&gt;Execute a program encapsulated in a JAR file. &lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;.....&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;......&lt;/span&gt;&lt;br /&gt;When you use this option, the          JAR file is the source of all user classes, and other user class           path settings are ignored.      "&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The classpath option does not work with java -jar option.&lt;br /&gt;&lt;br /&gt;ref: &lt;a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/java.html#-jar"&gt;java tool documentation&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Thus the options if you want to execute a jar file are:-&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Go to the directory of jar and execute the java -jar exec.jar&lt;/li&gt;&lt;li&gt;From any other directory execute java -jar c:\java\exec.jar&lt;/li&gt;&lt;li&gt;If you want to read it from the classpath, use the workaround by retrieving the name of the main class from mainifest and executing it:-&lt;/li&gt;&lt;li&gt;java -classpath c:\java\exec.jar Main&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-7843116001384049?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/7843116001384049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=7843116001384049' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/7843116001384049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/7843116001384049'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2010/05/executable-jar-file-from-command-line.html' title='Executable jar file from command line'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-1280066813268466522</id><published>2010-04-20T08:15:00.000+04:00</published><updated>2010-04-20T09:32:07.525+04:00</updated><title type='text'>Generating documentation with APT and Maven</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Purpose:-&lt;/span&gt;&lt;br /&gt;Display the usage of APT to generate traceability matrix for requirement and test case.&lt;br /&gt;&lt;br /&gt;This is not a fully implemented feature rather it displays the concepts and the setup.&lt;br /&gt;This assumes basic understanding of APT and maven.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Steps:-&lt;/span&gt;&lt;br /&gt;1. Setup project 'TestAnnotation' for annotation processor - change pom, write annotation and process classes&lt;br /&gt;2. Update project 'Test' for annotation processing&lt;br /&gt;3. execute apt&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Step 1:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1.1 &lt;/span&gt;Create a new maven project 'TestAnnotation' and update the pom dependency to include tools.jar.&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;&lt;br /&gt;    &amp;lt;dependency&gt;&lt;br /&gt;        &amp;lt;groupid&gt;com.sun&amp;lt;/groupid&gt;&lt;br /&gt;        &amp;lt;artifactid&gt;tools&amp;lt;/artifactid&gt;&lt;br /&gt;        &amp;lt;version&gt;1.4.2&amp;lt;/version&gt;&lt;br /&gt;        &amp;lt;scope&gt;system&amp;lt;/scope&gt;&lt;br /&gt;        &amp;lt;systempath&gt;${java.home}/../lib/tools.jar&amp;lt;/systempath&gt;&lt;br /&gt;    &amp;lt;/dependency&gt;    &lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1.2 &lt;/span&gt;Write the annotation class. This class needs to be shared with the Test project. This can be done by copying the source unto the project or having a common dependency between the projects.&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;package com.sash;&lt;br /&gt;&lt;br /&gt;import java.lang.annotation.Documented;&lt;br /&gt;import java.lang.annotation.ElementType;&lt;br /&gt;import java.lang.annotation.Retention;&lt;br /&gt;import java.lang.annotation.RetentionPolicy;&lt;br /&gt;import java.lang.annotation.Target;&lt;br /&gt;&lt;br /&gt;@Documented&lt;br /&gt;@Retention(RetentionPolicy.SOURCE)&lt;br /&gt;@Target({ElementType.TYPE,&lt;br /&gt;ElementType.METHOD,&lt;br /&gt;ElementType.CONSTRUCTOR,&lt;br /&gt;ElementType.PACKAGE,&lt;br /&gt;ElementType.FIELD})&lt;br /&gt;public @interface TestCaseDetails {&lt;br /&gt;String code();&lt;br /&gt;String description();&lt;br /&gt;String useCase();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;span style="font-weight: bold;"&gt;1.3&lt;/span&gt; Create Annotation Processing Factory&lt;br /&gt;&lt;br /&gt;The factory is responsible for creating processors for one or more annotation types. The factory is said to support these types.&lt;br /&gt;&lt;div class="codewrap"&gt;&lt;pre&gt;package com.sash;&lt;br /&gt;&lt;br /&gt;import java.util.Collection;&lt;br /&gt;import java.util.Collections;&lt;br /&gt;import java.util.Set;&lt;br /&gt;&lt;br /&gt;import com.sun.mirror.apt.AnnotationProcessor;&lt;br /&gt;import com.sun.mirror.apt.AnnotationProcessorEnvironment;&lt;br /&gt;import com.sun.mirror.apt.AnnotationProcessorFactory;&lt;br /&gt;import com.sun.mirror.apt.AnnotationProcessors;&lt;br /&gt;import com.sun.mirror.declaration.AnnotationTypeDeclaration;&lt;br /&gt;&lt;br /&gt;public class TestCaseDetailsProcessorFactory implements&lt;br /&gt;      AnnotationProcessorFactory {&lt;br /&gt;&lt;br /&gt;  public AnnotationProcessor getProcessorFor(&lt;br /&gt;          Set &lt;&gt; declarations,&lt;br /&gt;          AnnotationProcessorEnvironment env) {&lt;br /&gt;      AnnotationProcessor result;&lt;br /&gt;      if (declarations.isEmpty()) {&lt;br /&gt;          result = AnnotationProcessors.NO_OP;&lt;br /&gt;      } else {&lt;br /&gt;          result = new TestCaseDetailsProcessor(env);&lt;br /&gt;      }&lt;br /&gt;      return result;&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public Collection &lt;&gt; supportedAnnotationTypes() {&lt;br /&gt;      return Collections.singletonList(TestCaseDetails.class.getName());&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public Collection &lt;&gt; supportedOptions() {&lt;br /&gt;      return Collections.emptyList();&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1.4&lt;/span&gt; Create the annotation processor&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap"&gt;&lt;pre&gt;package com.sash;&lt;br /&gt;&lt;br /&gt;import java.util.Collection;&lt;br /&gt;import java.util.Map;&lt;br /&gt;&lt;br /&gt;import com.sun.mirror.apt.AnnotationProcessor;&lt;br /&gt;import com.sun.mirror.apt.AnnotationProcessorEnvironment;&lt;br /&gt;import com.sun.mirror.declaration.AnnotationMirror;&lt;br /&gt;import com.sun.mirror.declaration.AnnotationTypeDeclaration;&lt;br /&gt;import com.sun.mirror.declaration.AnnotationTypeElementDeclaration;&lt;br /&gt;import com.sun.mirror.declaration.AnnotationValue;&lt;br /&gt;import com.sun.mirror.declaration.Declaration;&lt;br /&gt;import com.sun.mirror.util.SourcePosition;&lt;br /&gt;&lt;br /&gt;public class TestCaseDetailsProcessor implements AnnotationProcessor {&lt;br /&gt;&lt;br /&gt;  private AnnotationProcessorEnvironment environment;&lt;br /&gt;&lt;br /&gt;  private AnnotationTypeDeclaration annotationTypeDeclaration;&lt;br /&gt;&lt;br /&gt;  public TestCaseDetailsProcessor(AnnotationProcessorEnvironment env) {&lt;br /&gt;      System.out.println("TestCaseDetailsProcessor.TestCaseDetailsProcessor()");&lt;br /&gt;      environment = env;&lt;br /&gt;      annotationTypeDeclaration = (AnnotationTypeDeclaration) environment&lt;br /&gt;              .getTypeDeclaration(TestCaseDetails.class.getName());&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void process() {&lt;br /&gt;      System.out.println("TestCaseDetailsProcessor.process()");&lt;br /&gt;      Collection&lt;declaration&gt; declarations = environment&lt;br /&gt;              .getDeclarationsAnnotatedWith(annotationTypeDeclaration);&lt;br /&gt;      for (Declaration declaration : declarations) {&lt;br /&gt;          processNoteAnnotations(declaration);&lt;br /&gt;      }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  private void processNoteAnnotations(Declaration declaration) {&lt;br /&gt;      System.out.println("TestCaseDetailsProcessor.processNoteAnnotations()");&lt;br /&gt;      Collection&lt;annotationmirror&gt; annotations = declaration&lt;br /&gt;              .getAnnotationMirrors();&lt;br /&gt;      for (AnnotationMirror mirror : annotations) {&lt;br /&gt;          if(mirror.getAnnotationType().getDeclaration().equals(&lt;br /&gt;                  annotationTypeDeclaration)) {&lt;br /&gt;&lt;br /&gt;              SourcePosition position = mirror.getPosition();&lt;br /&gt;              Map&lt;annotationtypeelementdeclaration, annotationvalue=""&gt; values = mirror&lt;br /&gt;                      .getElementValues();&lt;br /&gt;&lt;br /&gt;              System.out.println("Declaration: " + declaration.toString());&lt;br /&gt;              System.out.println("Position: " + position);&lt;br /&gt;              System.out.println("Values:");&lt;br /&gt;              for (Map.Entry&lt;annotationtypeelementdeclaration, annotationvalue=""&gt; entry : values&lt;br /&gt;                      .entrySet()) {&lt;br /&gt;                  AnnotationTypeElementDeclaration elemDecl = entry.getKey();&lt;br /&gt;                  AnnotationValue value = entry.getValue();&lt;br /&gt;                  System.out.println("    " + elemDecl + "=" + value);&lt;br /&gt;              }&lt;br /&gt;          }&lt;br /&gt;      }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/annotationtypeelementdeclaration,&gt;&lt;/annotationtypeelementdeclaration,&gt;&lt;/annotationmirror&gt;&lt;/declaration&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2.&lt;/span&gt; Update the pom of project 'Test' for annotation processing to add apt maven plugin.&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;&lt;br /&gt;      &amp;lt;plugin&gt;&lt;br /&gt;        &amp;lt;groupId&gt;org.codehaus.mojo&amp;lt;/groupId&gt;&lt;br /&gt;        &amp;lt;artifactId&gt;apt-maven-plugin&amp;lt;/artifactId&gt;&lt;br /&gt;        &amp;lt;version&gt;1.0-alpha-3&amp;lt;/version&gt;&lt;br /&gt;      &amp;lt;/plugin&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Update the test case to use the annotations.&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;package com.test; import com.sash.TestCaseDetails;&lt;br /&gt;public class Testing1 {&lt;br /&gt;  @Test&lt;br /&gt;  @TestCaseDetails(code="1", description="2", useCase="3")&lt;br /&gt;  public void testing() {&lt;br /&gt;//actual code goes here&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;3.&lt;/span&gt; Execute the maven command 'mvn apt:test-process' to execute the command. The following output can be seen:-&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;&lt;br /&gt;Values:&lt;br /&gt;  code()="1"&lt;br /&gt;  description()="2"&lt;br /&gt;  useCase()="3"&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The example only shows a print into the console. This should be written into a file with the expected format.&lt;br /&gt;&lt;br /&gt;The apt command can also be executed without maven using the following command.&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;&lt;br /&gt;apt &lt;path&gt;\TestAnnotation-1.jar -factory com.sash.TestCaseDetailsProcessorFactory &lt;path&gt;\Testing1.java&lt;br /&gt;&lt;/path&gt;&lt;/path&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Note: The code provided has been written by using articles and documentation available. This is only an aggregation of information available online.&lt;br /&gt;&lt;br /&gt;Reference and further reading:&lt;br /&gt;&lt;a href="http://www.oracle.com/technology/pub/articles/marx-jse6.html"&gt;http://www.oracle.com/technology/pub/articles/marx-jse6.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.javalobby.org/java/forums/t17876.html"&gt;http://www.javalobby.org/java/forums/t17876.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mojo.codehaus.org/apt-maven-plugin/examples/configuring-a-factory.html"&gt;http://mojo.codehaus.org/apt-maven-plugin/examples/configuring-a-factory.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-1280066813268466522?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/1280066813268466522/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=1280066813268466522' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/1280066813268466522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/1280066813268466522'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2010/04/gnerating-documentation-with-apt-and.html' title='Generating documentation with APT and Maven'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-819205195103297214</id><published>2009-12-08T07:30:00.000+04:00</published><updated>2009-12-08T07:46:08.066+04:00</updated><title type='text'>GoF Design Patterns with examples using Java and UML</title><content type='html'>written by:&lt;br /&gt;Benneth Christiansson (Ed.)&lt;br /&gt;Mattias Forss,&lt;br /&gt;Ivar Hagen,&lt;br /&gt;Kent Hansson,&lt;br /&gt;Johan Jonasson,&lt;br /&gt;Mattias Jonasson,&lt;br /&gt;Fredrik Lott,&lt;br /&gt;Sara Olsson, and&lt;br /&gt;Thomas Rosevall&lt;br /&gt;&lt;br /&gt;&lt;a href="http://docs.google.com/fileview?id=0B4tulwrdNTfCN2RmNDhhNjgtNzA4ZS00ZmJlLWJjYmItZGUzZDM4MWQyOTg3&amp;hl=en"&gt;Gof Design patterns&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A very nice recap of the design patterns.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-819205195103297214?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/819205195103297214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=819205195103297214' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/819205195103297214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/819205195103297214'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2009/12/gof-design-patterns-with-examples-using.html' title='GoF Design Patterns with examples using Java and UML'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-2399103457347446178</id><published>2009-07-25T11:24:00.000+04:00</published><updated>2009-07-25T11:25:19.703+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='specifications'/><title type='text'>Notational Conventions</title><content type='html'>Notational Conventions explained for many specifications:-&lt;br /&gt;http://tools.ietf.org/html/rfc2119&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-2399103457347446178?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/2399103457347446178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=2399103457347446178' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/2399103457347446178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/2399103457347446178'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2009/07/notational-conventions.html' title='Notational Conventions'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-232998763731888176</id><published>2009-07-07T12:03:00.000+04:00</published><updated>2009-07-07T12:37:22.966+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Find Bugs</title><content type='html'>&lt;a href="http://findbugs.sourceforge.net/"&gt;Find Bugs&lt;/a&gt; is an eclipse plugin which shows the common errors in Java. I use the eclipse plugin, and as a Best Practice for java developers this should be used while development. :)&lt;br /&gt;&lt;br /&gt;e.g.&lt;br /&gt;For a piece of code the following error was received&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_xWUcYX5ldbA/SlMDAM7uYJI/AAAAAAAADoM/PkJdzS77fGc/s1600-h/2009-07-07_120822.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 118px;" src="http://4.bp.blogspot.com/_xWUcYX5ldbA/SlMDAM7uYJI/AAAAAAAADoM/PkJdzS77fGc/s400/2009-07-07_120822.png" alt="" id="BLOGGER_PHOTO_ID_5355627683880263826" border="0" /&gt;&lt;/a&gt;When piece  of code in given below:-&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;1. Long id = request.getId();&lt;br /&gt;2.       &lt;br /&gt;3. if(request == null || id == null) {&lt;br /&gt;4.     throw new RuntimeException("id cannot be null");&lt;br /&gt;5. }&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;Find the error if you can... :)&lt;br /&gt;&lt;br /&gt;The check for request == null is fruitless, since if request is null the line 1 will fail. Below is provided the corrected code and thus removes the bug.&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;1. if(request == null || request.getId() == null) {&lt;br /&gt;2.  throw new RuntimeException("id cannot be null");&lt;br /&gt;3. }&lt;br /&gt;&lt;br /&gt;Long id = request.getId();&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;A note of caution, the code inspection tools need to be used intelligently, it may sometimes flag code as bug that may have been done for some valid reason. Ignore them in this case.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-232998763731888176?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/232998763731888176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=232998763731888176' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/232998763731888176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/232998763731888176'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2009/07/find-bugs.html' title='Find Bugs'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_xWUcYX5ldbA/SlMDAM7uYJI/AAAAAAAADoM/PkJdzS77fGc/s72-c/2009-07-07_120822.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-5430219040304895864</id><published>2009-06-30T09:12:00.000+04:00</published><updated>2009-06-30T09:18:30.879+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><title type='text'>Minimize memory footprint</title><content type='html'>An application to minimize memory footprint.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://minimem.kerkia.net"&gt;Minimem&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The application can optimize the memory used. Some applications when run over a long time start hogging a lot of memory, this tools optimizes the memory usage and free it.&lt;br /&gt;&lt;br /&gt;Mozilla is a good example of such a process (at least I was facing the issue) but is irreplaceable. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-5430219040304895864?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/5430219040304895864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=5430219040304895864' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/5430219040304895864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/5430219040304895864'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2009/06/minimize-memory-footprint.html' title='Minimize memory footprint'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-6803265766518429631</id><published>2009-06-23T23:03:00.000+04:00</published><updated>2009-06-23T23:27:15.772+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SOA'/><title type='text'>Pitfalls of SOA adoption</title><content type='html'>&lt;div&gt;An old link about pitfalls of SOA adoption.&lt;/div&gt;&lt;a href="http://www.bpminstitute.org/articles/article/article/the-top-5-soa-adoption-pitfalls-of-2005.html"&gt;Pitfalls of SOA adoption - Thomas Erl&lt;/a&gt;&lt;div&gt;Most of the points are still valid, specially the performance impact.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-6803265766518429631?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/6803265766518429631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=6803265766518429631' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/6803265766518429631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/6803265766518429631'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2009/06/pitfalls-of-soa-adoption.html' title='Pitfalls of SOA adoption'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-4876799305430420258</id><published>2009-06-23T08:58:00.000+04:00</published><updated>2009-06-23T23:27:40.296+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SOA'/><category scheme='http://www.blogger.com/atom/ns#' term='BPEL'/><title type='text'>OWSM setup for signature verification</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51);   font-weight: bold; line-height: 16px; "&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Purpose&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51);   line-height: 16px; "&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Setup OWSM to perform signature validation&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51);   line-height: 16px;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51);   line-height: 16px;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Prerequisites&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal; "&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51);  line-height: 16px; "&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;JKS store should be setup and ready to use. Refer to &lt;/span&gt;&lt;span class="Apple-style-span" style=" ;"&gt;&lt;a href="http://tech-sash.blogspot.com/2009/06/keystore-setup-for-owsm.html"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;http://tech-sash.blogspot.com/2009/06/keystore-setup-for-owsm.html&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; for more details.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51);  line-height: 16px; "&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;OWSM gateway is already created. To create refer &lt;/span&gt;&lt;/span&gt;&lt;a href="http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b31007/gateways.htm"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b31007/gateways.htm&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span"  style="color: rgb(51, 51, 51);  line-height: 16px;font-family:verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51);   line-height: 16px;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;Steps&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51);   line-height: 16px;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold; "&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Step 1: &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Getting the wsdl URL for the service to be secured.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style=" white-space: pre-wrap; font-family:georgia;"&gt;Login to the BPEL console. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style=" white-space: pre-wrap; font-family:georgia;"&gt;Select the process to be secured and copy the wsdl url.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style=" white-space: pre-wrap; font-family:georgia;"&gt;Move to the WSDL tab.&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_xWUcYX5ldbA/SkDRZ6j5VnI/AAAAAAAADdU/d5FJkSM1owc/s1600-h/copy_wsdl_location.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 195px;" src="http://3.bp.blogspot.com/_xWUcYX5ldbA/SkDRZ6j5VnI/AAAAAAAADdU/d5FJkSM1owc/s400/copy_wsdl_location.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5350506600462898802" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="white-space: pre-wrap;"&gt;Remove the version from the wsdl location.  http://server:port/orabpel/domain/BPELProcess1/1.1/BPELProcess1?wsdl to http://server:port/orabpel/domain/BPELProcess1/BPELProcess1?wsdl and copy the new wsdl url. This will ensure the OWSM is always pointing to the latest version of process deployed.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="white-space: pre-wrap;"&gt;Remove the version from the endpoint location. http://server:port/orabpel/domain/BPELProcess1/1.1 to http://server:port/orabpel/domain/BPELProcess1 and copy the new endpoint location. This will ensure the OWSM is always pointing to the latest version of process deployed.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" white-space: pre-wrap; font-family:georgia;"&gt;To secure a java web service (or any other web service), get the correct web service wsdl URL.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="white-space: pre-wrap;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="white-space: pre-wrap;"&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); font-weight: bold; line-height: 16px; white-space: normal; "&gt;Step 2: &lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); line-height: 16px; white-space: normal; "&gt;Register the web service in&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="white-space: pre-wrap;"&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); line-height: 16px; white-space: normal; "&gt; OWSM.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Login to OWSM.&lt;/li&gt;&lt;li&gt;Go to PolicyManager --&gt; Register Services. Click on Services. &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_xWUcYX5ldbA/SkDRxkYFHVI/AAAAAAAADdc/XqYfj22L_IE/s1600-h/register_service.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 126px;" src="http://2.bp.blogspot.com/_xWUcYX5ldbA/SkDRxkYFHVI/AAAAAAAADdc/XqYfj22L_IE/s400/register_service.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5350507006824619346" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li style="text-align: left;"&gt;Click add new service. &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_xWUcYX5ldbA/SkDSKgARtlI/AAAAAAAADdk/tGB2mn3Rwo0/s1600-h/add_new_service_click.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 124px;" src="http://2.bp.blogspot.com/_xWUcYX5ldbA/SkDSKgARtlI/AAAAAAAADdk/tGB2mn3Rwo0/s400/add_new_service_click.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5350507435147769426" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Insert the required details. Please note enter the correct wsdl URL from step 1.4 without the version and then click next.&lt;/li&gt;&lt;/ol&gt;&lt;div style="text-align: center;"&gt;&lt;img src="http://3.bp.blogspot.com/_xWUcYX5ldbA/SkCHJjzOUAI/AAAAAAAADc0/duEUOXcVkq4/s400/gateway_details_next.png" style="cursor:pointer; cursor:hand;width: 400px; height: 279px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5350424955614810114" /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;    5.  Click Finish and then commit. &lt;/div&gt;&lt;div style="text-align: left;"&gt;    6.  Go back to RegisterSerices --&gt; List Of Services, find the service created and click on edit.&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="color: rgb(85, 26, 139); text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_xWUcYX5ldbA/SkDTIARxdDI/AAAAAAAADds/1uyXENCVa9U/s1600-h/edit_service.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 346px;" src="http://4.bp.blogspot.com/_xWUcYX5ldbA/SkDTIARxdDI/AAAAAAAADds/1uyXENCVa9U/s400/edit_service.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5350508491783107634" /&gt;&lt;/a&gt;&lt;div style="text-align: left;"&gt;Note the Service URL and the Service Endpoint URL. These will be provided to the client and also used for testing.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;  7.  Click on Modify Policy&lt;/div&gt;&lt;div style="text-align: left;"&gt;  8. In the Request pipeline, click on '&lt;span class="Apple-style-span" style="font-style: italic;"&gt;Add Step Below&lt;/span&gt;' in the Log step and click OK.&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_xWUcYX5ldbA/SkDHlPVLauI/AAAAAAAADdE/5NP_MgXoNUI/s1600-h/add_verify_signature.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 363px;" src="http://2.bp.blogspot.com/_xWUcYX5ldbA/SkDHlPVLauI/AAAAAAAADdE/5NP_MgXoNUI/s400/add_verify_signature.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5350495799900596962" /&gt;&lt;/a&gt; 9.  Click on configure in the VerifySignature step. Fill in the appropriate values. Use &lt;span class="Apple-style-span"  style="color: rgb(51, 51, 255);   line-height: 16px; font-family:Tahoma;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;serverpass &lt;/span&gt;&lt;/span&gt;for the value while creating the keystore and the alias as the value while importing the client certificate.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_xWUcYX5ldbA/SkDQeluFgtI/AAAAAAAADdM/bvILuDsgksY/s1600-h/edit_service.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 346px;" src="http://2.bp.blogspot.com/_xWUcYX5ldbA/SkDQeluFgtI/AAAAAAAADdM/bvILuDsgksY/s400/edit_service.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5350505581256213202" /&gt;&lt;/a&gt;  10.  Click OK and the commit the changes. The update to the signature are done.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-4876799305430420258?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/4876799305430420258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=4876799305430420258' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4876799305430420258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4876799305430420258'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2009/06/owsm-setup-for-signing.html' title='OWSM setup for signature verification'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_xWUcYX5ldbA/SkDRZ6j5VnI/AAAAAAAADdU/d5FJkSM1owc/s72-c/copy_wsdl_location.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-2223708274095825218</id><published>2009-06-23T08:31:00.000+04:00</published><updated>2009-06-30T15:52:38.841+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='SOA'/><category scheme='http://www.blogger.com/atom/ns#' term='BPEL'/><title type='text'>Keystore Setup for OWSM</title><content type='html'>&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Purpose&lt;/span&gt;&lt;div&gt;Set up the keystore to be used by Oracle Web Services Manager (OWSM) to perform digitial signature validation.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Prerequisites&lt;/span&gt;&lt;/div&gt;&lt;div&gt;The client's public key (.cer file) should be provided.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Steps&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;font-family:Tahoma;" &gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:Georgia;"&gt;Step&lt;/span&gt; 1&lt;/span&gt;: &lt;span class="Apple-style-span" style="font-weight: normal;font-family:Georgia;" &gt;Creating server store. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Use the java keytool command to create a keystore.&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 255); font-weight: bold;font-family:Tahoma;font-size:13;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=";font-family:Tahoma;font-size:10;color:blue;"   &gt;&lt;span style="color: rgb(102, 102, 102);"&gt;keytool -v -genkey -keyalg RSA -keysize 1024 -keystore&lt;/span&gt; &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=";font-family:Tahoma;font-size:10;color:red;"   &gt;&lt;span style="color: rgb(0, 0, 102);"&gt;[keystore-name.jks]&lt;/span&gt; &lt;/span&gt;&lt;/b&gt;&lt;b style="color: rgb(102, 102, 102);"&gt;&lt;span style=";font-family:Tahoma;font-size:10;"  &gt;-storepass &lt;/span&gt;&lt;/b&gt;&lt;b style="color: rgb(0, 0, 102);"&gt;&lt;span style=";font-family:Tahoma;font-size:10;"  &gt;[serverpass]&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=";font-family:Tahoma;font-size:10;color:blue;"   &gt;&lt;span style="color: rgb(102, 102, 102);"&gt;-alias server1&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102);"&gt;-keypass&lt;/span&gt; &lt;/span&gt;&lt;/b&gt;&lt;b style="color: rgb(0, 0, 102);"&gt;&lt;span style=";font-family:Tahoma;font-size:10;"  &gt;[server]&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;font-family:Tahoma;" &gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Example server output:-&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;keytool -v -genkey -keyalg RSA -keysize 1024 -keystore server-store-1jks -storepass serverpass -alias server1 -keypass server&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;What is your first and last name?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;  [Unknown]:  SashCo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;What is the name of your organizational unit?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;  [Unknown]:  DPP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;What is the name of your organization?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;  [Unknown]:  SashWorld&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;What is the name of your City or Locality?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;  [Unknown]:  Dubai&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;What is the name of your State or Province?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;  [Unknown]:  Dubai&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;What is the two-letter country code for this unit?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;  [Unknown]:  AE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;Is CN= SashCo, OU=DPP, O= SashWorld, L=Dubai, ST=Dubai, C=AE correct?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;  [no]:  Y&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;Generating 1,024 bit RSA key pair and self-signed certificate (MD5WithRSA)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;        for: CN= SashCo, OU=DPP, O= SashWorld, L=Dubai, ST=Dubai, C=AE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;[Storing server-store-1jks]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;font-family:Georgia;" &gt;Step 2&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Add the provided public key to the java keystore.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 255);font-size:13;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b style="color: rgb(102, 102, 102);"&gt;&lt;span style=";font-family:Tahoma;font-size:10;"  &gt;keytool -import -noprompt -trustcacerts -keystore &lt;/span&gt;&lt;/b&gt;&lt;b style="color: rgb(0, 0, 102);"&gt;&lt;span style=";font-family:Tahoma;font-size:10;"  &gt;[keystore-file.jks] &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=";font-family:Tahoma;font-size:10;color:blue;"   &gt;&lt;span style="color: rgb(102, 102, 102);"&gt;-storepass&lt;/span&gt; &lt;/span&gt;&lt;/b&gt;&lt;b style="color: rgb(0, 0, 102);"&gt;&lt;span style=";font-family:Tahoma;font-size:10;"  &gt;[serverpass]&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=";font-family:Tahoma;font-size:10;color:blue;"   &gt; &lt;span style="color: rgb(102, 102, 102);"&gt;-alias&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b style="color: rgb(0, 0, 102);"&gt;&lt;span style=";font-family:Tahoma;font-size:10;"  &gt;[alias]&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=";font-family:Tahoma;font-size:10;color:blue;"   &gt; &lt;span style="color: rgb(102, 102, 102);"&gt;-file&lt;/span&gt; &lt;/span&gt;&lt;/b&gt;&lt;b style="color: rgb(0, 0, 102);"&gt;&lt;span style=";font-family:Tahoma;font-size:10;"  &gt;[certificate-file.cer]&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 255); font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0);"&gt;Example server output:-&lt;span class="Apple-style-span"  style="font-size:13;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;keytool -import -noprompt -trustcacerts -keystore server-store-1.jks -storepass serverpass -alias sashwat -file sashwat.cer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 153, 153);"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Certificate was added to keystore&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;font-family:Georgia;" &gt;Step 3:&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Use the following command to list the certificates in the .jks file&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;keytool -list -keystore &lt;keystore-file.jks&gt; -storepass&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;b&gt;&lt;span style=";font-family:Tahoma;font-size:10;color:blue;"   &gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/keystore-file.jks&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 255);font-size:13;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;keystore-file.jks&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;b style="color: rgb(102, 102, 102);"&gt;&lt;span style=";font-family:Tahoma;font-size:10;"  &gt;keytool -list -keystore &lt;/span&gt;&lt;/b&gt;&lt;b style="color: rgb(0, 0, 102);"&gt;&lt;span style=";font-family:Tahoma;font-size:10;"  &gt;[keystore-file.jks] &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=";font-family:Tahoma;font-size:10;color:blue;"   &gt;&lt;span style="color: rgb(102, 102, 102);"&gt;-storepass&lt;/span&gt; &lt;/span&gt;&lt;/b&gt;&lt;b style="color: rgb(0, 0, 102);"&gt;&lt;span style=";font-family:Tahoma;font-size:10;"  &gt;[serverpass]&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/keystore-file.jks&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 0, 0);font-size:13;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Acronym / Abbreviation&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;OWSM - Oracle Web Services Manager&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;keystore-name.jks - Name of the new java keystore&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;serverpass - password of the keystore&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;keypass - password of the private key&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;clientalias - alias for the client&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;certificate-file.cer - the certificate file provided by client&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Helpful Links:-&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Java keytool reference :-&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/keytool.html"&gt;http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/keytool.html&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-2223708274095825218?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/2223708274095825218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=2223708274095825218' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/2223708274095825218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/2223708274095825218'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2009/06/keystore-setup-for-owsm.html' title='Keystore Setup for OWSM'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-579596275073428878</id><published>2009-06-16T13:33:00.000+04:00</published><updated>2009-06-30T15:47:12.394+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><title type='text'>A very nice regular expression tool</title><content type='html'>This a very useful regular expression verification tool.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.weitz.de/regex-coach/"&gt;Regex Coach&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I haven't tried many but never needed to look further.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-579596275073428878?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/579596275073428878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=579596275073428878' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/579596275073428878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/579596275073428878'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2009/06/very-nice-regular-expression-tool.html' title='A very nice regular expression tool'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-4823324034947283858</id><published>2009-04-30T12:36:00.000+04:00</published><updated>2009-06-23T23:29:14.431+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='BPEL'/><title type='text'>Changing the title of instance in BPEL Console and searching in 10.1.3.4</title><content type='html'>Using the title,Index,Custom Key search in the BPEL console for 10.1.3.4 effectively.&lt;br /&gt;&lt;br /&gt;After installation of the SOA suite I saw new search facility available in BPEL console, but could not find any documentation regarding this. This is not even provided in the new features.&lt;br /&gt;&lt;br /&gt;I could see some new searches in the BPEL console, and thought that it could be useful for tracking.&lt;br /&gt;Login to BPELConsole&lt;br /&gt;Go to instances tab&lt;br /&gt;Search by Title, Index/Custom Key are the new searches that have been added. To use this feature just add a java code snippet in the bpel. &lt;div&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;  &amp;lt;bpelx:exec name="setIndexAndCommit" language="java" version="1.5"&amp;gt;  &lt;br /&gt;    &amp;lt;![CDATA[String ele =&lt;br /&gt; ((org.w3c.dom.Text)getVariableData(&lt;br /&gt;        "inputVariable","payload",&lt;br /&gt;        "/client:TestingCustomKeyProcessRequest/client:input/text()"))&lt;br /&gt;        .getNodeValue();      &lt;br /&gt;&lt;br /&gt;  setTitle(ele);]]&amp;gt;&lt;br /&gt;  &amp;lt;/bpelx:exec&amp;gt;&lt;br /&gt; &lt;/pre&gt;&lt;/div&gt;This sets the title that appears in the BPEL console. This can be used to set to search using the added feature of the BPEL console and make use of the BPEL console better.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Setting the title could have been done in previous release also, but the search option integrated with the BPEL console makes it very good for the support. &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;The problem I faced was while using the setCustomKey(String) in the java snippet. The error recieved was that the method was not found. Still to find the solution. Will post in the Oracle forums.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-4823324034947283858?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/4823324034947283858/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=4823324034947283858' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4823324034947283858'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4823324034947283858'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2009/04/using-titleindexcustom-key-search-in.html' title='Changing the title of instance in BPEL Console and searching in 10.1.3.4'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-3356762991983453266</id><published>2009-04-18T15:17:00.000+04:00</published><updated>2009-06-23T23:31:15.982+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle SOA suite'/><category scheme='http://www.blogger.com/atom/ns#' term='BPEL'/><title type='text'>SOA suite upgrade 10.1.3.4 - Duplicate instances</title><content type='html'>One of the new issues brought by the new version of SOA suite is the duplicate instances. If any asynchronous process is invoked from another process, in the tree finder sometimes even though a single call is made to the bpel process, the process can be seen multiple times.&lt;br /&gt;&lt;br /&gt;This is a bug added :(&lt;br /&gt;&lt;br /&gt;The cause of the bug is auto-recovery and impact can be minimised if auto recovery is turned off. This feature was introduced in SOA suite 10.1.3.4 and added a new bug, please do not enable this feature in production.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-3356762991983453266?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/3356762991983453266/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=3356762991983453266' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/3356762991983453266'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/3356762991983453266'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2009/04/soa-suite-upgrade-10134-duplicate.html' title='SOA suite upgrade 10.1.3.4 - Duplicate instances'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-4181792800094014739</id><published>2009-03-21T23:12:00.000+04:00</published><updated>2009-06-23T23:30:58.602+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle SOA suite'/><title type='text'>Bugs in Oracle SOA Suite 10.1.3.4</title><content type='html'>While testing our application on 10.1.3.4 MLR5, two pieces of functionality broke. Both of them undocumented and still awaiting confirmation as bugs from Oracle.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1. We have a BPEL process that insets a message into a queue using AQ adapter. This fails, with an exception stating xsi not defined in the XML. I've encountered this error message while inserting message into the queue when the XML is invalid.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Strangely enough this xml was generated from a java client proxy, and the xsi definition (mapping xsi to its corresponding namespace) exists along with the soap header. xsi is usually used to denote nulls in xml. If the definition of xsi is moved into the body the error dissapears.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Strange. Very Strange.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2. Another BPEL process contains a task being created and then the same task updating the outcome of the task. No authentication information was passed since the credentials returned while creating the task were used to complete the task. It generates some sort of a token that does this, but this piece of functionality broker in the newer version. Authentication information is required to be passed, so needed to give the bpeladmin username/password. Not very nice.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Hoping no more undocumented isses arise. Will update this post based on the response provided by Oracle support regarding the issues.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-4181792800094014739?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/4181792800094014739/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=4181792800094014739' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4181792800094014739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4181792800094014739'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2009/03/bugs-in-oracle-soa-suite-10134.html' title='Bugs in Oracle SOA Suite 10.1.3.4'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-7323077893774204875</id><published>2009-03-04T18:38:00.000+04:00</published><updated>2009-06-23T23:30:41.674+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle SOA suite'/><title type='text'>SOA suite upgrade 10.1.3.4</title><content type='html'>I just upgraded my developer system (windows XP) to SOA suite upgrade 10.1.3.4 MLR#5 running on OLite. Below are the special points from the release notes. I still need to test the stability and features of the new version.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Section 5.1.1, "Password Displays in Clear Text During Deinstallation"&lt;br /&gt;Section 5.1.2, "Passwords Appear in Clear Text in /tmp Directory After Running IRCA.SH"&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&gt;&gt;LOL&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;5.1.3 BPEL Process Instances Do Not Display in Oracle BPEL Control when Using Oracle Database Lite&lt;br /&gt;&lt;br /&gt;“If you install Oracle BPEL Process Manager with the Basic Install option, Oracle Database Lite (Olite) is installed. If you then apply the 10.1.3.4 patch to this installation, BPEL process instances under the Instances tab in Oracle BPEL Control do not display.&lt;br /&gt;As a workaround, use the Advanced Install option, which enables you to install a database other than Olite.”&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&gt;&gt;WTF? Was it never tested? Or they have stopped making the tool developer friendly.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;5.5.11 Removing or Changing the Passwords of Default User Accounts&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&gt;&gt;Finally clearly stated&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;5.7.3 Fault Policy Changes Do Not Require a Restart of Oracle BPEL Server&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&gt;&gt; Nice&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;5.9.5 BPEL Test Suite OnMessage Event Does Not Support Synchronous Operations&lt;br /&gt;When reading section "Asynchronous Event Emulation" of Chapter 20, "Testing BPEL Processes" of the Oracle BPEL Process Manager Developer's Guide, note that the onMessage event does not support synchronous (that is, two way) operations.&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&gt;&gt; never knew this !!!&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-7323077893774204875?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/7323077893774204875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=7323077893774204875' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/7323077893774204875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/7323077893774204875'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2009/03/soa-suite-upgrade-10134.html' title='SOA suite upgrade 10.1.3.4'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-4567601146975849943</id><published>2009-01-27T16:18:00.000+04:00</published><updated>2009-06-23T23:30:05.757+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle SOA suite'/><title type='text'>Reset the user password for SOA suite (using jazn)</title><content type='html'>&lt;div&gt;To reset the password you need access to the server filesystem.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1. Open the file ORACLE_HOME\j2ee\home\config\system-jazn-data.xml&lt;/div&gt;&lt;div&gt;2. Look for the user you want to reset the password for.The below XML sample is for the user oc4jadmin&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;user&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;name&gt;oc4jadmin&lt;/name&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;display-name&gt;OC4J Administrator&lt;/display-name&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;guid&gt;AFAD02C0C4DD11DCBFFAA5E4969A5543&lt;/guid&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;description&gt;OC4J Administrator&lt;/description&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;credentials&gt;{903}P9NehIbhq3t1b9xnuciu0z/YiMr1fF0T&lt;/credentials&gt;&lt;/div&gt;&lt;div&gt;&lt;/user&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;3. Change the credentials&lt;/div&gt;&lt;div&gt;&lt;credentials&gt;!welcome1&lt;/credentials&gt;&lt;/div&gt;&lt;div&gt;The password now becomes welcome1.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;4. Restart the server&lt;/div&gt;&lt;div&gt;5.Login using the user oc4jadmin and password welcome1.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now you will notice that after the server has started the credentials again become hashed.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-4567601146975849943?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/4567601146975849943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=4567601146975849943' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4567601146975849943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4567601146975849943'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2009/01/reset-user-password-for-soa-suite-using.html' title='Reset the user password for SOA suite (using jazn)'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-8115043414880177177</id><published>2008-11-08T22:43:00.000+04:00</published><updated>2008-11-08T22:45:35.465+04:00</updated><title type='text'>Note to myself</title><content type='html'>I sometimes take too long to answer comments. I will try to answer any queries that I know within maximum of 2 days from now on. Will try to maintain an average of 1 day.&lt;br /&gt;&lt;br /&gt;Apologies to everyone whom I have given an delayed response.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-8115043414880177177?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/8115043414880177177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=8115043414880177177' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/8115043414880177177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/8115043414880177177'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2008/11/note-to-myself.html' title='Note to myself'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-1383938519255849349</id><published>2008-11-08T20:46:00.000+04:00</published><updated>2009-06-23T23:30:24.492+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle SOA suite'/><category scheme='http://www.blogger.com/atom/ns#' term='SOA'/><category scheme='http://www.blogger.com/atom/ns#' term='BPEL'/><title type='text'>Is your SOA suite is it secure?</title><content type='html'>I was trying to see if the servers we have is secure enough. What I wanted to know is that wether we were making some errors or the facts were not documented clearly enough. I did find the documentation regarding most problems in some document or the other, but is it clear for admins was the question.&lt;br /&gt;&lt;br /&gt;So to find the answer I started looking for SOA suite available online.&lt;br /&gt;&lt;br /&gt;Probably this notion would seem stupid why will anyone expose the SOA suite online, I thought that too. But I did an &lt;span style="font-weight: bold;"&gt;inurl:BPELConsole&lt;/span&gt; search and found atleast 10 websites that have their consoles being resulted in the search. Tried a few search engines including google.&lt;br /&gt;&lt;br /&gt;The commonly known users are oc4jadmin, but what about &lt;span style="font-style: italic;"&gt;bpeladmin&lt;/span&gt; and the &lt;span style="font-style: italic;"&gt;default&lt;/span&gt; users. Nearly 80% of the sites did not have the passwords changed for the users. Could log in some of them seemed to be production sites others were testing sites.&lt;br /&gt;&lt;br /&gt;Also a common error was the OWSM user &lt;span style="font-style: italic;"&gt;admin&lt;/span&gt; with the password as oracle. Sadly most of these users were available to use.&lt;br /&gt;&lt;br /&gt;I don't know how to contact the admins of these sites, anyone reading this blog please change the passwords. Go to the user management in the Application Server Console and remove all users that are not used or atleast change the passwords.&lt;br /&gt;&lt;br /&gt;All sites had their oc4jadmin passwords changed but it's simply not good enough. Why were these consoles exposed to the internet I have no idea, I don't think it should be done.&lt;br /&gt;&lt;br /&gt;Another probability is Denial Of Service attacks or brute force. I don't think (cannot confirm this though) the username for oc4jadmin can be changed. It makes brute force hack even simpler.&lt;br /&gt;&lt;br /&gt;Is security still an aferthought for organizations !!! This scares me.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_xWUcYX5ldbA/SRXMXKrlHUI/AAAAAAAAB3E/TZu5uX4syzw/s1600-h/Untitled.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 148px;" src="http://1.bp.blogspot.com/_xWUcYX5ldbA/SRXMXKrlHUI/AAAAAAAAB3E/TZu5uX4syzw/s320/Untitled.jpg" alt="" id="BLOGGER_PHOTO_ID_5266340037655862594" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;One of the sites I could log into. I have tried to remove all the information regarding who owns the site.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-1383938519255849349?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/1383938519255849349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=1383938519255849349' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/1383938519255849349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/1383938519255849349'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2008/11/is-your-soa-suite-is-it-secure.html' title='Is your SOA suite is it secure?'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_xWUcYX5ldbA/SRXMXKrlHUI/AAAAAAAAB3E/TZu5uX4syzw/s72-c/Untitled.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-4427630460687470682</id><published>2008-11-01T22:23:00.000+04:00</published><updated>2008-11-01T22:28:04.202+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SOA'/><category scheme='http://www.blogger.com/atom/ns#' term='BPEL'/><title type='text'>Learning and implementing the Oracle Fault Management Framework</title><content type='html'>Why?&lt;br /&gt;The process has some external dependencies, due to a network failure the partner system is down for a few days. The message sent to the partner can be sent later but recovery mechnism can be difficult and redundant in BPEL.&lt;br /&gt;&lt;br /&gt;How was it done before?&lt;br /&gt;Without the framework solutions that were possible were&lt;br /&gt;1. Assume that the partner system link or the system would rarely be down, in such cases the process would have to be handled manually. Data fix, using the test case feature etc. This is called wishful thinking.&lt;br /&gt;2. Retry then create a worklist task whenever there is error, requires programming effort and redundancy in process.&lt;br /&gt;3. Rollback using compensation handler may be an option based on design of your process.&lt;br /&gt;&lt;br /&gt;What is it in a nutshell?&lt;br /&gt;Instead of handling faults in BPEL by adding catches handle faults use the framework to handle it for you. Both can also be used together. Retry of failed activity, Replay of failed activity scope, Human intervention and many other ways of handling the faults can be provided.&lt;br /&gt;&lt;br /&gt;In detail it can be read fro references stated below.&lt;br /&gt;&lt;br /&gt;What is the advantage?&lt;br /&gt;1. Generic framework can be reused without coding effort.&lt;br /&gt;2. Will provide resume, retry, continue and modify functionalities.&lt;br /&gt;3. No BPEL change required&lt;br /&gt;&lt;br /&gt;Lessons learnt and opinions&lt;br /&gt;While implement the fault handling using this framework, found rather suprisingly that it was very easy to use. The only trouble I had was that in my patch of 10.1.3.3 the post installation steps had not been executed. Without these steps the framework does not catch the fault.&lt;br /&gt;&lt;br /&gt;It was rather suprising that the framework can override the fault handling defined in the process. It was a bit difficult to digest but I could not think of any way else it could be designed.&lt;br /&gt;&lt;br /&gt;The best resource I could find was http://www.it-eye.nl/weblog/2007/09/10/oracle-bpel-10133-fault-policy-management/&lt;br /&gt;A very good resource to begin.&lt;br /&gt;Also use Oracle documentation http://www.oracle.com/technology/products/ias/bpel/pdf/10133technotes.pdf is of great help.&lt;br /&gt;&lt;br /&gt;Using these resources when I started testing my processes I wanted all my faults remote faults to be retried and then sent for human intervention.&lt;br /&gt;&lt;br /&gt;But then I started facing issues when an synchronous process is invoked and the process waiting for human intervention the calling process is timed out. So I had to have a seperate policy for synchronous processes which only contain retries and another for asynchronous processes which contain retry and human intervention.&lt;br /&gt;&lt;br /&gt;This reminded me of some Oracle document which had said prefer Async process over sync (I think it said it because of performance reasons).&lt;br /&gt;&lt;br /&gt;Then I stumbled over an article http://orasoa.blogspot.com/2008/03/bpel-fault-policies-best-practise.html which validated my understandings.&lt;br /&gt;&lt;br /&gt;If this works(in production) I'm pretty sure it will (It's working on my PC but cannot celebrate until it goes to production) I will be very pleased.&lt;br /&gt;&lt;br /&gt;The framework has limited extensibility only java tasks can be used to extend the framework. It leaves very less scope for out of the box thinking.&lt;br /&gt;&lt;br /&gt;Also, the problem I faced was that the activities tab in the BPEL Console needs to be provided to support personnel, none of the other tabs should be accessible. Could not resolve this issue :(. From the information I could gather was that this can only be done by tweaking the code of BPEL Console. ref: http://chintanblog.blogspot.com/2007/12/i-saw-numerous-people-asking-about-bpel_290.html&lt;br /&gt;&lt;br /&gt;Special thanks:&lt;br /&gt;To the Oracle team to come up with this feature and the blogs of consultants I have mentioned and all the people who answer questions on the Oracle forum.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-4427630460687470682?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/4427630460687470682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=4427630460687470682' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4427630460687470682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4427630460687470682'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2008/11/learning-and-implementing-oracle-fault.html' title='Learning and implementing the Oracle Fault Management Framework'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-4211402103910972980</id><published>2008-08-04T12:12:00.000+04:00</published><updated>2008-08-05T08:57:39.455+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Sash IP Messenger</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Forces compelling to learn RCP:- &lt;/span&gt;&lt;br /&gt;For quite some time I have been involved in creating helper projects, small projects that help in coding, generate code etc. This seemed to be a very nice and effective way of producing a very nice UI for them.&lt;br /&gt;It’s eclipse; I like the IDE and is my IDE of choice for Java. Using RCP would mean I could integrate the tools written with eclipse.&lt;br /&gt;I have done some Swing coding, it’s not a very easy to write a nice UI. RCP provided a dream of producing feature rich applications written in java fast and clean.&lt;br /&gt;Since the release of eclipse 3 the documentation there have been major modifications in the way eclipse works (or so I have read) and made RCP integration easier. I started with reading a book Eclipse Rich Client Platform: Designing, Coding, and Packaging Java Applications - By Jeff McAffer, Jean-Michel Lemieux. Very nice book, made the journey simpler.&lt;br /&gt;When I had just started coding one of my leads had told me, the best way to learn was to implement a small project. Execute it like a real project, and you would learn what are the where a tool can be best utilized, what is the effort required for implementation and any issues with the tool. Quite a few books are written in similar fashion where they build one application from start to the end. So does the book Eclipse Rich Client Platform. This book creates a chat application using the XMPP protocol and smack library.&lt;br /&gt;I decided to create a UI for IP Messenger, since this is the messaging tool I usually use and it does not have any nice UI. This is a free messenger available and does not need a server.&lt;br /&gt;I have just downloaded Ganymede so I created a new Eclipse plug-in project in Ganymede. I realized later that the version I should have used is Eclipse Europa since Ganymede is still to be used widely. I was able to convert the project into an eclipse 3.3 compatible plugin, the only drawback was that I could not use an image with menu manager. I had to replace&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;MenuManager helpMenu = new MenuManager("&amp;amp;Help", &lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;    AbstractUIPlugin.imageDescriptorFromPlugin(Application.PLUGIN_ID, IImageKeys.HELP) ,"help");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I had to remove the image from the menu manager to use it with Eclipse Europa. Now it is compatible with both Eclipse Europa and Eclipse Ganymede.&lt;br /&gt;The prerequisites for learning RCP are basic knowledge of Java, SWT and Eclipse. I am still learning new things about RCP everyday but creating a feature rich UI using RCP was fun and fast. The working RCP application can be found at: &lt;a href="http://code.google.com/p/sashipmessenger/downloads/list"&gt;http://code.google.com/p/sashipmessenger/downloads/list&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Features:-&lt;/span&gt;&lt;br /&gt;Customized splash screen, the project uses a very simple splash screen. I have just replaced the splash.bmp file in the project. I decided not to use a progress bar, which can easily be added. More customizations are possible. While googling I also found a nice article that used the splash screen for login.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_xWUcYX5ldbA/SJa8TUgUYII/AAAAAAAAB04/Ru3zB4_AWQM/s1600-h/1_splash.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_xWUcYX5ldbA/SJa8TUgUYII/AAAAAAAAB04/Ru3zB4_AWQM/s400/1_splash.bmp" alt="" id="BLOGGER_PHOTO_ID_5230575057345208450" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Saving the workbench state. Include the code in the class that extends WorkbenchAdvisor.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;public void initialize(IWorkbenchConfigurer configurer) {&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;        super.initialize(configurer);&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;            configurer.setSaveAndRestore(true); &lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;}&lt;/span&gt;&lt;br /&gt;This ensures that the windows appear in the same location as when you closed the views.&lt;br /&gt;&lt;br /&gt;Use perspective to decide the initial layout of the application&lt;br /&gt;Minimize to system tray. RCP provides a good level of integration with the system tray.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_xWUcYX5ldbA/SJa8jOETrDI/AAAAAAAAB1A/wQ8ibBsI8-w/s1600-h/2_tray.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_xWUcYX5ldbA/SJa8jOETrDI/AAAAAAAAB1A/wQ8ibBsI8-w/s320/2_tray.bmp" alt="" id="BLOGGER_PHOTO_ID_5230575330495015986" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Also to provide a notification when a message has arrived and application is not visible or inactive, the icon changes to a message and a system beep is sound.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_xWUcYX5ldbA/SJa8q5EkItI/AAAAAAAAB1I/DGQXJniqpUA/s1600-h/3_tary_msg.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_xWUcYX5ldbA/SJa8q5EkItI/AAAAAAAAB1I/DGQXJniqpUA/s320/3_tary_msg.bmp" alt="" id="BLOGGER_PHOTO_ID_5230575462297903826" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;In the menu preferences have been added, the preferences configuration is as shown below. This integrates nicely with the eclipse editor if this is used as an eclipse plugin.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_xWUcYX5ldbA/SJa84W4qG2I/AAAAAAAAB1Q/QgXJfAJnPts/s1600-h/4_prefs.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_xWUcYX5ldbA/SJa84W4qG2I/AAAAAAAAB1Q/QgXJfAJnPts/s320/4_prefs.bmp" alt="" id="BLOGGER_PHOTO_ID_5230575693639326562" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The configurations shown are the display name for the user, group name and the log folder. The messenger shows the chat history with a user. The broadcast address is used to specify address not in the same subnet.&lt;br /&gt;The application has two different views and an editor. The contacts view shows all the users on IP Messenger. The console view at the bottom provides information about different events. The different events like message read event, user removed message added etc. can be seen. The editor is open whenever a message is sent or received from a user.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_xWUcYX5ldbA/SJa9PBTuJqI/AAAAAAAAB1Y/04Sdm5YvZxA/s1600-h/5_views.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_xWUcYX5ldbA/SJa9PBTuJqI/AAAAAAAAB1Y/04Sdm5YvZxA/s320/5_views.bmp" alt="" id="BLOGGER_PHOTO_ID_5230576082984248994" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The messenger saves the chat log. When the editor is opened again the log is greyed out.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_xWUcYX5ldbA/SJa96wkOpuI/AAAAAAAAB1g/6ztiaqdyAXo/s1600-h/6_greyed.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_xWUcYX5ldbA/SJa96wkOpuI/AAAAAAAAB1g/6ztiaqdyAXo/s320/6_greyed.bmp" alt="" id="BLOGGER_PHOTO_ID_5230576834404329186" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The views can be closed and moved around.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_xWUcYX5ldbA/SJa-3OT0F8I/AAAAAAAAB1o/DnXrpwn649w/s1600-h/7_moveable.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_xWUcYX5ldbA/SJa-3OT0F8I/AAAAAAAAB1o/DnXrpwn649w/s320/7_moveable.bmp" alt="" id="BLOGGER_PHOTO_ID_5230577873180694466" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The view can be opened from the menu.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_xWUcYX5ldbA/SJa_04ivydI/AAAAAAAAB1w/6fYTF0Fm2jY/s1600-h/8_showview.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_xWUcYX5ldbA/SJa_04ivydI/AAAAAAAAB1w/6fYTF0Fm2jY/s320/8_showview.bmp" alt="" id="BLOGGER_PHOTO_ID_5230578932489636306" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Users can be found from the find item on the top of contacts view.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_xWUcYX5ldbA/SJbALUZRHbI/AAAAAAAAB14/jfA-obdllKc/s1600-h/9_find.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_xWUcYX5ldbA/SJbALUZRHbI/AAAAAAAAB14/jfA-obdllKc/s320/9_find.bmp" alt="" id="BLOGGER_PHOTO_ID_5230579317923192242" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The RCP application can be integrated with the existing eclipse. Just drop the plugin jar into the plugin folder of eclipse dump.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-4211402103910972980?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/4211402103910972980/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=4211402103910972980' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4211402103910972980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4211402103910972980'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2008/08/forces-compelling-to-learn-rcp-for.html' title='Sash IP Messenger'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_xWUcYX5ldbA/SJa8TUgUYII/AAAAAAAAB04/Ru3zB4_AWQM/s72-c/1_splash.bmp' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-531752466805142607</id><published>2008-05-20T14:24:00.000+04:00</published><updated>2008-05-20T14:45:58.380+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SOA'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><title type='text'>WS-BPEL 2.0</title><content type='html'>Derived from : http://docs.oasis-open.org/wsbpel/2.0/Primer/wsbpel-v2.0-Primer.pdf&lt;br /&gt;&lt;br /&gt;Copyright © OASIS Open 2007. All Rights Reserved.&lt;br /&gt;&lt;br /&gt;This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to OASIS, except as needed for the purpose of developing OASIS specifications, in which case the procedures for copyrights defined in the OASIS Intellectual Property Rights document must be followed, or as required to translate it into languages other than English.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What’s new in WS-BPEL 2.0&lt;/span&gt;&lt;br /&gt;As a result of the OASIS Technical Committee’s issues process, the original BPEL4WS 1.1 specification has received several updates. The following list summarizes the major changes that have been incorporated in the WS-BPEL 2.0 specification.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Data Access&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Variables can now be declared using XML schema complex types&lt;/li&gt;&lt;/ul&gt;XPath expressions are simplified by using the ‘$’ notation for variable access, for example, $myMsgVar.part1/po:poLine[@lineNo=3]&lt;span style="color: rgb(153, 51, 0);"&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Access to WSDL messages has been simplified by mapping directly mapping WSDL message parts to XML schema element/type variables&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Several clarifications have been added to the description of the &lt;assign&gt; activity’s &lt;copy&gt; semantics&lt;/copy&gt;&lt;/assign&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;The keepSrcElementName option has been added to &lt;copy&gt; in order to support XSD substitution groups or choices&lt;/copy&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;The ignoreMissingFromData has been added to automatically some of &lt;copy&gt; operation, when the from data is missing. &lt;span style="color: rgb(153, 51, 0);"&gt;&lt;/span&gt;&lt;/copy&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;An extension operation has been added to the &lt;assign&gt; activity&lt;/assign&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;A standardized XSLT 1.0 function has been added to XPath expressions&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;The ability to validate XML data has been added, both as an option of the &lt;assign&gt; activity and as a new &lt;validate&gt; activity&lt;/validate&gt;&lt;/assign&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Variable initialization as part the of variable declaration has been added&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Scope Model&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;New scope snapshot semantics have been defined&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Fault handling during compensation has been clarified&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;The interaction between scope isolation and control links have been clarified&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Enrichment of fault catching model&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A &lt;rethrow&gt; activity has been added to fault handlers&lt;/rethrow&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;The &lt;terminationhandler&gt; has been added to scopes&lt;/terminationhandler&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;The exitOnStandardFault option has been added to processes and scopes&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Message Operations&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The join option has been added to correlation sets in order to allow multiple participants to rendezvous at the same process with a deterministic order&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Partner link can now be declared local to a scope&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;The initializePartnerRole option has been added to specify whether an endpoint reference must be bound to a partner link during deployment&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;The messageExchange construct has been added to pair up concurrent &lt;receive&gt; and &lt;reply&gt; activities&lt;/reply&gt;&lt;/receive&gt;&lt;/li&gt;&lt;/ul&gt;Important differences between BPEL 1 and 2 as imported from wsbpel-v2.0-Primer.&lt;br /&gt;&lt;br /&gt;Most of the features added seems to be lessons learn't, a good way to improve. It does not drastically change the specifications but seems to be more friendly for the developer. Many problems that I am facing with the current implementation with BPEL 1.1 would be removed using this specification when the product vendor decides to implement it.&lt;br /&gt;&lt;br /&gt;Sadly one point was missing support for XPath 2.0 and XSLT 2.0. The FAQs [&lt;a href="http://www.oasis-open.org/committees/download.php/23858/WS-BPEL-2.0-FAQ.html"&gt;http://www.oasis-open.org/committees/download.php/23858/WS-BPEL-2.0-FAQ.html&lt;/a&gt;] clearly state '&lt;span style=";font-family:&amp;quot;;font-size:12;"  lang="EN" &gt;WS-BPEL2.0 is based upon XPath 1.0 and XSLT 1.0&lt;/span&gt;'. I thought XSLT 2.0 and XPath 2.0 were huge advancements but not being supported I was very disappointed. I believe the product vendors would still support them  along with XPath 1.0 and XSLT 1.0 as standard extensions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-531752466805142607?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/531752466805142607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=531752466805142607' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/531752466805142607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/531752466805142607'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2008/05/ws-bpel-20.html' title='WS-BPEL 2.0'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-8881992827607687392</id><published>2008-04-21T15:53:00.000+04:00</published><updated>2008-04-22T17:09:30.550+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SOA'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><title type='text'>Oracle SOA suite - Retrieving process information</title><content type='html'>&lt;strong&gt;The problem statement&lt;/strong&gt;&lt;br /&gt;To retrieve the information of a process from dehydration store even when I did not have the instance id using data present in the request of the process. (This is a part of a bigger problem I am trying to resolve)&lt;br /&gt;&lt;br /&gt;I have an a unique field in the BPEL input. How can I find the BPEL instance and the related instances (This BPEL is executed which in turn executes several other BPEL processes ). I could not modify the existing BPEL so I was left with only one option that was to use the Oracle BPEL Process Manager Client API. This API has very less documentation, most of the help I got was from some blogs specially &lt;a href="http://orasoa.blogspot.com/2007/06/calling-bpelesb-webservice-from.html"&gt;http://orasoa.blogspot.com/2007/06/calling-bpelesb-webservice-from.html&lt;/a&gt; and the API documentation &lt;a href="http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28986/toc.htm"&gt;http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28986/toc.htm&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Driving to the beach&lt;/span&gt;&lt;br /&gt;The Marc Kelderman blog solved one of the biggest problems I faced the 'jar hell'. I had tried several other posts but was not successful in setting up the project correctly, but the jar files as specified by him worked wonderfully.&lt;br /&gt;&lt;br /&gt;Finally my classpath contained :-&lt;br /&gt;connector15.jar, ejb.jar, oc4j-internal.jar, optic.jar, orabpel.jar, orabpel-ant.jar, orabpel-boot.jar, orabpel-common.jar, orabpel-exts.jar, orabpel-thirdparty.jar, oracle_http_client.jar, orawsdl.jar, xmlparserv2.jar. I am using SOA Suite version 10.1.3.3.&lt;br /&gt;&lt;br /&gt;Now I setup a new java project in eclipse with these jars in my classpath. I then setup a server configuration file&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Getting your feet wet&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;## server_config.properties&lt;br /&gt;java.naming.factory.initial=com.evermind.server.rmi.RMIInitialContextFactory&lt;br /&gt;java.naming.provider.url=opmn:ormi://someserver.com:6004:oc4j_soadqa/orabpel&lt;br /&gt;java.naming.security.principal=myname&lt;br /&gt;dedicated.connection=true&lt;br /&gt;java.naming.security.credentials=mypwd&lt;/pre&gt;&lt;/div&gt;Load the properties:-&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt; prop = new Properties();&lt;br /&gt;InputStream resourceAsStream = BPELManagerControl.class&lt;br /&gt;.getClassLoader().getResourceAsStream("server_config.properties");&lt;br /&gt;prop.load(resourceAsStream);&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;The next piece of code I wrote was to retrieve all the instances of a specific BPEL process,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;  Locator locator = new Locator("domainname", prop);&lt;br /&gt;WhereCondition whereProcessId = new WhereCondition("process_id = ?");&lt;br /&gt;whereProcessId.setString(1, "myprocessname");&lt;br /&gt;IInstanceHandle[] instanceHandles = locator&lt;br /&gt;                .listInstances(whereProcessId);&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;strong&gt;Taking the dive &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;And using the instance handles I could display the states and instance id's of the processes. Now this was just the beginning of learning of how to use the API. I needed to modify it to suite my requirements. The previous piece of code returns all record in no particular order, this would make my task very difficult. By trial and error I realized that the API was using a view &lt;span style="FONT-WEIGHT: bold; FONT-STYLE: italic"&gt;admin_list_ci &lt;/span&gt;to query and all its fields could be used in the query. Thus I added the following to order by creation_date (My instance would be one of the current instances in the server) desc. The next problem was if there was an error the list would continue processing infinitely. So I decided that my instance would be one of the last 50 instance executed on the server. This was a safe assumption since I would be searching immediately after submission. Thus my code became:-&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;   Locator locator = new Locator("domainname", prop);&lt;br /&gt; WhereCondition whereProcessId = new WhereCondition("process_id = ?");&lt;br /&gt; whereProcessId.setString(1, "myprocessname");&lt;br /&gt;     whereProcessId.append("ORDER BY  CI_Creation_Date desc");&lt;br /&gt; IInstanceHandle[] instanceHandles = locator&lt;br /&gt;     .listInstances(whereProcessId,0,50);&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;The next problem to resolve was ho do I find if the given IInstanceHandle handle was the instance I was searching for. I needed to search if my application specific id was present in the request of the instance.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The IInstanceHandle object had a &lt;span style="FONT-STYLE: italic"&gt;getField &lt;/span&gt;method which seemed to suite my requirements (get the request variable and get the xml from it), but I realized it could only be used for a process that is not finished, thus had to drop the idea of using this method.&lt;/li&gt;&lt;li&gt;The only other way to get the data I could find was using the debug and audit xmls. In the BPELConsole along with the flow of the executed instance it also can display the Audit and Debug xmls. Corresponding methods were getAuditTrail and getDebugTrace that gave the dump of the whole BPEL instance data. I decided to use the getAuditTrail as the debug trace referred to the XML as an id (probably a refernce to some other table) which I could not find. Audit trail seemed to be working thus I decided to use it.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="codewrap"&gt;&lt;pre&gt;   String auditTrailXML = instanceHandle.getAuditTrail();&lt;br /&gt;  String XPATH = "//event[@label=\"receiveInput\"]/details/text()";&lt;br /&gt;  String receiveInput = Utils.xPathEvaluator(auditTrailXML, XPATH);&lt;br /&gt;  XPathFactory factory = XPathFactory.newInstance();&lt;br /&gt;  XPath xPath = factory.newXPath();&lt;br /&gt;&lt;br /&gt;  NamespaceContext ctx = new NamespaceContext() {&lt;br /&gt;      public String getNamespaceURI(String prefix) {&lt;br /&gt;          String uri;&lt;br /&gt;          if (prefix.equals("ns1"))&lt;br /&gt;              uri = "http://www.sash.com/Schema/Declaration";&lt;br /&gt;          else&lt;br /&gt;              uri = null;&lt;br /&gt;          return uri;&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      public Iterator getPrefixes(String val) {&lt;br /&gt;          return null;&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      public String getPrefix(String uri) {&lt;br /&gt;          return null;&lt;br /&gt;      }&lt;br /&gt;  };&lt;br /&gt;&lt;br /&gt;  xPath.setNamespaceContext(ctx);&lt;br /&gt;  String XPATH2 = "//ns1:appid/text()";&lt;br /&gt;  XPathExpression xPathExpression = xPath.compile(XPATH2);&lt;br /&gt;  String appid = xPathExpression.evaluate(new InputSource(&lt;br /&gt;      new StringReader(receiveInput)));&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;And from the appid compare with the appid we had and keep on looping until the instance is found. Thus I was successful in retrieving the instance id.&lt;br /&gt;&lt;br /&gt;To find all the related instances find the current instance and get it's handle. Then use the following where condition to retrieve related instances:-&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;    WhereCondition wpi = new WhereCondition("ROOT_ID=?");&lt;br /&gt;    wpi.setString(1, instanceHandle.getRootId());&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Conclusion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;The whole code was mostly based on trial and error and basic API documentation. &lt;/li&gt;&lt;li&gt;The API can be very helpful but very difficult to use&lt;/li&gt;&lt;li&gt;The view &lt;span style="FONT-WEIGHT: bold; FONT-STYLE: italic"&gt;admin_list_ci &lt;/span&gt;in the BPEL dehydration store can be used to construct the where clause in the query.&lt;/li&gt;&lt;li&gt;Setting up the project is not very simple. The jars have to be correct.&lt;/li&gt;&lt;li&gt;Do you want to use the API? Depends on your requirement. I turned to this API when I had no other option and yes I was satisfied as it resolved my problem.&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-8881992827607687392?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/8881992827607687392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=8881992827607687392' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/8881992827607687392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/8881992827607687392'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2008/04/oracle-soa-suite-retrieving-process.html' title='Oracle SOA suite - Retrieving process information'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-2338440397270033243</id><published>2008-03-28T22:22:00.000+04:00</published><updated>2008-03-28T22:55:38.118+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SOA'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><title type='text'>XSLT / XPATH 2.0</title><content type='html'>&lt;p id="pgna" class="MsoNormal"&gt;&lt;span id="kinm" style="line-height: 115%;color:black;" &gt;&lt;span style="font-size:100%;"&gt;In my current project I was trying to replace a java transformation service to an XSLT. I faced some speed breakers. Googling I came to references of XSLT 2.0 which solves the problems that I was encountering.We are using the Oracle SOA suite 10.3.x. the editor (JDeveloper) only supports XSLT 1.0, but the interesting part is that in text editor changing version of XSLT from 1.0 to 2.0 the parser supports the newer version also.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p id="efxt" class="MsoNormal"&gt; &lt;span id="hsse" style="line-height: 115%;color:black;" &gt;&lt;/span&gt;&lt;/p&gt;    &lt;p id="ky.x" class="MsoNormal"&gt;&lt;span id="j8ih" style="line-height: 115%;color:black;" &gt;&lt;span style="font-size:100%;"&gt;I just needed group by function like the database. In an array I had to do a grouping. XSLT 2.0 brings the new for-each-group construct. This missing feature from the older xslt version had been a major drawback.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:100%;"&gt;  &lt;/span&gt;&lt;p id="s0mx" class="MsoNormal"&gt;&lt;span id="mn4a" style="line-height: 115%;color:black;" &gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;Another simple requirement I had was a sum of products. Say I have multiple items and I need to calculate the total price.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt; &amp;lt;items&amp;gt;&lt;br /&gt;   &amp;lt;line_item&amp;gt;&lt;br /&gt;       &amp;lt;price&amp;gt;20&amp;lt;/price&amp;gt;&lt;br /&gt;       &amp;lt;quantity&amp;gt;33&amp;lt;/quantity&amp;gt;&lt;br /&gt;   &amp;lt;/line_item&amp;gt;&lt;br /&gt;   &amp;lt;line_item&amp;gt;&lt;br /&gt;       &amp;lt;price&amp;gt;10&amp;lt;/price&amp;gt;&lt;br /&gt;       &amp;lt;quantity&amp;gt;4&amp;lt;/quantity&amp;gt;&lt;br /&gt;   &amp;lt;/line_item&amp;gt;&lt;br /&gt;&amp;lt;/items&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;p id="n::l" class="MsoNormal"&gt;&lt;span id="arl9" style="line-height: 115%;color:black;" &gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;To calculate the product (20*33 + 10*4) we can calculate it by using XPath . Evalaution of XPath&lt;/span&gt;  &lt;span id="ve33"&gt;&lt;b&gt;sum(for $a in (//line_item) return ($a/price * $a/quantity))&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt; gives the result. We can use this in our XSLT to calculate the value. The new version of XSLT/XPath brings in features that were long waited.  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p id="n::l" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p id="n::l" class="MsoNormal"&gt;&lt;span id="arl9" style="line-height: 115%;color:black;" &gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;Some other features include :  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul id="kl-l"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;li id="b8s4"&gt;&lt;span id="arl9" style="line-height: 115%;color:black;" &gt;&lt;span style="font-size:100%;"&gt;Output multiple documents from a single transformation&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li id="hyoa"&gt;&lt;span id="arl9" style="line-height: 115%;color:black;" &gt;&lt;span style="font-size:100%;"&gt;Type awareness&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li id="nnjh"&gt;&lt;span id="arl9" style="line-height: 115%;color:black;" &gt;&lt;span style="font-size:100%;"&gt;The resultant tree created by querying the doc, can be queried like any other element&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li id="nnjh"&gt;&lt;span id="arl9" style="line-height: 115%;color:black;" &gt;&lt;span style="font-size:100%;"&gt;custom functions &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/ul&gt;&lt;p id="n::l" class="MsoNormal"&gt;&lt;span id="arl9" style="line-height: 115%;color:black;" &gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p id="n::l" class="MsoNormal"&gt;&lt;span id="arl9" style="line-height: 115%;color:black;" &gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;I hope these standards are adopted soon by everyone with better tool support. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;              &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-2338440397270033243?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/2338440397270033243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=2338440397270033243' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/2338440397270033243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/2338440397270033243'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2008/03/in-my-current-project-i-was-trying-to.html' title='XSLT / XPATH 2.0'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-8286361541102006750</id><published>2007-12-15T17:11:00.000+04:00</published><updated>2007-12-15T19:03:53.283+04:00</updated><title type='text'>EclipseWebEnabler by Alphaworks</title><content type='html'>The eclipse plugin that would enable your eclipse for remote access using Mozilla browser.&lt;br /&gt;&lt;br /&gt;Amazing idea, a very innovative eclipse plugin. It still needs a lot of work but definitely I would keep a track of its changes.&lt;br /&gt;&lt;br /&gt;You need to see it to believe it.&lt;br /&gt;&lt;br /&gt;It could change the way we use central repositories forever. I'm just waiting for it to  be completely functional.&lt;br /&gt;&lt;br /&gt;Download and try from http://www.alphaworks.ibm.com/tech/eclifox&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-8286361541102006750?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/8286361541102006750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=8286361541102006750' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/8286361541102006750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/8286361541102006750'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/12/eclipsewebenabler-by-alphaworks.html' title='EclipseWebEnabler by Alphaworks'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-1770648757227728056</id><published>2007-11-25T17:04:00.000+04:00</published><updated>2007-11-25T17:06:58.079+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Others'/><title type='text'>Hourly Clock</title><content type='html'>Announcing the availability of &lt;a href="http://desktop.google.com/plugins/i/hourlyclock_sashgupt.html?hl=en"&gt;Hourly Clock&lt;/a&gt; a Google Gadget developed by me. It uses the nice Google gadget API to show a simple clock and give hourly reminders of the time. So don't let the time just pass by, use this gadget....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-1770648757227728056?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/1770648757227728056/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=1770648757227728056' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/1770648757227728056'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/1770648757227728056'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/11/hourly-clock.html' title='Hourly Clock'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-304655176306070520</id><published>2007-11-25T10:51:00.000+04:00</published><updated>2007-11-25T17:12:12.431+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SOA'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><title type='text'>Non WS-I document literal web service</title><content type='html'>A document literal web service with more than one parts specified for the same message is not &lt;a href="http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html"&gt;WS-I compliant&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;e.g.&lt;br /&gt; &lt;div class="codewrap2"&gt;&lt;pre&gt;&amp;lt;wsdl:message name="HelloDudeSoapIn"&amp;gt;&lt;br /&gt;      &amp;lt;wsdl:part name="name" element="tns:name"/&amp;gt;&lt;br /&gt;      &amp;lt;wsdl:part name="age" element="tns:age"/&amp;gt;&lt;br /&gt; &amp;lt;/wsdl:message&amp;gt; &lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The SOAP message would look like:&lt;br /&gt;&lt;br /&gt; &lt;div class="codewrap2"&gt;&lt;pre&gt;&amp;lt;soap-env:envelope&amp;gt;&lt;br /&gt;     &amp;lt;soap-env:body&amp;gt;&lt;br /&gt;              &amp;lt;m:name&amp;gt;Baby&amp;lt;/m:name&amp;gt;&lt;br /&gt;              &amp;lt;m:age&amp;gt;1&amp;lt;/m:age&amp;gt;&lt;br /&gt;     &amp;lt;/soap-env:body&amp;gt;&lt;br /&gt;&amp;lt;/soap-env:envelope&amp;gt;  &lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Why the restriction, think about validation of the message. I would have to extract the name and age elements seperately and then validate them against an XSD. If the elements were within a single tag...&lt;br /&gt;&lt;br /&gt; &lt;div class="codewrap2"&gt;&lt;pre&gt;&amp;lt;soap-env:envelope&amp;gt;&lt;br /&gt;     &amp;lt;soap-env:body&amp;gt;&lt;br /&gt;             &amp;lt;m:person&amp;gt;&lt;br /&gt;                    &amp;lt;m:name&amp;gt;Baby&amp;lt;/m:name&amp;gt;&lt;br /&gt;                    &amp;lt;m:age&amp;gt;1&amp;lt;/m:age&amp;gt;&lt;br /&gt;             &amp;lt;/m:person&amp;gt;&lt;br /&gt;     &amp;lt;/soap-env:body&amp;gt;&lt;br /&gt; &amp;lt;/soap-env:envelope&amp;gt;  &lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The person element can be completely validated after the person element is extracted.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-304655176306070520?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/304655176306070520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=304655176306070520' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/304655176306070520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/304655176306070520'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/11/non-ws-i-document-literal-web-service.html' title='Non WS-I document literal web service'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-3646843088933508347</id><published>2007-11-14T14:09:00.000+04:00</published><updated>2007-11-20T17:10:24.177+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SOA'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><title type='text'>XPath injection</title><content type='html'>&lt;h1&gt;&lt;b&gt;XPath injection&lt;/b&gt;&lt;/h1&gt;&lt;b&gt;What is XPath?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;XPath (XML Path Language) is an expression language for addressing portions of an XML document, or for computing values (strings, numbers, or boolean values) based on the content of an XML document.&lt;br /&gt;For more information see &lt;a href="http://www.w3schools.com/xpath/default.asp" id="hxm:" title="XPath tutorial"&gt;XPath tutorial&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;&lt;b&gt;Understanding the attack&lt;/b&gt;&lt;/h2&gt; XPath injection is an attack where data is taken from the user without validation (or incomplete validation) and which modifies the behavior of the XPath expression by masquerading XPath as data.&lt;br /&gt;&lt;br /&gt;Assume that we have user id and password stored in xml files and we use XPath for validating them. The xml containing the user id and password looks like:&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;&amp;lt;security-check&amp;gt;&lt;br /&gt; &amp;lt;user&amp;gt;&lt;br /&gt;     &amp;lt;id&amp;gt;sash&amp;lt;/id&amp;gt;&lt;br /&gt;     &amp;lt;password&amp;gt;sash123&amp;lt;/password&amp;gt;&lt;br /&gt; &amp;lt;/user&amp;gt;&lt;br /&gt; &amp;lt;user&amp;gt;&lt;br /&gt;     &amp;lt;id&amp;gt;abhinav&amp;lt;/id&amp;gt;&lt;br /&gt;     &amp;lt;password&amp;gt;abhinav123&amp;lt;/password&amp;gt;&lt;br /&gt; &amp;lt;/user&amp;gt;&lt;br /&gt;&amp;lt;/security-check&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;To validate the user id and password against the xml we use the XPath  expression&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;//user[id/text()='+ {input user id} +' and password/text()='+ {input password} +'] &lt;/span&gt;&lt;br /&gt;we execute the XPath and check if it returns any nodes, if it returns any nodes then the password is valid. If the entered used id is &lt;span style="color: rgb(51, 51, 255);"&gt;sash &lt;/span&gt;and the password is &lt;span style="color: rgb(51, 51, 255);"&gt;sash123 &lt;/span&gt;the XPath would become &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;//user[id/text()='sash' and password/text()='sash123'] &lt;/span&gt;&lt;br /&gt;and would return the user node and the password would be validated. If a wrong password is used no node would be returned and the validation would fail.&lt;br /&gt;&lt;br /&gt;Now while injecting XPath in the password &lt;span style="color: rgb(51, 102, 255);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;field &lt;/span&gt;&lt;i&gt;' &lt;/i&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;i&gt;or 'a' = 'a &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;is entered. The XPath would become&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;//user[id/text()='sash' and password/text()='&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;&lt;i&gt;' &lt;/i&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;i&gt;or 'a' = 'a&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;']&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;which would return multiple rows and the validation would pass.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;h2&gt;&lt;b&gt;Simulating the attack&lt;/b&gt;&lt;/h2&gt; &lt;b&gt;Sample C# code&lt;br /&gt;&lt;/b&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt; XmlDocument XmlDoc = new XmlDocument();&lt;br /&gt; XmlDoc.Load("XPATH_INJECT.xml"); // use the same xml as above&lt;br /&gt; XPathNavigator nav = XmlDoc.CreateNavigator();&lt;br /&gt; XPathExpression expr = nav.Compile(&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;"//user[id/text()='"&lt;br /&gt;&lt;/span&gt;        &lt;span style="color: rgb(51, 51, 255);"&gt;+ textBox1.Text + "' and password/text()='" + textBox2.Text + "']"&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;);&lt;br /&gt;&lt;br /&gt; XPathNodeIterator iterator = nav.Select(expr);&lt;br /&gt; if (iterator.MoveNext())&lt;br /&gt; {&lt;br /&gt; &lt;/span&gt;    &lt;span style="color: rgb(51, 51, 255);"&gt;result.Text = "passed";&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;    &lt;span style="color: rgb(51, 51, 255);"&gt;result.Text = "failed";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;b&gt;Sample Java code&lt;br /&gt;&lt;br /&gt; &lt;/b&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;XPathFactory factory = XPathFactory.newInstance();&lt;br /&gt; XPath xPath = factory.newXPath();&lt;br /&gt; File xmlDocument = new File("XPATH_INJECT.xml");&lt;br /&gt; InputSource inputSource = new InputSource(&lt;br /&gt;                 new FileInputStream(xmlDocument));&lt;br /&gt;    &lt;br /&gt;String user = jTextField1.getText().trim();&lt;br /&gt;String pwd = jTextField2.getText().trim();&lt;br /&gt;XPathExpression expr = xPath.compile(&lt;br /&gt;                 "//user[id/text()='" + user +&lt;br /&gt;                 "' and password/text()='" + pwd +&lt;br /&gt;                 "' ]");&lt;br /&gt;Object result = expr.evaluate(inputSource, XPathConstants.NODESET);&lt;br /&gt;    &lt;br /&gt;NodeList nodes = (NodeList) result;&lt;br /&gt;    &lt;br /&gt;if(nodes.getLength()&amp;gt;0)&lt;br /&gt;{&lt;br /&gt;    jLabel3.setText("Valid"); }&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;   jLabel3.setText("Failed"); }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;h2&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;b&gt;How to protect against the attack:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;There are many ways of preventing this attack&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;ol&gt;&lt;li&gt;Validate the input&lt;/li&gt;&lt;li&gt;Escape the ' or '' characters&lt;/li&gt;&lt;li&gt;This attack is similar to SQL injection, the most common solution to SQL injection attack is using a prepared statement, but something similar is not available in XPath. This though can be achieved using XQuery but XQuery is not directly supporeted without the use of external libraries in .Net or Java.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;The best solution would be escaping the ['] characters, in our example if we replace a ['] with [']['] in the input, we would avoid the attack.&lt;br /&gt;In the previous case our password text entered was &lt;span style="color: rgb(51, 102, 255);"&gt;&lt;i&gt;' &lt;/i&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;i&gt;or 'a' = 'a&lt;/i&gt;&lt;/span&gt;&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;but this would be modified to &lt;span style="color: rgb(51, 51, 255);"&gt;'' or ''a''  = ''a&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;//user[id/text()='sash' and password/text()='&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;'' or ''a''  = ''a&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;']&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;and would not produce any results (and it is a valid XPath).&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;This XPath passes in Altova XML spy but not in Java 6 or .Net 2.0&lt;br /&gt;&lt;br /&gt;So we still need to find an elegant solution to the problem!!!!&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;In all the proposed solutions solution (3) is the most elegant but the support is still very limited.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;&lt;b&gt;Whats left&lt;/b&gt;&lt;/h2&gt;&lt;h2&gt;&lt;/h2&gt;Some of the databases now support XPath, in case your database supports XPath be very careful about the inputs (don't forget the validation). &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;h2&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;b&gt;References&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;http://www.ibm.com/developerworks/xml/library/x-xpathinjection.html&lt;br /&gt;http://www.packetstormsecurity.org/papers/bypass/Blind_XPath_Injection_20040518.pdf&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-3646843088933508347?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/3646843088933508347/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=3646843088933508347' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/3646843088933508347'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/3646843088933508347'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/11/xpath-injection-what-is-xpath-xpath-xml.html' title='XPath injection'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-894609008926973801</id><published>2007-10-25T14:12:00.000+04:00</published><updated>2007-11-25T17:03:38.034+04:00</updated><title type='text'>Practical SOA patterns</title><content type='html'>The SOA patterns I have discussed do not talk about the organization IT policies but the practical SOA patterns:-&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;1.1 Avoid point to point Web Services:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Problem:&lt;/span&gt; Web Service point to point is STILL point to point; doing a bad practice in XML doesn't make it better.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Effect:&lt;/span&gt; An organization believes that they are creating next generation loosely coupled architecture just because they are using Web Services. Web Service calls are invoked directly, using a URI which is hard-coded into the WSDL. Having a highly disorganized and interdependent systems model leads to increased cost of change and a high degree of fragility of the enterprise. When one service is changed a number of other services either fail or behave in unpredictable ways. There is a lack of clarity as to how one service depends on another and what the impact of change is across these services. Consumers then start demanding multiple versions of services, and these add further to the spaghetti in the enterprise.&lt;br /&gt;&lt;br /&gt;While designing a BPEL process the endpoints of the web service may not be known, there is no simple way to determine the web service endpoint dynamically.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Resolution:&lt;/span&gt; The first step is to indirect all of the calls and this can be done in a number of ways; the least invasive is to "proxy" all web-service requests via some form of mediation. So while the host application is still calling webservice.mycompany.com, this is proxied so mediation and routing can be applied if required. The next stage is to understand the different dependencies and identify those which are valid and those which should have been done in a more managed way. A clear governance plan then needs to be created to identify and manage dependencies and versions and to help manage the Web Service infrastructure.&lt;br /&gt;&lt;br /&gt;Once this level of management has been created it is time to start considering what the enterprise Service model should be, that requires the creation of the business service architecture and then overtime evolving the current infrastructure to better represent the business that pays for it.&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;1.2 Use Business Rules to make your process flexible:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Problem:&lt;/span&gt; Orchestration Languages provide constructs that break the linear flow of control. These constructs alter the flow of service orchestration based on run time information. These constructs change often.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Effect:&lt;/span&gt; In mortgage decisioning a conditional control structure implements the pre-screening step that determines whether the process performs decisioning or generates a rejection letter instead. The conditional verifies eligibility, determining how the orchestration unfolds based on whether the applicant's credit score is above a threshold. In effect, the condition associated with a control structure in the orchestration definition captures a business rule. In case the threshold changes, there is a change in the business process and the process needs to be changed and deployed again.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Resolution: &lt;/span&gt;Business rules complement processes. While business processes provide recipes for achieving results, business rules describe the operations, definitions and constraints that apply to an organization in achieving these results. For example a business rule might state that no credit check is required for existing Orchestra Bank customers. A business rules engine integrated with the BPEL manager can be used to solve the problem.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;1.3 Use Composite Services to combine multiple services:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Problem: &lt;/span&gt;We need to combine the functionality of multiple services and make it available to consumers interested in is as a whole rather than the individual services implementing it.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Effect:&lt;/span&gt; Combining existing services could provide significant value over any individual service. In fact the recursive composition is key to the ability of adding value through combining functionality of the existing services. As the number of SOA adopters increases so does the number of choices.&lt;br /&gt;&lt;br /&gt;Service consumers require functionality which can be implemented by suitably combining multiple existing services. They do not want to make multiple calls to the individual services and control the invocation flow.&lt;br /&gt;&lt;br /&gt;Combining the functionality of existing business services (especially when they are provided by different organizations) requires a certain amount of know how and typically has sensitivities (e.g., the underlying services may change or different providers for these services can be selected). Exposing this knowledge to the service consumer introduces coupling.&lt;br /&gt;&lt;br /&gt;Following mergers and acquisitions or through agreements with multiple partners several business services with similar functionality can be available to the enterprise (similarly to the credit check service from the context). These services can be distinguished by their interfaces and SLAs. The availability of multiple choices places the onus of selecting one service to the consumers, thus introducing coupling.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution: &lt;/span&gt;Expose the services involved in satisfying required functionality and their coordination as a separate service.&lt;br /&gt;I was already using quite a few of these patterns but found them documented in Antipatterns and Orchestration patterns.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-894609008926973801?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/894609008926973801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=894609008926973801' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/894609008926973801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/894609008926973801'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/10/practical-soa-patterns.html' title='&lt;h2&gt;Practical SOA patterns&lt;/h2&gt;'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-2426571107022353580</id><published>2007-09-26T18:53:00.000+04:00</published><updated>2007-09-27T10:10:27.661+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Java Annotations</title><content type='html'>I was preparing a talk on annotations in java and ended up learning a few cool stuff.&lt;br /&gt;&lt;br /&gt;I believe the utility of annotations would be the freedom from implementing interfaces like the JUnit test case and the EJB 3.0.&lt;br /&gt;&lt;br /&gt;New and innovative uses for annotations are also likely to come up.&lt;br /&gt;&lt;br /&gt;Annotations is cool if used intelligently. Now if a developer wants to use a annotations to save configuration values I ask can you blame annotations.&lt;br /&gt;&lt;br /&gt;The problem lies sometimes in the fuzziness of what is configuration values. Say in hibernate in by bean I hard code my table name, is my table name configuration. I believe not, but in some cases it could be true. I haven't seen table names being different in production environment and development but using annotations makes it less flexible.&lt;br /&gt;&lt;br /&gt;Sun could have made the creation of annotations more 'Java like' @interface to define an annotation and the definition of the default values....&lt;br /&gt;&lt;br /&gt;The annotation processing tool is also very interesting. The tool ties us with the Sun jdk and probably would evolve as a part of standard SDK distribution.&lt;br /&gt;&lt;br /&gt;Presentation is available at : &lt;a href="http://sashwat.gupta.googlepages.com/Annotations.pdf"&gt;http://sashwat.gupta.googlepages.com/Annotations.pdf&lt;/a&gt;&lt;br /&gt;Example code is available at : &lt;a href="http://sashwat.gupta.googlepages.com/annotation.zip"&gt;http://sashwat.gupta.googlepages.com/annotation.zip&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-2426571107022353580?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/2426571107022353580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=2426571107022353580' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/2426571107022353580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/2426571107022353580'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/09/annotation.html' title='Java Annotations'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-8620392108146891826</id><published>2007-07-04T13:53:00.000+04:00</published><updated>2007-07-05T09:19:27.447+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>ClassCastException</title><content type='html'>When do we get a ClassCastException?&lt;br /&gt;&lt;br /&gt;The java documentation of ClassCastException states:-&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;Thrown to indicate that the code has attempted to &lt;b&gt;cast an object to a subclass&lt;/b&gt; of which it is not an instance. &lt;br /&gt;For example, the following code generates a ClassCastException:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;     Object x = new Integer(0);&lt;br /&gt;     System.out.println((String)x);&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The statement seems to be a very simple, but not when different class loaders are involved. Another scenario when this exception occurs is when the class accesses an object of the same class loaded by another class loader hierarchy.&lt;br /&gt;&lt;br /&gt;I was determined to write a simple code to simulate the exception.&lt;br /&gt;&lt;br /&gt;So I wrote two classes to be loaded by different classloaders.&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap"&gt;&lt;pre&gt;package classldr;&lt;br /&gt;&lt;br /&gt;public class Tree {&lt;br /&gt;&lt;br /&gt;  private String name = "sash";&lt;br /&gt;&lt;br /&gt;  public String getName() {&lt;br /&gt;      return name;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setName(String name) {&lt;br /&gt;      this.name = name;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//------ different file ----------//&lt;br /&gt;package classldr;&lt;br /&gt;&lt;br /&gt;public class Person{&lt;br /&gt;&lt;br /&gt;  public void doIT(Object t)&lt;br /&gt;  {&lt;br /&gt;      //try to create the typecast exception here!!&lt;br /&gt;      System.out.println("Tree planted : " + ((Tree)t).getName());&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;I would try to load these classes using different classloaders and simulate the error.&lt;br /&gt;&lt;br /&gt;So I created instances of URLClassLoader and did the same. I had to make sure that the class creating the class loaders could not access these classes, as it was the parent of the URLClassLoader and would have actually loaded the class due to delegation model followed by the classloaders.&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap"&gt;&lt;pre&gt;package classldr;&lt;br /&gt;&lt;br /&gt;import java.lang.reflect.Method;&lt;br /&gt;import java.net.URL;&lt;br /&gt;import java.net.URLClassLoader;&lt;br /&gt;&lt;br /&gt;public class TestClassLoader {&lt;br /&gt;&lt;br /&gt;   public static void main(String[] args) throws Exception {&lt;br /&gt;      &lt;br /&gt;       /*&lt;br /&gt;        * Class loader 1 to create instance of Tree class. I have put the&lt;br /&gt;  * Person and Tree classes in C:\classldr\ directory.        &lt;br /&gt;        */&lt;br /&gt;       ClassLoader cl1 = new URLClassLoader(new URL[] { new URL(&lt;br /&gt;               "file:C:\\") });&lt;br /&gt;       Class c = cl1.loadClass("classldr.Tree");&lt;br /&gt;       Object treeNewInstance = c.newInstance();&lt;br /&gt;      &lt;br /&gt;       /*&lt;br /&gt;        * Class loader 2 to create instance of Person and Tree class.&lt;br /&gt;        */&lt;br /&gt;       ClassLoader cl2 = new URLClassLoader(new URL[] { new URL(&lt;br /&gt;               "file:C:\\") });&lt;br /&gt;       Class treeClass = cl2.loadClass("classldr.Tree");&lt;br /&gt;       Class personTreeClass = cl2.loadClass("classldr.Person");&lt;br /&gt;       Object personTreeObj = personTreeClass.newInstance();&lt;br /&gt;       Object treeClassObj = treeClass.newInstance();&lt;br /&gt;       Method method = personTreeClass.getMethod("doIT",new Class[]{Object.class} );&lt;br /&gt;      &lt;br /&gt;      &lt;br /&gt;       //pass the object of tree loaded by cl 1 to&lt;br /&gt;       //person object loaded by cl 1&lt;br /&gt;       method.invoke(personTreeObj,new Object[]{ treeClassObj});&lt;br /&gt;      &lt;br /&gt;       //pass the object of tree loaded by cl 1 to&lt;br /&gt;       //person object loaded by cl 2&lt;br /&gt;       //should throw a ClassCastException&lt;br /&gt;       method.invoke(personTreeObj,new Object[]{ treeNewInstance});&lt;br /&gt;   }&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After I spent a lot of time on this I realized it could be demonstrated in a much simpler way. I decided that my URLClassLoader could be a child of the Bootstrap class loader, not necessarily the system class loader.&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;package classldr;&lt;br /&gt;&lt;br /&gt;import java.net.URL;&lt;br /&gt;import java.net.URLClassLoader;&lt;br /&gt;&lt;br /&gt;public class TestClassLoader2 {&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args) throws Exception {&lt;br /&gt;        &lt;br /&gt;        //get current class location&lt;br /&gt;        URL resource = TestClassLoader2.class.getClassLoader().getResource(".");&lt;br /&gt;        &lt;br /&gt;        //create a new classloader to load this class, &lt;br /&gt;        //have the parent of the classloader as null&lt;br /&gt;        ClassLoader cl1 = new URLClassLoader(new URL[] { resource }, null);&lt;br /&gt;        Class c = cl1.loadClass("classldr.TestClassLoader");&lt;br /&gt;        &lt;br /&gt;        //this throws ClassCastException&lt;br /&gt;        TestClassLoader2 treeNewInstance = (TestClassLoader2) c.newInstance();&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;This code was good enough to simulate the exception.&lt;br /&gt;&lt;br /&gt;Finally I successfully generated the exception and was feeling very stupid about my first method. :(&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-8620392108146891826?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/8620392108146891826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=8620392108146891826' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/8620392108146891826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/8620392108146891826'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/07/classcastexception.html' title='ClassCastException'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-5654575707321769684</id><published>2007-06-08T16:40:00.000+04:00</published><updated>2007-06-08T16:54:35.419+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Finding Class Version</title><content type='html'>Facing class mismatch error, I decided to find the JRE version and the compiler version  used to compile the class file.&lt;br /&gt;&lt;br /&gt;Its easy to get the details of the JRE version using System.getProperties(). A more difficult task was to find out the version of the class file. I could not find any API which did it :(. But I did find out that these details were available in the class file, so I wrote a small code to determine if the class will run on the current version of JRE.&lt;div class="codewrap"&gt;&lt;pre&gt;import java.io.DataInputStream;&lt;br /&gt;import java.io.FileInputStream;&lt;br /&gt;&lt;br /&gt;public class ClassRuntimeVersion {&lt;br /&gt;    public static void main(String[] args) throws Exception {&lt;br /&gt;&lt;br /&gt;        FileInputStream fis = null;&lt;br /&gt;        DataInputStream dis = null;&lt;br /&gt;&lt;br /&gt;        try {&lt;br /&gt;            if (args.length != 1) {&lt;br /&gt;                throw new Exception("specify the class file");&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            fis = new FileInputStream(args[0]);&lt;br /&gt;            dis = new DataInputStream(fis);&lt;br /&gt;&lt;br /&gt;            if (dis.readInt() != 0xCAFEBABE) {&lt;br /&gt;                throw new Exception("not a class file");&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            short minorVersion = dis.readShort();&lt;br /&gt;            short majorVersion = dis.readShort();&lt;br /&gt;&lt;br /&gt;            System.out.println("Java Class version info");&lt;br /&gt;            System.out.println("1.6    50");&lt;br /&gt;            System.out.println("1.5    49");&lt;br /&gt;            System.out.println("1.4    48");&lt;br /&gt;            System.out.println("1.3    47");&lt;br /&gt;            System.out.println("-------------------------");&lt;br /&gt;&lt;br /&gt;            float classVersion = Float.parseFloat(majorVersion + "."&lt;br /&gt;                    + minorVersion);&lt;br /&gt;            System.out.println("Class file compiled version : " + classVersion);&lt;br /&gt;&lt;br /&gt;            float jreJavaVersion = Float.parseFloat(System&lt;br /&gt;                    .getProperty("java.class.version"));&lt;br /&gt;&lt;br /&gt;            System.out.println("JRE version : " + jreJavaVersion);&lt;br /&gt;            if (jreJavaVersion &lt; classVersion) {&lt;br /&gt;                System.err.println("You r dead dude, versions did not match");&lt;br /&gt;            }&lt;br /&gt;        } finally {&lt;br /&gt;            if (fis != null) {&lt;br /&gt;                fis.close();&lt;br /&gt;            }&lt;br /&gt;            if (dis != null) {&lt;br /&gt;                dis.close();&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-5654575707321769684?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/5654575707321769684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=5654575707321769684' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/5654575707321769684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/5654575707321769684'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/06/finding-class-version.html' title='Finding Class Version'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-5519095481176443883</id><published>2007-05-29T08:34:00.000+04:00</published><updated>2007-06-08T16:54:03.399+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Sampling Java SE 6</title><content type='html'>A lot of new features and API enhancements have been introduced in Java 6 (Mustang). Some of them are discussed briefly.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Compiler API&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The new Java Compiler API allows invoking a compiler, gives access to diagnostics, and control over how files are read through a file manager. The file manager allows applications such as IDEs and JSP servers to keep all files in memory, which significantly speeds up compilation. Sun's open source Java EE implementation, GlassFish claims to have already benefited from this API. &lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;&lt;br /&gt; //get the java compiler reference &lt;br /&gt; JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();&lt;br /&gt;&lt;br /&gt; //compile the Java class&lt;br /&gt; int compilationResult = compiler.run(&lt;br /&gt;                            null,null,null, "C:\\Person.java");&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;The code snippet shows how to compile a Java file using the Compiler API.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Web Service&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The new web services stack provides support for writing XML web service applications. The java classes can be exposed as a .NET interoperable web service with a simple annotation. Java SE 6 adds new parsing and XML to Java object-mapping APIs, previously only available in Java EE platform implementations or the Java Web Services Pack. &lt;br /&gt;&lt;br /&gt;To create a web service on Mustang create a java class, annotate it as shown below.&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;&lt;br /&gt;  @WebService&lt;br /&gt;  @SOAPBinding(style = SOAPBinding.Style.RPC)&lt;br /&gt;  public class Hello {&lt;br /&gt;    public String echo() {&lt;br /&gt; return "Hello THBS";&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;To deploy the web service we just need to write the main method.&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;&lt;br /&gt;  public static void main (String [] args) throws Exception {&lt;br /&gt;      Hello server = new Hello();&lt;br /&gt;      Endpoint.publish("http://localhost:9090/Hello", server);&lt;br /&gt;  }&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The deployment can be verified by displaying the wsdl file on the browser&lt;br /&gt;http://localhost:9090/Hello?wsdl. This feature is intended to be used for testing only.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Scripting for the Java Platform&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Java SE 6 provides support for scripting, which enables the developers to integrate Java technology and scripting languages by defining a standard framework and interface to do the following:&lt;br /&gt;• Access and control Java based objects from a scripting environment&lt;br /&gt;• Create web content with scripting languages&lt;br /&gt;• Embed scripting environments within Java technology-based applications&lt;br /&gt;&lt;br /&gt;The Java Platform, Standard Edition (Java SE), does not mandate any particular script engine, but it does include the Mozilla Rhino engine for the JavaScript programming language.&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;&lt;br /&gt;  ScriptEngineManager mgr = new ScriptEngineManager();&lt;br /&gt;  ScriptEngine jsEngine = mgr.getEngineByName("JavaScript");&lt;br /&gt;  jsEngine.eval("function helloWorld(){" &lt;br /&gt;+ " println('Hello, world!'); "&lt;br /&gt;  + " return 's';" + "}");&lt;br /&gt;&lt;br /&gt;  Invocable invocableEngine = (Invocable) jsEngine;&lt;br /&gt;  invocableEngine.invokeFunction("helloWorld", (Object[]) null);&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;The example shows how to invoke a JavaScript function using java.&lt;br /&gt;&lt;br /&gt;See: &lt;a href="http://tech-sash.blogspot.com/2007/02/mustang-released.html#links"&gt;Carpe diem: Mustang released&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Database&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The Java SE 6 development kit co-bundles the all-Java JDBC database, Java DB based on Apache Derby. Out of the box developers have a database that can be used that implements the latest version of JDBC and is embeddable within desktop Java applications. Java DB has a small memory footprint and is fully transactional.&lt;br /&gt;&lt;br /&gt;Also provided is JDBC 4.0, a well-used API with many important improvements, such as special support for XML as an SQL datatype and better integration of Binary Large OBjects (BLOBs) and Character Large OBjects (CLOBs) into the APIs.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Desktop Development&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Desktop application development just became simpler with Java 6. It provides better platform look-and-feel in Swing technology, LCD text rendering, and snappier GUI performance overall. Java applications can integrate better with the native platform with things like new access to the platform's System Tray and Start menu. At long last, Java SE 6 unifies the Java Plug-in technology and Java WebStart engines, just makes sense. Installation of the Java WebStart application got a much needed makeover.&lt;br /&gt;&lt;br /&gt;A new class added to the Java platform is java.awt.Desktop. It allows Java applications to launch associated applications registered on the native desktop to handle a java.net.URI or a file.&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;&lt;br /&gt; Desktop d = Desktop.getDesktop();&lt;br /&gt; //opens the application associated with the txt file in your OS&lt;br /&gt; d.browse(new URI("c:/text_file.txt"));&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Similar enhancements have been made to make the development of a java desktop application simpler.&lt;br /&gt; &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Class file structure update:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The class file structure in Java SE 6 has been modified to provide a much faster and simpler class verification process. The idea is to split the old verification process into two phases: type inferencing (compile time) and type checking (runtime).  The new verifier (called the type-checking verifier) no longer needs to infer types because it uses type information embedded in the Java class file to check byte code type consistency. Removing the type inferencing process from the verifier significantly reduces the complexity of verifier code and improves verification performance. This provides performance improvements in byte code verification and thus class loading and start up time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-5519095481176443883?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/5519095481176443883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=5519095481176443883' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/5519095481176443883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/5519095481176443883'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/05/sampling-java-se-6.html' title='Sampling Java SE 6'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-6924892498916750629</id><published>2007-05-21T17:53:00.000+04:00</published><updated>2007-05-22T08:07:51.886+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Mustang :- The Desktop bonus</title><content type='html'>One of the problems with java over the years is the lack on Desktop support. Sun has taken a major step with the release of Java 6.These changes have brought in a whole new flavour to the java desktop applications.&lt;br /&gt;&lt;br /&gt;Java 6 now has system tray support.Now icons in the system tray can be added with menus and event handlers.Some applications that run in the background (eg mail client) can be seen in the system tray. Notifiers can also be provided to sent notification messages. The code demonstrates the use of the new functionality.&lt;br /&gt;&lt;div class="codewrap"&gt;&lt;pre&gt;package com.sash.java6;&lt;br /&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;import java.awt.TrayIcon.MessageType;&lt;br /&gt;import java.awt.event.*;&lt;br /&gt;import java.io.File;&lt;br /&gt;import java.net.URI;&lt;br /&gt;&lt;br /&gt;public class SystemTrayTest {&lt;br /&gt;&lt;br /&gt; public SystemTrayTest() throws Exception {&lt;br /&gt;&lt;br /&gt;  if (SystemTray.isSupported()) {&lt;br /&gt;&lt;br /&gt;   SystemTray tray = SystemTray.getSystemTray();&lt;br /&gt;   //image for tray icon&lt;br /&gt;   Image image = Toolkit&lt;br /&gt;    .getDefaultToolkit().getImage("any_image.gif");&lt;br /&gt;   &lt;br /&gt;   ActionListener exitListener = new ActionListener() {&lt;br /&gt;    public void actionPerformed(ActionEvent e) {&lt;br /&gt;     System.exit(0);&lt;br /&gt;    }};&lt;br /&gt;&lt;br /&gt;   //pop menu for the tray&lt;br /&gt;   PopupMenu popup = new PopupMenu();&lt;br /&gt;   MenuItem alertItem = new MenuItem("Message");&lt;br /&gt;   popup.add(alertItem);&lt;br /&gt;&lt;br /&gt;   MenuItem defaultItem = new MenuItem("Exit");&lt;br /&gt;   defaultItem.addActionListener(exitListener);&lt;br /&gt;   popup.add(defaultItem);&lt;br /&gt;&lt;br /&gt;   final TrayIcon trayIcon = new TrayIcon(image, "Tray Demo", popup);&lt;br /&gt;&lt;br /&gt;   alertItem.addActionListener(new ActionListener() {&lt;br /&gt;    public void actionPerformed(ActionEvent e) {&lt;br /&gt;     trayIcon.displayMessage(&lt;br /&gt;      "Finally", &lt;br /&gt;      "Desktop support for Java", &lt;br /&gt;      MessageType.INFO);&lt;br /&gt;    }&lt;br /&gt;   });&lt;br /&gt;&lt;br /&gt;   trayIcon.setImageAutoSize(true);&lt;br /&gt;   trayIcon.setToolTip("Tooltip test");&lt;br /&gt;   tray.add(trayIcon);&lt;br /&gt;  } else {&lt;br /&gt;   System.err.println(&lt;br /&gt;    "System tray is currently not supported.");&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public static void main(String[] args) throws Exception {&lt;br /&gt;  &lt;br /&gt;  //the system tray icon test&lt;br /&gt;  new SystemTrayTest();&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Other enhancements include, the introduction of the Desktop API. Using this API now its very easy to open the default email client etc. It also provides an API to open any given file with the default application associated in the OS.&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;&lt;br /&gt;  Desktop d = Desktop.getDesktop();&lt;br /&gt;  //guess what?&lt;br /&gt;  //opens the application associated in your OS with the jpg file&lt;br /&gt;  d.browse(new URI("c:/text_file.txt"));&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;This code opens the default program associated with the text files, on my windows system it opens the file in notepad.&lt;br /&gt;&lt;br /&gt;API enhancements have been made to the getTotalSpace, getUsableSpace and getFreeSpace methods have been added. These are very useful enhancements made.&lt;br /&gt;&lt;br /&gt;Very nicely done by the sun guys, finally adding some much needed support for the desktop applications.&lt;br /&gt;:)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-6924892498916750629?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/6924892498916750629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=6924892498916750629' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/6924892498916750629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/6924892498916750629'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/05/mustang-dektop-bonus.html' title='Mustang :- The Desktop bonus'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-3207948316600412125</id><published>2007-04-20T18:34:00.001+04:00</published><updated>2007-05-21T18:10:47.940+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Source code generator</title><content type='html'>Recently I had to write some code in Delphi .NET . Instead of using 'getters' and 'setters' like in java using properties is preferred. But writing the properties by hand is very painful.. Imagine having to write all the getters and setters in java by hand and your IDE ( I preferably use Eclipse ) not generate it. So I decided to write a code generator.&lt;br /&gt;&lt;br /&gt;The first decision I had to make was which language to use. I can code in Java, C# and Delphi. I did not find any feature present in any of the languages that would make them preferable for the job, so I used Java since I am much more comfortable using this language.&lt;br /&gt;&lt;br /&gt;The I had to decide what would be the input and output.&lt;br /&gt;&lt;br /&gt;Input would be like :-&lt;div class="codewrap2"&gt;&lt;pre&gt; // Make these properties!!!!!&lt;br /&gt; id : integer; // the id&lt;br /&gt;&lt;br /&gt; //blah blah comment&lt;br /&gt; id2 : integer;&lt;br /&gt; // so whats up&lt;br /&gt;&lt;br /&gt; line_code : string;&lt;br /&gt; rate : integer;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Output would be like:-&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;   //Variables :::::::&lt;br /&gt;&lt;br /&gt;    _id  :  integer;&lt;br /&gt;    _id2  :  integer;&lt;br /&gt;    _line_code  :  string;&lt;br /&gt;    _rate  :  integer;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    //Properties :::::::&lt;br /&gt;    Property id : integer&lt;br /&gt;         read _id&lt;br /&gt;         write _id ;&lt;br /&gt;    Property id2 : integer&lt;br /&gt;         read _id2&lt;br /&gt;         write _id2 ;&lt;br /&gt;    Property line_code : string&lt;br /&gt;         read _line_code&lt;br /&gt;         write _line_code ;&lt;br /&gt;    Property rate : integer&lt;br /&gt;         read _rate&lt;br /&gt;         write _rate ;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I also decided the coolest way to get the input and write the output was the clipboard. So I had to just copy the text into the clipboard and execute the java program. This would write the output into the clipboard.&lt;br /&gt;&lt;br /&gt;Now the implementation specific details begin.&lt;br /&gt;The first thing I needed to do was to remove the comments. Also what was needed was to get two lists, one containing the variable names and the other containing the variable types.&lt;br /&gt;&lt;br /&gt;And then output it in any way wanted... My complete code is given below..&lt;div class="codewrap"&gt;&lt;pre&gt;&lt;br /&gt;import java.awt.Toolkit;&lt;br /&gt;import java.awt.datatransfer.Clipboard;&lt;br /&gt;import java.awt.datatransfer.DataFlavor;&lt;br /&gt;import java.awt.datatransfer.StringSelection;&lt;br /&gt;import java.awt.datatransfer.Transferable;&lt;br /&gt;import java.awt.datatransfer.UnsupportedFlavorException;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.util.ArrayList;&lt;br /&gt;import java.util.regex.Matcher;&lt;br /&gt;import java.util.regex.Pattern;&lt;br /&gt;&lt;br /&gt;public class SashClipboard&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    public static final String NEWLINE = "\n";&lt;br /&gt;&lt;br /&gt;    public static String TAB = "    ";&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args) throws UnsupportedFlavorException,&lt;br /&gt;                                                                       IOException&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        //gets data from clipboard&lt;br /&gt;        String data = copyFromClipboard();&lt;br /&gt;        &lt;br /&gt;        // System.out.println(data);&lt;br /&gt;&lt;br /&gt;        //get the diff lies&lt;br /&gt;        String[] lines = data.split(NEWLINE);&lt;br /&gt;        &lt;br /&gt;        // System.out.println(Arrays.asList(lines));&lt;br /&gt;        //remove comments '//' and if two stmts exist on same line &lt;br /&gt;        ArrayList&lt;String&gt; linesList = removeSingleLineCommentAndMultiStmt(lines);&lt;br /&gt;&lt;br /&gt;        // System.out.println(linesList);&lt;br /&gt;&lt;br /&gt;        ArrayList&lt;String&gt; varNameList = new ArrayList&lt;String&gt;();&lt;br /&gt;        ArrayList&lt;String&gt; varTypeList = new ArrayList&lt;String&gt;();&lt;br /&gt;&lt;br /&gt;        getVarAndType(linesList, varNameList, varTypeList);&lt;br /&gt;&lt;br /&gt;        String output = createOutput(varNameList, varTypeList);&lt;br /&gt;&lt;br /&gt;        System.out.println(output);&lt;br /&gt;        &lt;br /&gt;        //copy data to clipboard&lt;br /&gt;        copyToClipboard(output);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private static void copyToClipboard(String output)&lt;br /&gt;    {&lt;br /&gt;        StringSelection ss = new StringSelection(output);&lt;br /&gt;        Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();&lt;br /&gt;        cb.setContents(ss, null);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static String copyFromClipboard() throws UnsupportedFlavorException, &lt;br /&gt;                                                                        IOException&lt;br /&gt;    {&lt;br /&gt;        Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();&lt;br /&gt;        Transferable contents = cb.getContents(null);&lt;br /&gt;        Object transferData = contents.getTransferData(DataFlavor.stringFlavor);&lt;br /&gt;        String data = transferData.toString();&lt;br /&gt;        return data;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private static String createOutput(ArrayList&lt;String&gt; varNameList,&lt;br /&gt;            ArrayList&lt;String&gt; varTypeList)&lt;br /&gt;    {&lt;br /&gt;        StringBuilder output = new StringBuilder();&lt;br /&gt;&lt;br /&gt;        output.append("//Variables :::::::\n\n");&lt;br /&gt;        for (int i = 0; i &lt; varNameList.size(); i++)&lt;br /&gt;        {&lt;br /&gt;            output.append(TAB + "_" + varNameList.get(i) + " : "&lt;br /&gt;                    + varTypeList.get(i) + ";" + NEWLINE);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        output.append("\n\n//Properties :::::::\n");&lt;br /&gt;&lt;br /&gt;        for (int i = 0; i &lt; varNameList.size(); i++)&lt;br /&gt;        {&lt;br /&gt;            output.append(TAB + "Property " + varNameList.get(i) + ":"&lt;br /&gt;                    + varTypeList.get(i) + NEWLINE + TAB + TAB + " read " + "_"&lt;br /&gt;                    + varNameList.get(i) + NEWLINE + TAB + TAB + " write "&lt;br /&gt;                    + "_" + varNameList.get(i) + ";" + NEWLINE);&lt;br /&gt;        }&lt;br /&gt;        return output.toString();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private static void getVarAndType(ArrayList&lt;String&gt; linesList,&lt;br /&gt;            ArrayList&lt;String&gt; varNameList, ArrayList&lt;String&gt; varTypeList)&lt;br /&gt;    {&lt;br /&gt;        for (int i = 0; i &lt; linesList.size(); i++)&lt;br /&gt;        {&lt;br /&gt;            String line = linesList.get(i);&lt;br /&gt;            String[] colonSeperated = line.split(":");&lt;br /&gt;            if (colonSeperated.length != 2)&lt;br /&gt;            {&lt;br /&gt;                System.out.println("Something wrong " + line);&lt;br /&gt;                continue;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            String[] commaSeperated = colonSeperated[0].split(",");&lt;br /&gt;&lt;br /&gt;            for (String var : commaSeperated)&lt;br /&gt;            {&lt;br /&gt;                varNameList.add(var);&lt;br /&gt;                varTypeList.add(colonSeperated[1]);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Remove comments '//' and if two stmts exist on same line&lt;br /&gt;     * e.g a: integer; b:string;&lt;br /&gt;     * &lt;br /&gt;     * if input on a line is&lt;br /&gt;     * a:integer; b:integer; //to do something&lt;br /&gt;     * &lt;br /&gt;     * it will give two lines i.e&lt;br /&gt;     * a:integer; &lt;br /&gt;     * b:integer&lt;br /&gt;     * &lt;br /&gt;     * @param lines multi lines&lt;br /&gt;     * @return a list containg different lines &lt;br /&gt;     *  and without single line comments&lt;br /&gt;     */&lt;br /&gt;    private static ArrayList&lt;String&gt; removeSingleLineCommentAndMultiStmt(&lt;br /&gt;            String[] lines)&lt;br /&gt;    {&lt;br /&gt;        ArrayList&lt;String&gt; linesList = new ArrayList&lt;String&gt;();&lt;br /&gt;        for (int i = 0; i &lt; lines.length; i++)&lt;br /&gt;        {&lt;br /&gt;            String[] comment = lines[i].split("//");&lt;br /&gt;&lt;br /&gt;            String[] multiStmt = comment[0].split(";");&lt;br /&gt;            for (String str : multiStmt)&lt;br /&gt;            {&lt;br /&gt;                if (!str.trim().equals(""))&lt;br /&gt;                {&lt;br /&gt;                    linesList.add(str.trim());&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        return linesList;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;It was not just the fact that I code generate the properties and save time, I also loved writing this code..&lt;br /&gt;&lt;br /&gt;I think the code is self explanatory. If any doubts please do post your doubts.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-3207948316600412125?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/3207948316600412125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=3207948316600412125' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/3207948316600412125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/3207948316600412125'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/04/source-code-generator.html' title='Source code generator'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-4300653354067729328</id><published>2007-03-27T18:03:00.000+04:00</published><updated>2007-04-26T07:48:59.469+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Java accesibility hack</title><content type='html'>Invoking a private method/variable using reflection in java is very simple. In the example I invoke the private methodA of the class.&lt;br/&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;&lt;br /&gt;public class A&lt;br /&gt;{&lt;br /&gt;    private void methodA()&lt;br /&gt;    {&lt;br /&gt;        System.out.println("methodA");&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;This is pretty simple. But can we achieve this by setting setAccessible(true) for the Method.&lt;div class="codewrap2"&gt;&lt;pre&gt;&lt;br /&gt;public class B&lt;br /&gt;{&lt;br /&gt;    public static void main(String[] args) throws Exception&lt;br /&gt;    {&lt;br /&gt;        A a = new A();&lt;br /&gt;        Method method = A.class.getDeclaredMethod("methodA");&lt;br /&gt;        method.setAccessible(true);&lt;br /&gt;        method.invoke(a,new Object[]{});&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;And the result is that methodA is printed on the console.&lt;br /&gt;&lt;br /&gt;Now can we achieve this without the use of reflection? Yes we can and thats the java hack. I'll&lt;br /&gt;explain how...&lt;br /&gt;&lt;br /&gt;First write the class A, but mark the methodA as public. Then create a class B as&lt;br/&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;&lt;br /&gt;public class B&lt;br /&gt;{&lt;br /&gt;    public static void main(String[] args) throws Exception&lt;br /&gt;    {&lt;br /&gt;        A a = new A();&lt;br /&gt;        a.methodA();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Compile class A and class B.&lt;br /&gt;javac A&lt;br /&gt;javac B&lt;br /&gt;&lt;br /&gt;Run class B.&lt;br /&gt;java B&lt;br /&gt;&lt;br /&gt;The output is methodA as expected.&lt;br /&gt;&lt;br /&gt;But where is the hack?&lt;br /&gt;Now it comes..&lt;br /&gt;&lt;br /&gt;Change the class A and change methodA as private again. Compile class A again only.&lt;br /&gt;javac A&lt;br /&gt;&lt;br /&gt;Do not try to compile class B, it will result in an comilation error. Now run B&lt;br /&gt;java B&lt;br /&gt;&lt;br /&gt;The output is not an Runtime error, but is methodA.&lt;br /&gt;&lt;br /&gt;You can decompile using any java decompiler and see that methodA is still private but still B can invoke it. The probable reason for this is that accessiblity is a compile time check not a runtime one. At runtime it cannot be determined whether it is invoked using this hack or reflection. I cannot think of any other reason this is not done.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-4300653354067729328?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/4300653354067729328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=4300653354067729328' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4300653354067729328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/4300653354067729328'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/03/java-accesibility-hack.html' title='Java accesibility hack'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-9171870479079748642</id><published>2007-03-14T12:07:00.000+04:00</published><updated>2007-03-27T11:53:38.426+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SOA'/><title type='text'>The role of Representational State Transfer in Web Based computing</title><content type='html'>&lt;span style="font-weight:bold;"&gt;A brief introduction to Representational State Transfer (REST)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;REpresentational State Transfer or REST is an architectural style consisting of the set of constraints applied to elements within the network architecture. By examining the impact of each constraint as it is added to the evolving style, the properties induced by the Web’s constraints were identified. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;But what does Representational State Transfer mean? &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Representation&lt;br /&gt;Resources are first-class objects; “object” is a subtype of “resource”. Resources are retrieved not as character strings or Blobs but as complete representations&lt;br /&gt;A web page is a representation of a resource.&lt;br /&gt;&lt;br /&gt;State means application/session state; is maintained as part of the content transferred from client to server back to client, thus any server can potentially continue transaction from the point where it had left off.&lt;br /&gt;&lt;br /&gt;Transfer of State&lt;br /&gt;Connectors (client, server, cache, resolver, tunnel) are unrelated to sessions and is an abstract mechanism which mediates communication, coordination, or cooperation among components. State is maintained by being transferred from clients to servers and back to clients.&lt;br /&gt;&lt;br /&gt;REST is centered around two design principles:&lt;br /&gt;&lt;br /&gt;Resource as URLs.  A resource is something like a “business  entity” which we wish to expose as a part of an API. Each resource is represented as a unique URL.&lt;br /&gt;&lt;br /&gt;Operations as HTTP method. REST leverages the existing HTTP methods, particularly GET, POST, PUT and DELETE.&lt;br /&gt;&lt;br /&gt;REST provides a set of architectural constraints that, when applied as a whole, emphasizes scalability of component interactions, generality of interfaces, independent deployment of components, and intermediary components to reduce interaction latency, enforce security, and encapsulate legacy systems.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Role of REST in web based applications&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;REST's "client-stateless-server" constraint forbids session state on the server. Designing within this constraint promotes the system properties of visibility, reliability, and scalability. But the server-side Web applications wish to provide a great deal of personalization to a single user, so they must choose between two designs. The first is to send a massive amount of state information with each client request, so that each request is context-complete and the server can remain stateless. A second simpler solution favored by application developers and middleware vendors alike is to send a simple user identity token and associate this token with a "user session" object on the server side. The second design directly violates the client-stateless-server constraint. It certainly enables desirable user functionality (especially personalization), but it places tremendous strain on the architecture.&lt;br /&gt;&lt;br /&gt;The REST constraints provide scalability; say in a clustered environment if the state of client is maintained at the server side then the state has to be replicated across the servers which will be a huge performance overhead.&lt;br /&gt;&lt;br /&gt;An AJAX application does not require full page refresh. The fact that Ajax lets us interact with a server without a full refresh puts the option of a stateful client back on the table. This has profound implications for the architectural possibilities for dynamic immersive Web applications: Because application resource and data resource binding is shifted to the client side, these applications can enjoy the best of both worlds the dynamic, personalized user experience we expect of immersive Web applications and the simple, scalable architecture we expect from RESTful applications.&lt;br /&gt;&lt;br /&gt;Because the Ajax application engine is just a file, it's also proxyable. On a large corporate intranet, only a single employee might ever download a particular version of the application's Ajax engine, and everyone else just picks up a cached copy from the intranet gateway. So with regard to application resources, a well-designed Ajax application engine aligns with REST principles and provides significant scalability advantages versus server-side Web applications.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;RESTful Web Services&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The problem of interoperability is very fundamental and deals with what we call the “accidental architecture” where an organization consists of several different technologies and has to make them interoperable. The simpler the solution less will be the overhead in making such systems interoperable. The fundamental problem the web services world solves is interoperability. The question is whether to use SOAP based Web Services or REST web services. &lt;br /&gt;&lt;br /&gt;Despite the lack of vendor support, Representational State Transfer (REST) web services have been very successful. For example, Amazon's web services have both SOAP and REST interfaces, and 85% of the usage is on the REST interface. Compared with other styles of web services, REST is easy to implement and maintain.&lt;br /&gt;&lt;br /&gt;The SOAP based web services are standardized and standards have been published for the SOAP based web services. They can be used over several transports layer protocols like HTTP, JMS and FTP.  REST makes the web service more WEB based. It uses only the HTTP protocol and thus can’t be used with JMS or FTP.&lt;br /&gt;&lt;br /&gt;HTTP is not a transport protocol. SOAP treats HTTP as a transport protocol like TCP. HTTP only exists to carry bits, namely SOAP messages, with or without a method name. HTTP is an application protocol; it doesn't send bits, it transfers representational state.&lt;br /&gt;&lt;br /&gt;REST isn't the best solution for every Web service. Data that needs to be secure should not be sent as parameters in URIs. If large amounts of data are used in the URI it can become very difficult to maintain and in extreme cases it can even go out of bounds. In such cases SOAP is a preferable solution. But it's important to try REST first and resort to SOAP only when necessary. This helps keep application development simple and accessible. &lt;br /&gt;&lt;br /&gt;Fortunately, the REST philosophy is catching on with developers of Web services. The latest version of the SOAP specification now allows certain types services to be exposed through URIs (although the response is still a SOAP message). Similarly, users of Microsoft .NET platform can publish services so that they use GET requests. All this signifies a shift in thinking about how best to interface Web services. &lt;br /&gt;&lt;br /&gt;Developers need to understand that sending and receiving a SOAP message isn't always the best way for applications to communicate. Sometimes a simple REST interface and a plain text response does the trick—and saves time and resources in the process. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Should we use REST ?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Arguments against non-REST designs&lt;br /&gt;&lt;br /&gt;They break Web architecture, particularly caching. They don't scale well. They have significantly higher coordination costs&lt;br /&gt;&lt;br /&gt;Scaling&lt;br /&gt;&lt;br /&gt;What kind of scaling is most important is application-specific. Not all apps are Hotmail, Google, or Amazon Integration between two corporate apps has different scaling and availability needs&lt;br /&gt;The right approach to one isn't necessarily the right approach to the other&lt;br /&gt;&lt;br /&gt;The REST argument&lt;br /&gt;&lt;br /&gt;A service offered in a REST style will inherently be easier to consume than some complex API:&lt;br /&gt;• Lower learning curve for the consumer&lt;br /&gt;• Lower support overhead for the producer&lt;br /&gt;&lt;br /&gt;What if REST is not enough?&lt;br /&gt;&lt;br /&gt;What happens when you need application semantics that don't fit into the GET / PUT / POST / DELETE generic interfaces and representational state model?&lt;br /&gt;&lt;br /&gt;Nearly all the applications can fit into the GET / PUT / POST / DELETE resources / representations model. These interfaces are sufficiently general. Other interfaces considered harmful because they increase the costs of consuming particular services.&lt;br /&gt;&lt;br /&gt;Asynchronous operations&lt;br /&gt;&lt;br /&gt;There is no complete solution for asynchronous operations available for REST.&lt;br /&gt;Notifications can be sent back as POSTs (the client can implement a trivial HTTP server). Piggyback them on the responses to later requests.&lt;br /&gt;&lt;br /&gt;Transactions&lt;br /&gt;&lt;br /&gt;The client is ultimately responsible for maintaining the transactions. Other designs for REST aren't much better.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;The beginning&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The use of REST is on the rise. The ease of use and scalability of the REST based applications stand apart. REST is the beginning of the next generation of Web based computing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-9171870479079748642?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/9171870479079748642/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=9171870479079748642' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/9171870479079748642'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/9171870479079748642'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/03/role-of-representational-state-transfer.html' title='The role of Representational State Transfer in Web Based computing'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-1360584267459376014</id><published>2007-03-02T19:26:00.000+04:00</published><updated>2007-04-26T07:46:27.711+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Running a class not in the classpath</title><content type='html'>This piece of code displays the invocation of a class not in the classpath of the application. This can be used to write utilities.&lt;br /&gt;&lt;br /&gt;Say I have a jar file present on my system in say a directory "c:/MyUtils" (I have used windows locations, no reason why this should not work on any other OS) named SystemUtils.jar which has a main class in a class com.sash.DoIt. This jar is not in my classpath and I need to execute it. The following piece of code executes the main method.&lt;br&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt; File file = new File("c:\\MyUtils\\SystemUtils.jar");&lt;br /&gt; ClassLoader cl = new URLClassLoader(new URL[] { file.toURI().toURL()});&lt;br /&gt; Class cls = cl.loadClass("com.sash.DoIt");&lt;br /&gt; Method mainMethod = cls.getDeclaredMethod("main", new Class[]{String[].class});&lt;br /&gt; mainMethod.invoke(null, new Object[]{null});&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Very interesting stuff. Never used it but waiting for the first oppertunity to use this in one of my projects :).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-1360584267459376014?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/1360584267459376014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=1360584267459376014' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/1360584267459376014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/1360584267459376014'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/03/running-class-not-in-classpath.html' title='Running a class not in the classpath'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-668786590564413391</id><published>2007-02-27T08:08:00.000+04:00</published><updated>2007-04-26T07:42:25.078+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Mustang released</title><content type='html'>The announcement made here is pretty old. It’s been in beta phase for some time and the final release has also been made some time back. Here I visit some of the new features in Mustang. I have been using Eclipse as a preferred java editor for a long time, though I've tried NetBeans, JDeveloper etc. Eclipse 3.2 has support for Mustang.&lt;br /&gt;The feature I would talk about is the Scripting feature. This feature can be used to execute scripts in various languages. Mustang ships with the Rhino scripting engine for JavaScript. Its pretty interesting. I tried out various features of the Rhino Engine.&lt;br /&gt;&lt;p&gt;The major questions which I wanted an answer to were:&lt;br /&gt;1. How to share data between Java and JavaScript?&lt;br /&gt;2. Where is the utility of such scripting?&lt;br /&gt;3. Can I add different Scripting engines?&lt;/p&gt;&lt;p&gt;&lt;br /&gt;The answer to the first question you can find in the example below. The sending of data from Java to Javascript was very simple and it even JavaScript recognized objects from user created classes (Java Car class has an object on which getName method could be invoked by the JavaScript). The return value also works. The List created in Java and modified in JS reflected in Java again. Awesome! Totally awesome!&lt;br /&gt;Now the reasons given to use scripting language was what I am not convinced with.(Scripting for the Java Platform --&gt; Reasons to Use a Scripting Language). I think the reasons to use scripting would be more specific, like using existing test scripts in some scripting language.&lt;br /&gt;We can add different scripting engines according to specs.&lt;/p&gt;Sample code explaining most of the concepts:-&lt;br/&gt;&lt;div class="codewrap"&gt;&lt;pre&gt;import java.lang.reflect.Method;&lt;br /&gt;&lt;br /&gt;import java.util.ArrayList;&lt;br /&gt;import java.util.Arrays;&lt;br /&gt;import java.util.List;&lt;br /&gt;&lt;br /&gt;import javax.script.Invocable;&lt;br /&gt;import javax.script.ScriptEngine;&lt;br /&gt;import javax.script.ScriptEngineManager;&lt;br /&gt;import javax.script.ScriptException;&lt;br /&gt;&lt;br /&gt;public class TheScript&lt;br /&gt;{&lt;br /&gt;    private final static String METHOD_HELLO = "function helloWorld(){"&lt;br /&gt;            + " println('Hello, world!'); " + " return 's';" + "}";&lt;br /&gt;&lt;br /&gt;    private final static String METHOD_HELLO_NAME = "function helloName(){"&lt;br /&gt;            + " println('Hello,'+ name.getName() +' !'); " + " return 's';"&lt;br /&gt;            + "}";&lt;br /&gt;&lt;br /&gt;    private final static String METHOD_HELLO_LIST = "function helloList(){"&lt;br /&gt;            + "var x;" + "var names = namesListKey.toArray(); "&lt;br /&gt;            + " for(x in names)" + " {" + " println('Hello,'+ names[x] +' !');"&lt;br /&gt;            + " }" + " namesListKey.add(\"king\");" + "}";&lt;br /&gt;&lt;br /&gt;    private final static String THE_JAVA_SCRIPT = METHOD_HELLO&lt;br /&gt;            + METHOD_HELLO_NAME + METHOD_HELLO_LIST;&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args) throws ScriptException,&lt;br /&gt;            NoSuchMethodException&lt;br /&gt;    {&lt;br /&gt;        ScriptEngineManager mgr = new ScriptEngineManager();&lt;br /&gt;        ScriptEngine jsEngine = mgr.getEngineByName("JavaScript");&lt;br /&gt;        jsEngine.eval(TheScript.THE_JAVA_SCRIPT);&lt;br /&gt;&lt;br /&gt;        // simple java method&lt;br /&gt;&lt;br /&gt;        // invoke method METHOD_HELLO&lt;br /&gt;        Invocable invocableEngine = (Invocable) jsEngine;&lt;br /&gt;        invocableEngine.invokeFunction("helloWorld", (Object[]) null);&lt;br /&gt;&lt;br /&gt;        System.out.println("---------------------------------");&lt;br /&gt;        // simple java method where java objects are used by javascript&lt;br /&gt;&lt;br /&gt;        // The parameter type is user defined object&lt;br /&gt;        // which is converted into a javascript object&lt;br /&gt;        // i.e I can use getName method of Car class&lt;br /&gt;        Car car = new Car();&lt;br /&gt;        car.setName("Sash");&lt;br /&gt;&lt;br /&gt;        // invoke method METHOD_NAME&lt;br /&gt;        jsEngine.put("name", car);&lt;br /&gt;        Object invokeFunction = invocableEngine.invokeFunction("helloName",&lt;br /&gt;                (Object[]) null);&lt;br /&gt;&lt;br /&gt;        // the return type should have been mapped by script provider&lt;br /&gt;        // Mozilla Rhino provides the mapping for number and string types&lt;br /&gt;        System.out.println(" --------------------------------- "&lt;br /&gt;                + invokeFunction + " ----");&lt;br /&gt;&lt;br /&gt;        List namesList = new ArrayList(Arrays.asList(new String[] { "sash",&lt;br /&gt;                "siva", "baldie" }));&lt;br /&gt;        jsEngine.put("namesListKey", namesList);&lt;br /&gt;        invocableEngine.invokeFunction("helloList", (Object[]) null);&lt;br /&gt;&lt;br /&gt;        System.out.println(namesList);&lt;br /&gt;        System.out.println("---------------------------------");&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static class Car&lt;br /&gt;    {&lt;br /&gt;        private String name;&lt;br /&gt;&lt;br /&gt;        public String getName()&lt;br /&gt;        {&lt;br /&gt;            return name;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public void setName(String name)&lt;br /&gt;        {&lt;br /&gt;            this.name = name;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-size:130%;"&gt;References:&lt;/span&gt;&lt;/p&gt;&lt;a href="http://www.mozilla.org/rhino/ScriptingJava.html"&gt;http://www.mozilla.org/rhino/ScriptingJava.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/"&gt;http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-668786590564413391?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/668786590564413391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=668786590564413391' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/668786590564413391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/668786590564413391'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/02/mustang-released.html' title='Mustang released'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-5338167019942059470</id><published>2007-01-11T15:05:00.000+04:00</published><updated>2007-04-26T07:45:02.101+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Invoker class</title><content type='html'>For a long time I've been thinking how to write code to get the name of the calling class, some days back I was reading an article which arose my curiosity again. I was successful doing it in two ways.&lt;br /&gt;&lt;br /&gt;1. Stacktrace method&lt;br /&gt;&lt;br /&gt;One of the hints which I got was our exception class, whenever an exception is thrown we get the whole stack strace, which includes the invoking classes.&lt;div class="codewrap2"&gt;&lt;pre&gt;Throwable t = new Throwable(); &lt;br /&gt;StackTraceElement callerClass = t.getStackTrace()[1]; &lt;br /&gt;System.out.println(callerClass.getClassName());&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Gets the class name :)&lt;br /&gt;&lt;br /&gt;2. Security Manager method &lt;div class="codewrap2"&gt;&lt;pre&gt;&lt;br /&gt;class SM extends SecurityManager {     &lt;br /&gt;    @Override  &lt;br /&gt;    public Class[] getClassContext() {   &lt;br /&gt;        return super.getClassContext();  &lt;br /&gt;    } &lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="codewrap2"&gt;&lt;pre&gt;&lt;br /&gt;SM sm = new SM(); &lt;br /&gt;Class[] classContext = sm.getClassContext(); &lt;br /&gt;System.out.println(classContext[2].getName());&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Bingo, got the class name. getClassContext() is a protected method, to use it we need to extend security manager or use it as I've done above.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-5338167019942059470?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/5338167019942059470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=5338167019942059470' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/5338167019942059470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/5338167019942059470'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2007/01/invoker-class.html' title='Invoker class'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-8889153311301993625</id><published>2006-11-26T16:01:00.000+04:00</published><updated>2007-03-27T11:54:38.632+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><title type='text'>XML hints</title><content type='html'>These are some things needed to know about xml.....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Fact 1:&lt;/strong&gt;&lt;br /&gt;Comments should not have '--' in between.. This is a very common knowledge but what is not so common knowledge is that '---&gt;' is an invalid end of comment.&lt;br /&gt;ref:- &lt;a href="http://www.w3.org/TR/2004/REC-xml-20040204/#sec-comments"&gt;http://www.w3.org/TR/2004/REC-xml-20040204/#sec-comments&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Fact 2:&lt;/strong&gt;&lt;br /&gt;Do you know about dtd entities?&lt;br /&gt;&lt;br /&gt;&amp;lt;!ENTITY copyright SYSTEM "http://www.w3schools.com/dtd/entities.dtd"&amp;gt;&lt;br /&gt;&lt;br /&gt;You define a dtd entity and then it can be used in the dtd anywhere, its like a constant being declared.&lt;br /&gt;&lt;br /&gt;It can be used in xml as:-&lt;br /&gt;&lt;author&gt;&amp;lt;author&amp;gt;&amp;writer;©right;&amp;lt;/author&amp;gt;&lt;br /&gt;ref:- &lt;a href="http://www.w3schools.com/dtd/dtd_entities.asp"&gt;http://www.w3schools.com/dtd/dtd_entities.asp&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Fact 3&lt;/strong&gt;&lt;br /&gt;Now whats the difference between &lt;em&gt;a/b&lt;/em&gt; and a[b] in XPath?&lt;br /&gt;&lt;br /&gt;a/b selects the node b which is a child of node a.&lt;br /&gt;a[b] selects node a which has a child b.&lt;br /&gt;&lt;br /&gt;The difference is very subtile but the node selected is different.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Fact 4&lt;/strong&gt;&lt;br /&gt;What does the translate function in XSLT do:-&lt;br /&gt;translate("abcdef--","ab-","AB")&lt;br /&gt;&lt;br /&gt;will result in:-&lt;br /&gt;&lt;em&gt;ABcdef&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;ref:- &lt;a href="http://www.w3.org/TR/xpath#section-String-Functions"&gt;http://www.w3.org/TR/xpath#section-String-Functions&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Fact 5&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Stylesheet Inclusion&lt;/u&gt;&lt;br /&gt;It is an error if a stylesheet directly or indirectly includes itself.&lt;br /&gt;&lt;br /&gt;Including a stylesheet multiple times can cause errors because of duplicate definitions. Such multiple inclusions are less obvious when they are indirect. For example, if stylesheet B includes stylesheet A, stylesheet C includes stylesheet A, and stylesheet D includes both stylesheet B and stylesheet C, then A will be included indirectly by D twice. If all of B, C and D are used as independent stylesheets, then the error can be avoided by separating everything in B other than the inclusion of A into a separate stylesheet B' and changing B to contain just inclusions of B' and A, similarly for C, and then changing D to include A, B', C'.&lt;br /&gt;&lt;br /&gt;This can be tested by having templates of the same name in all the stylesheets and play around with importing the style sheets. Thus u'll notice&lt;br /&gt;1. the curent style sheet takes the precidence&lt;br /&gt;2. if more than one stylesheets are included then the last one imported takes precidence.&lt;br /&gt;&lt;br /&gt;ref:- &lt;a href="http://www.w3.org/TR/xslt#import"&gt;http://www.w3.org/TR/xslt#import&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-8889153311301993625?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/8889153311301993625/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=8889153311301993625' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/8889153311301993625'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/8889153311301993625'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2006/11/xml-hints.html' title='XML hints'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8373228118181038400.post-2121774309529320217</id><published>2006-11-26T10:14:00.000+04:00</published><updated>2007-03-27T11:54:54.304+04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Others'/><title type='text'>The start</title><content type='html'>I created the blog to talk about the technologies and other things I work in. I have worked on some technologies and languages that include EJB, java, Delphi, Struts, Hibernate, Spring, Ajax, Web Services, SOA. I have a little understanding on C#. Right now I am working on SOA and related technologies, thus most of the blogs I put will be related to XML, Web Services, BPEL or the ESBs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8373228118181038400-2121774309529320217?l=tech-sash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-sash.blogspot.com/feeds/2121774309529320217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8373228118181038400&amp;postID=2121774309529320217' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/2121774309529320217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8373228118181038400/posts/default/2121774309529320217'/><link rel='alternate' type='text/html' href='http://tech-sash.blogspot.com/2006/11/start.html' title='The start'/><author><name>sash</name><uri>http://www.blogger.com/profile/10052939467769602871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_xWUcYX5ldbA/SDF3TUGgjuI/AAAAAAAABfI/ae2c4ZGop1c/S220/IMG_5173.JPG'/></author><thr:total>0</thr:total></entry></feed>
