<?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:blogger='http://schemas.google.com/blogger/2008' 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-18481069</id><updated>2026-05-08T21:59:01.865+09:30</updated><category term="Java"/><category term="WSO2"/><category term="OpenSource"/><category term="Maven"/><category term="Spring"/><category term="XML"/><category term="AppEngine"/><category term="Eclipse"/><category term="Microservices"/><category term="XSLT"/><category term="WSO2 Governance Registry"/><category term="Android"/><category term="Huawei E220"/><category term="OSGi"/><category term="Solr"/><category term="Data Mining"/><category term="Free"/><category term="NetBeans"/><category term="SVN"/><category term="Sun"/><title type='text'>Chandana Napagoda&#39;s Blog</title><subtitle type='html'>Chandana Napagoda&#39;s Web Blog</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://blog.napagoda.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default?start-index=26&amp;max-results=25'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>111</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-18481069.post-878538141094290743</id><published>2025-04-08T22:52:00.003+09:30</published><updated>2025-04-08T22:52:43.178+09:30</updated><title type='text'>Kafka - A Quick and Simple Guide</title><content type='html'>&lt;div&gt;&lt;b&gt;&lt;u&gt;Introduction&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Apache Kafka is a distributed event streaming platform. Originally developed at LinkedIn, it is now an open-source project under the Apache Software Foundation. Kafka is widely used for building real-time data pipelines and streaming applications.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;u&gt;What is Apache Kafka?&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Kafka is a messaging system that lets applications publish (write), subscribe (read), store, and process streams of data in real-time.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;u&gt;Kafka Core Concepts&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;1. Producers and Consumers&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;Producers → Send data to Kafka topics.&lt;/li&gt;&lt;li&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;Consumers → Read data from Kafka topics.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2. Topics and Partitions&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Topic → Logical channel for a specific type of data.&lt;/li&gt;&lt;li&gt;Partition → Topics are split into partitions for scalability. Each partition stores data in order.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;3. Brokers and Cluster&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Broker → Kafka server that stores data.&lt;/li&gt;&lt;li&gt;Cluster → Group of brokers working together.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;4. Zookeeper&lt;/div&gt;&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;Kafka uses Zookeeper to manage broker metadata and coordination tasks.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;Note: Newer Kafka versions can run without Zookeeper (&lt;a href=&quot;https://developer.confluent.io/learn/kraft/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;KRaft &lt;/a&gt;mode).&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;5.&amp;nbsp;Replication Factor&lt;br /&gt;&amp;nbsp; &amp;nbsp;This provides&amp;nbsp;fault tolerance and state how many copies of each partition exist across brokers. as example if replication factor is 3, that mean partition will kept inside leader and 2 brokers&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;6.&amp;nbsp;Partition Rebalancing&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;When consumer join or leave a consumer group,&amp;nbsp;Kafka will triggers a rebalance to redistribute partitions among the available consumers. This will ensure load balancing, but it may temporarily stop message processing&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;&lt;u&gt;How Kafka Stores Data&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Kafka stores data in logs → sequence of records per partition. Logs are divided into segments (files on disk).&amp;nbsp;This helps manage data efficiently and allows old data to be deleted to free up space.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Each record has a unique offset.&amp;nbsp;Kafka assigns each record an offset as it is produced, which consumers use to read records in order.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Data can be replicated to multiple brokers for fault tolerance. Each partition has one leader broker and several replica brokers. The leader handles all reads and writes, while followers replicate the data.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;u&gt;Ensuring No Duplicate Messages&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Idempotent Producers :&amp;nbsp;Enable it by setting&amp;nbsp;enable.idempotence=true we can&amp;nbsp;ensures the same message is not written more than once even if retries happen.&lt;br /&gt;&lt;br /&gt;Exactly Once Semantics (EOS) :&amp;nbsp;Use transactional.id on producers and manage offsets manually in consumers(commit offsets only after processing the record).&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Consumer Offset Management : By disabling auto-commit (enable.auto.commit=false) and committing offsets explicitly after successful processing.&amp;nbsp;This will ensures at least once delivery. Combine with Idempotent processing logic for effectively once delivery.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;How Kafka Handles Multiple Consumers the Same Group ID&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Kafka uses consumer groups to allow multiple consumers to divide the work.&amp;nbsp;Each consumer in the group reads from a unique subset of partitions. They share partitions of a topic.&amp;nbsp;Kafka ensures only one consumer from a group reads a partition at a time.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Consumers in different consumer groups read the same data independently&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;u&gt;How long does Kafka store data?&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;By Default, it&#39;s&amp;nbsp;time-based retention (retention.ms=604800000), but this can change to size-based retention(retention.bytes) or forever (log.retention.ms = -1)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/878538141094290743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2025/04/kafka-quick-and-simple-guide.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/878538141094290743'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/878538141094290743'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2025/04/kafka-quick-and-simple-guide.html' title='Kafka - A Quick and Simple Guide'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-1178887995509629478</id><published>2024-07-03T11:41:00.000+09:30</published><updated>2024-07-03T11:41:00.243+09:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="XML"/><category scheme="http://www.blogger.com/atom/ns#" term="XSLT"/><title type='text'>XSLT Date and Time Manipulation</title><content type='html'>&lt;p&gt;In XSLT (Extensible Stylesheet Language Transformations) 2.0 or later, we can perform several date and time manipulation processes. I thought of writing a blog post so others can easily find examples as well.&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;u&gt;Basic Date &amp;amp; Time XSLT Functions:&amp;nbsp;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;current-date()&lt;/b&gt; -&amp;nbsp;Returns the current date of the server that XSLT runs&lt;/p&gt;&lt;p&gt;&lt;b&gt;current-time()&lt;/b&gt; -&amp;nbsp;Returns the current time of the server that XSLT runs&lt;/p&gt;&lt;p&gt;&lt;b&gt;current-dateTime()&lt;/b&gt; -&amp;nbsp;Returns the current date and time of the server that XSLT runs&lt;/p&gt;&lt;p&gt;&lt;b&gt;implicit-timezone()&lt;/b&gt; -&amp;nbsp;Returns the implicit time zone of the server that XSLT runs&lt;/p&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;stylesheet&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;xmlns&lt;/span&gt;:&lt;span style=&quot;color: #9cdcfe;&quot;&gt;xsl&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;http://www.w3.org/1999/XSL/Transform&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;xmlns&lt;/span&gt;:&lt;span style=&quot;color: #9cdcfe;&quot;&gt;xs&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;http://www.w3.org/2001/XMLSchema&quot;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;version&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;2.0&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;template&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;match&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;root&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;currentDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;current-date()&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;currentDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;currentTime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;current-time()&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;currentTime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;currentdateTime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;current-dateTime()&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;currentdateTime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;implicitTimezone&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;implicit-timezone()&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;implicitTimezone&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;root&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;template&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;stylesheet&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;&lt;u&gt;Date &amp;amp; Time Extracting XSLT Function:&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;year-from-date()&lt;/b&gt; - Extracts the year from a date.&lt;/p&gt;&lt;p&gt;&lt;b&gt;month-from-date()&lt;/b&gt; - Extracts the month from a date.&lt;/p&gt;&lt;p&gt;&lt;b&gt;day-from-date()&lt;/b&gt; - Extracts the day from a date.&lt;/p&gt;&lt;p&gt;&lt;b&gt;hours-from-time()&lt;/b&gt; - Extracts the hours from a time.&lt;/p&gt;&lt;p&gt;&lt;b&gt;minutes-from-time()&lt;/b&gt; - Extracts the minutes from a time.&lt;/p&gt;&lt;p&gt;&lt;b&gt;seconds-from-time()&lt;/b&gt; - Extracts the seconds from a time.&lt;/p&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;stylesheet&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;xmlns&lt;/span&gt;:&lt;span style=&quot;color: #9cdcfe;&quot;&gt;xsl&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;http://www.w3.org/1999/XSL/Transform&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;xmlns&lt;/span&gt;:&lt;span style=&quot;color: #9cdcfe;&quot;&gt;xs&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;http://www.w3.org/2001/XMLSchema&quot;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;version&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;2.0&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;template&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;match&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;root&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;year&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;year-from-date(current-date())&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;year&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;month&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;month-from-date(current-date())&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;month&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;day&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;day-from-date(current-date())&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;day&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;hours&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;hours-from-time(current-time())&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;hours&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;minutes&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;minutes-from-time(current-time())&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;minutes&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;seconds&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;seconds-from-time(current-time())&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;seconds&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;root&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;template&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;stylesheet&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;u&gt;Date and Time Manipulation Functions:&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Please note&amp;nbsp;Saxon doesn&#39;t supports &lt;b&gt;add-yearMonthDuration-to-date&lt;/b&gt; and other related 3 operations. So here is my workaround to manipulate dates.&amp;nbsp; Please refer my &lt;a href=&quot;https://blog.napagoda.com/2019/01/xslt-modify-date-and-datetime-value.html&quot;&gt;old blog post&lt;/a&gt; on this&lt;/p&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;stylesheet&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;xmlns&lt;/span&gt;:&lt;span style=&quot;color: #9cdcfe;&quot;&gt;xsl&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;http://www.w3.org/1999/XSL/Transform&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;xmlns&lt;/span&gt;:&lt;span style=&quot;color: #9cdcfe;&quot;&gt;xs&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;http://www.w3.org/2001/XMLSchema&quot;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;version&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;2.0&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;template&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;match&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;root&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;add-yearMonthDuration-to-date&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;current-dateTime() + xs:yearMonthDuration(&#39;P1Y6M&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;lt;!-- Add 1 year and 6 months --&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;add-yearMonthDuration-to-date&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;add-dayTimeDuration-to-date&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;current-dateTime() + xs:dayTimeDuration(&#39;P10DT2H&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;lt;!-- Add 10 days and 2 hours --&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;add-dayTimeDuration-to-date&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;subtract-yearMonthDuration-from-date&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;current-dateTime() + xs:yearMonthDuration(&#39;-P1Y6M&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;lt;!-- Subtract 1 year and 6 months --&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;subtract-yearMonthDuration-from-date&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;subtract-dayTimeDuration-from-date&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;current-dateTime() + xs:dayTimeDuration(&#39;-P10DT2H&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;lt;!-- Subtract 10 days and 2 hours --&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;subtract-dayTimeDuration-from-date&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;root&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;template&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;stylesheet&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;&lt;u&gt;String Format Conversion Functions:&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;format-date()&lt;/b&gt; - Formats a date according to a given pattern.&lt;/p&gt;&lt;p&gt;&lt;b&gt;format-time()&lt;/b&gt; - Formats a time according to a given pattern.&lt;/p&gt;&lt;p&gt;&lt;b&gt;format-dateTime()&lt;/b&gt; - Formats a date time according to a given pattern.&lt;/p&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;stylesheet&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;xmlns&lt;/span&gt;:&lt;span style=&quot;color: #9cdcfe;&quot;&gt;xsl&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;http://www.w3.org/1999/XSL/Transform&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;xmlns&lt;/span&gt;:&lt;span style=&quot;color: #9cdcfe;&quot;&gt;xs&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;http://www.w3.org/2001/XMLSchema&quot;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;version&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;2.0&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;template&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;match&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;root&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;formattedDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;format-date(current-date(), &#39;[Y0001]-[M01]-[D01]&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;formattedDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;formattedTime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;format-time(current-time(), &#39;[H01]:[m01]:[s01]&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;formattedTime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;formattedDateTime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;format-dateTime(current-dateTime(), &#39;[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01]&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;formattedDateTime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;root&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;template&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;stylesheet&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;&lt;u&gt;Compare Dates :&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;When comparing dates with XSLT 2.0 or later, we can use default XSLT comparison operations such as &#39;lt&#39; (less than), &#39;gt&#39; (greater than), etc.&lt;/p&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;stylesheet&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;xmlns&lt;/span&gt;:&lt;span style=&quot;color: #9cdcfe;&quot;&gt;xsl&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;http://www.w3.org/1999/XSL/Transform&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;xmlns&lt;/span&gt;:&lt;span style=&quot;color: #9cdcfe;&quot;&gt;xs&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;http://www.w3.org/2001/XMLSchema&quot;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;version&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;2.0&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;template&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;match&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;root&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dateCompareLessThan&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;current-date() lt (current-date() + xs:yearMonthDuration(&#39;P1M&#39;))&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dateCompareLessThan&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dateCompareNotLessThan&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;(current-date() + xs:dayTimeDuration(&#39;P1D&#39;)) lt current-date() &quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dateCompareNotLessThan&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dateCompareGreaterThan&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;value-of&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;select&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;current-date() gt (current-date() - xs:dayTimeDuration(&#39;P1D&#39;))&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dateCompareGreaterThan&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;root&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;template&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xsl&lt;/span&gt;:&lt;span style=&quot;color: #569cd6;&quot;&gt;stylesheet&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can use an online XSLT playground such as &lt;a href=&quot;https://xslttest.appspot.com/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;xslttest &lt;/a&gt;to verify the examples listed above.&lt;/div&gt;&lt;b&gt;&lt;i&gt;&lt;span style=&quot;font-family: courier; font-size: x-small;&quot;&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;&lt;span style=&quot;font-family: courier; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;Please refrain from copying content to other websites&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/1178887995509629478/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2024/07/xslt-date-and-time-manipulation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/1178887995509629478'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/1178887995509629478'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2024/07/xslt-date-and-time-manipulation.html' title='XSLT Date and Time Manipulation'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-3475978310274080322</id><published>2024-06-28T18:00:00.002+09:30</published><updated>2024-07-01T09:31:32.225+09:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Microservices"/><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>Global Exception Handling With Spring Boot</title><content type='html'>&lt;p&gt;&lt;br /&gt;In a Spring Boot controller, things can sometimes go wrong. For example, an API consumer might not send the expected path parameter or header value. They might call the API with an invalid payload or encounter an unexpected runtime error. When these kinds of errors occur, we can use Spring Boot&#39;s Global Exception Handling mechanism to manage them and provide meaningful responses back to the API consumer.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;@ExceptionHandler&lt;/b&gt; is used to handle exceptions in specific controllers classes and/or methods level. In a Spring Boot Restful service, errors can be handled in three different ways:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Using ControllerAdvice -&amp;nbsp;This annotation allows global(central) exception handling across multiple controllers.&lt;/li&gt;&lt;li&gt;Using @ExceptionHandler at each controller level -&amp;nbsp;For more granular control&lt;/li&gt;&lt;li&gt;Returning ResponseEntity with the appropriate status code&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;In this post, I will explain how to implement Global Exception Handling in a Spring Boot RESTful service. To engage Spring Boot&#39;s Global Exception Handling (&lt;b&gt;@ControllerAdvice&lt;/b&gt; or &lt;b&gt;@RestControllerAdvice&lt;/b&gt;), you first need to create a class annotated with @ControllerAdvice that will handle exceptions. If you have multiple controllers or HTTP method mappings, this @ControllerAdvice class will be shared across all operations.&amp;nbsp;@RestControllerAdvice is a specialised version of ControllerAdvice annotation to handling methods which are return JSON responses and which is ideal for restful APIs.&lt;/p&gt;&lt;p&gt;I will continue to use the controller example provided in the &lt;a href=&quot;https://blog.napagoda.com/2024/06/important-spring-boot-rest-key-annotations.html&quot; target=&quot;_blank&quot;&gt;Spring Boot Key Annotations&lt;/a&gt; post. With the @RestControllerAdvice&amp;nbsp;class-level annotation, we need to capture each exception with a method defined with the @ExceptionHandler annotation.&lt;/p&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;package&lt;/span&gt; com.chandana.helloworld.exception;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.http.&lt;span style=&quot;color: #b8d7a3;&quot;&gt;HttpStatus&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.http.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseEntity&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;MethodArgumentNotValidException&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;MissingRequestHeaderException&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;MissingServletRequestParameterException&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ExceptionHandler&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseStatus&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RestControllerAdvice&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.servlet.resource.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;NoResourceFoundException&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;/**&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;@author&lt;/span&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt; Chandana Napagoda&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RestControllerAdvice&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;GlobalExceptionHandler&lt;/span&gt; {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ExceptionHandler&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;MethodArgumentNotValidException&lt;/span&gt;.&lt;span style=&quot;color: #c586c0;&quot;&gt;class&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseStatus&lt;/span&gt;(&lt;span style=&quot;color: #b8d7a3;&quot;&gt;HttpStatus&lt;/span&gt;.BAD_REQUEST)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ErrorResponse&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;handleValidationExceptions&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;MethodArgumentNotValidException&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ex&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;ErrorResponse&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;errorResponse&lt;/span&gt; = &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ErrorResponse&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Invalid input&quot;&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ex&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;getMessage&lt;/span&gt;());&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&amp;gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;errorResponse&lt;/span&gt;, &lt;span style=&quot;color: #b8d7a3;&quot;&gt;HttpStatus&lt;/span&gt;.BAD_REQUEST);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ExceptionHandler&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;MissingServletRequestParameterException&lt;/span&gt;.&lt;span style=&quot;color: #c586c0;&quot;&gt;class&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseStatus&lt;/span&gt;(&lt;span style=&quot;color: #b8d7a3;&quot;&gt;HttpStatus&lt;/span&gt;.BAD_REQUEST)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ErrorResponse&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;handleMissingParams&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;MissingServletRequestParameterException&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ex&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;ErrorResponse&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;errorResponse&lt;/span&gt; = &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ErrorResponse&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Missing parameter&quot;&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ex&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;getParameterName&lt;/span&gt;());&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&amp;gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;errorResponse&lt;/span&gt;, &lt;span style=&quot;color: #b8d7a3;&quot;&gt;HttpStatus&lt;/span&gt;.BAD_REQUEST);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ExceptionHandler&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;MissingRequestHeaderException&lt;/span&gt;.&lt;span style=&quot;color: #c586c0;&quot;&gt;class&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseStatus&lt;/span&gt;(&lt;span style=&quot;color: #b8d7a3;&quot;&gt;HttpStatus&lt;/span&gt;.BAD_REQUEST)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ErrorResponse&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;handleMissingHeaders&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;MissingRequestHeaderException&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ex&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;ErrorResponse&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;errorResponse&lt;/span&gt; = &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ErrorResponse&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Missing header&quot;&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ex&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;getHeaderName&lt;/span&gt;());&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&amp;gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;errorResponse&lt;/span&gt;, &lt;span style=&quot;color: #b8d7a3;&quot;&gt;HttpStatus&lt;/span&gt;.BAD_REQUEST);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ExceptionHandler&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;NoResourceFoundException&lt;/span&gt;.&lt;span style=&quot;color: #c586c0;&quot;&gt;class&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseStatus&lt;/span&gt;(&lt;span style=&quot;color: #b8d7a3;&quot;&gt;HttpStatus&lt;/span&gt;.NOT_FOUND)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ErrorResponse&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;handleInvalidControllers&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;NoResourceFoundException&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ex&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;ErrorResponse&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;errorResponse&lt;/span&gt; = &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ErrorResponse&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Resource not found&quot;&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ex&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;getResourcePath&lt;/span&gt;());&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&amp;gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;errorResponse&lt;/span&gt;, &lt;span style=&quot;color: #b8d7a3;&quot;&gt;HttpStatus&lt;/span&gt;.BAD_REQUEST);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ExceptionHandler&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Exception&lt;/span&gt;.&lt;span style=&quot;color: #c586c0;&quot;&gt;class&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseStatus&lt;/span&gt;(&lt;span style=&quot;color: #b8d7a3;&quot;&gt;HttpStatus&lt;/span&gt;.INTERNAL_SERVER_ERROR)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ErrorResponse&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;handleAllOtherExceptions&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Exception&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ex&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;ErrorResponse&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;errorResponse&lt;/span&gt; = &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ErrorResponse&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;An error occurred&quot;&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ex&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;getMessage&lt;/span&gt;());&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&amp;gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;errorResponse&lt;/span&gt;, &lt;span style=&quot;color: #b8d7a3;&quot;&gt;HttpStatus&lt;/span&gt;.INTERNAL_SERVER_ERROR);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;@RestControllerAdvice&lt;/b&gt;&amp;nbsp;- A class level annotation used to&amp;nbsp;define a global exception handler for entire Spring Boot application. &lt;i&gt;&lt;b&gt;Also it&#39;s converts handler response into JSON format.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;&lt;p&gt;@ControllerAdvice - A class level annotation used to define a global exception handler for entire Spring Boot application.&lt;/p&gt;&lt;p&gt;&lt;b&gt;@ExceptionHandler&lt;/b&gt; - This is a method level annotation used within the @ControllerAdvice class to specify the type of exception that method handles.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Below are a few API responses before and after introducing Controller Advice.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyFDfL0xBHbDp0qQ8dkXyqJ5KRBot_UkZER7PvxD1tLcGvHdO1ROza3rvFvTCg9VjP7wG_NsZ_ltrW5ORZMkScdHYbf7HxSOcoYI0ygIX99INNBK3S2Dbrxs5h_6uo5yn_pBtz821E6nRPKFGGSOeuSp7WDf3-XK3KRBWrjrtdplNCcUYXMnPLhg/s1314/Bad%20Req.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;Bad Request Response before and after Global Exception Handler&quot; border=&quot;0&quot; data-original-height=&quot;415&quot; data-original-width=&quot;1314&quot; height=&quot;195&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyFDfL0xBHbDp0qQ8dkXyqJ5KRBot_UkZER7PvxD1tLcGvHdO1ROza3rvFvTCg9VjP7wG_NsZ_ltrW5ORZMkScdHYbf7HxSOcoYI0ygIX99INNBK3S2Dbrxs5h_6uo5yn_pBtz821E6nRPKFGGSOeuSp7WDf3-XK3KRBWrjrtdplNCcUYXMnPLhg/w615-h195/Bad%20Req.png&quot; title=&quot;Bad Request Response before and after Global Exception Handler&quot; width=&quot;615&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Bad Request Error&lt;br /&gt;&lt;br /&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgolimSTODz6MHF5m68BmgtEsdzA2Xqpn9IaTO3M3FHKlotMmBsMna5QQU3jUJ7_BFHF7cmf4lIUke3sK-RY7Qe1i_0PcmrMESvKMiyissnej1FFKmyqP0CEUwHfe6aayscEJ31FIlWlW3PIi8f0810MZ-HcvFeldFjWhmO1LTEOHhzkoXAD1ZdCw/s1314/Not%20Found.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Resource Not Found with and without ControllerAdvice&quot; border=&quot;0&quot; data-original-height=&quot;487&quot; data-original-width=&quot;1314&quot; height=&quot;236&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgolimSTODz6MHF5m68BmgtEsdzA2Xqpn9IaTO3M3FHKlotMmBsMna5QQU3jUJ7_BFHF7cmf4lIUke3sK-RY7Qe1i_0PcmrMESvKMiyissnej1FFKmyqP0CEUwHfe6aayscEJ31FIlWlW3PIi8f0810MZ-HcvFeldFjWhmO1LTEOHhzkoXAD1ZdCw/w633-h236/Not%20Found.png&quot; title=&quot;Resource Not Found with and without ControllerAdvice&quot; width=&quot;633&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Resource Not Found&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div&gt;In addition to your own custom exceptions, Java standard exceptions, database exceptions, security exceptions, and file handling exceptions, these are all the&amp;nbsp;&lt;a href=&quot;https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/ErrorResponse.html&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;known exception implementations&lt;/a&gt;&amp;nbsp;exposed by the Spring Framework.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;As a conclusion, by implementing @ControllerAdvice/@RestControllerAdvice in our Spring Boot application, we can easily manage and centralise exception handling across all controllers. Overall this will improve code maintainability and provide better error handling in API level.&amp;nbsp;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;p&gt;&lt;/p&gt;&lt;b style=&quot;font-family: courier; font-size: small;&quot;&gt;&lt;i&gt;Please refrain from copying content to other websites. You can download the&amp;nbsp;&lt;a href=&quot;https://github.com/cnapagoda/spring-boot-exception&quot; target=&quot;_blank&quot;&gt;Swagger Spring Boot Global Exception Handling Project&lt;/a&gt;&amp;nbsp;source code from my GitHub repository.&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/3475978310274080322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2024/06/spring-boot-global-exception-handler.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/3475978310274080322'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/3475978310274080322'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2024/06/spring-boot-global-exception-handler.html' title='Global Exception Handling With Spring Boot'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyFDfL0xBHbDp0qQ8dkXyqJ5KRBot_UkZER7PvxD1tLcGvHdO1ROza3rvFvTCg9VjP7wG_NsZ_ltrW5ORZMkScdHYbf7HxSOcoYI0ygIX99INNBK3S2Dbrxs5h_6uo5yn_pBtz821E6nRPKFGGSOeuSp7WDf3-XK3KRBWrjrtdplNCcUYXMnPLhg/s72-w615-h195-c/Bad%20Req.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-1771873817894681811</id><published>2024-06-26T19:11:00.001+09:30</published><updated>2024-06-26T19:11:00.109+09:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>Spring Boot Key Annotations With Examples</title><content type='html'>&lt;p&gt;&amp;nbsp;When developing a RESTful service (REST API) using Spring Boot, need to have clear understanding of some of the annotations provided by Spring Boot Web.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;@RestController&lt;/b&gt; - RestController is&amp;nbsp;class level annotation used to define a class as a rest full service and it also combines @Controller and @ResponseBody annotations. So the response object is automatically serialised into JSON format.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;@RequestMapping&lt;/b&gt; -&amp;nbsp;RequestMapping is used to map web requests to a specific controller or method. For RESTful services, the RequestMapping annotation is typically used at the class level, with HTTP method-specific annotations used at the method level.&lt;/p&gt;&lt;p&gt;&lt;b&gt;@GetMapping, @PostMapping, @PutMapping, @DeleteMapping @PatchMapping&lt;/b&gt;-&amp;nbsp;These are specialised versions of the @RequestMapping annotation. they are mostly used at the method level to map HTTP methods. These annotations improve code readability and maintainability&amp;nbsp;as well.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;b&gt;@PathVariable&lt;/b&gt; -&amp;nbsp;PathVariable annotation is used to extract values from URL templates ( ex: hello/{name})&lt;/p&gt;&lt;p&gt;&lt;b&gt;@RequestParam&lt;/b&gt; - RequestParam&amp;nbsp;annotation is used to extract query parameters from the URL&lt;/p&gt;&lt;p&gt;&lt;b&gt;@RequestHeader&lt;/b&gt; - RequestHeader&amp;nbsp;annotation is used to extract HTTP request headers from an incoming request&lt;/p&gt;&lt;p&gt;&lt;b&gt;@RequestBody&lt;/b&gt; -&amp;nbsp; RequestBody&amp;nbsp;annotation is used to extract the HTTP request body and pass it to the controller method. This can be used with HTTP methods that support a request body&amp;nbsp;(Ex: POST, PUT, Etc)&lt;/p&gt;&lt;p&gt;&lt;b&gt;@ResponseStatus&lt;/b&gt; - ResponseStatus annotation is used when we need to pass a different HTTP status other than 200 - OK or map custom exception classes to specific HTTP status codes.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Example Code :&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;package&lt;/span&gt; com.chandana.helloworld;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.http.&lt;span style=&quot;color: #b8d7a3;&quot;&gt;HttpStatus&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;GetMapping&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PathVariable&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PostMapping&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestBody&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestHeader&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestMapping&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestParam&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseStatus&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RestController&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RestController&lt;/span&gt;&lt;/div&gt;&lt;div&gt;@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/api/greetings&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;HelloWorldController&lt;/span&gt; {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #6a9955;&quot;&gt;//GetMapping. Send GET requests to /api/greetings&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;GetMapping&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;sayHello&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Hello, World!&quot;&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #6a9955;&quot;&gt;//Read PathVariable. Send GET requests to /api/greetings/{name}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;GetMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/{name}&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;sayHelloToName&lt;/span&gt;(@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PathVariable&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Hello, &quot;&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt; + &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;!&quot;&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #6a9955;&quot;&gt;//Read RequestBody. Send POST requests to /api/greetings&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PostMapping&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;greetWithPost&lt;/span&gt;(@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestBody&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Greetings, &quot;&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt; + &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;!&quot;&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #6a9955;&quot;&gt;// Read RequestParam. Send GET requests to /api/greetings/query?name=ChandanaNapagoda&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;GetMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/query&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;greetWithRequestParam&lt;/span&gt;(@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestParam&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Hello there, &quot;&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt; + &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;!&quot;&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #6a9955;&quot;&gt;// Read RequestHeader. Send a request to /api/greetings/header&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;GetMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/header&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;greetWithHeader&lt;/span&gt;(@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestHeader&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;X-Name&quot;&lt;/span&gt;) &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Welcome, &quot;&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt; + &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;!&quot;&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #6a9955;&quot;&gt;// Custom HTTP response status for POST requests to /api/greetings/create&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PostMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/create&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseStatus&lt;/span&gt;(&lt;span style=&quot;color: #b8d7a3;&quot;&gt;HttpStatus&lt;/span&gt;.CREATED)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;createGreeting&lt;/span&gt;(@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestBody&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Created greeting for &quot;&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;i&gt;&lt;b&gt;&lt;span style=&quot;font-family: courier; font-size: x-small;&quot;&gt;Please refrain from copying content to other websites&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/1771873817894681811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2024/06/important-spring-boot-rest-key-annotations.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/1771873817894681811'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/1771873817894681811'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2024/06/important-spring-boot-rest-key-annotations.html' title='Spring Boot Key Annotations With Examples'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total><georss:featurename>Adelaide SA, Australia</georss:featurename><georss:point>-34.9284989 138.6007456</georss:point><georss:box>-62.388114628783 103.44449560000001 -7.4688831712170014 173.7569956</georss:box></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-4047360125916280454</id><published>2024-06-22T19:47:00.003+09:30</published><updated>2024-06-30T12:04:08.561+09:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Maven"/><category scheme="http://www.blogger.com/atom/ns#" term="Microservices"/><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>Integrate Swagger 3 with Spring Boot Rest API</title><content type='html'>&lt;p&gt;&lt;b&gt;&amp;nbsp;What is Swagger:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Swagger (now known as OpenAPI) is a specification for describing and documenting a REST API. It specifies the format of the REST web services including URL, resources, methods, etc. Swagger generates documentation from the application code and handles the rendering part as well.&lt;/p&gt;&lt;p&gt;In this post, I will integrate Swagger 3 documentation into a Spring Boot 3 based REST web service using Spring Doc OpenAPI. If you need guidance on &lt;a href=&quot;https://blog.napagoda.com/2024/06/building-restful-service-spring-boot-3.html&quot; target=&quot;_blank&quot;&gt;running or building a Spring Boot project&lt;/a&gt;, please refer to my previous post.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Dependencies:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Add the following dependencies to your project POM.xml file. In this project I am using Spring Doc OpenAPI starter and Swagger Core Annotation libraries.&amp;nbsp;&lt;/p&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dependency&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;groupId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;org.springdoc&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;groupId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;artifactId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;springdoc-openapi-starter-webmvc-ui&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;artifactId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;2.5.0&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dependency&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dependency&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;groupId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;io.swagger.core.v3&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;groupId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;artifactId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;swagger-annotations&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;artifactId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;2.2.22&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dependency&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Spring Configuration:&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;To configure the documentation, create a Spring Java Configuration class:&lt;/p&gt;&lt;p&gt;To configure the documentation, you can create a Spring Java Configuration class using Spring’s &lt;b&gt;@Configuration&lt;/b&gt; annotation. The following example shows how to generate Swagger documentation based on the RestController classes:&lt;/p&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;package&lt;/span&gt; com.chandana.helloworld.config;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; io.swagger.v3.oas.models.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;OpenAPI&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; io.swagger.v3.oas.models.info.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Contact&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; io.swagger.v3.oas.models.info.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Info&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; io.swagger.v3.oas.models.info.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;License&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springdoc.core.models.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;GroupedOpenApi&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.context.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Bean&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.context.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Configuration&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Configuration&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;OpenApiConfig&lt;/span&gt; {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Bean&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;OpenAPI&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;customOpenAPI&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;OpenAPI&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #dcdcaa;&quot;&gt;info&lt;/span&gt;(&lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;Info&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #dcdcaa;&quot;&gt;title&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Greetings API Title&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #dcdcaa;&quot;&gt;description&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Greetings API Definition&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #dcdcaa;&quot;&gt;version&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;1.0.0&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #dcdcaa;&quot;&gt;contact&lt;/span&gt;(&lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;Contact&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #dcdcaa;&quot;&gt;name&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Chandana Napagoda&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #dcdcaa;&quot;&gt;url&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;https://blog.napagoda.com&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #dcdcaa;&quot;&gt;email&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;cnapagoda@gmail.com&quot;&lt;/span&gt;))&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #dcdcaa;&quot;&gt;license&lt;/span&gt;(&lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;License&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #dcdcaa;&quot;&gt;name&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Apache 2.0&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #dcdcaa;&quot;&gt;url&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;http://www.apache.org/licenses/LICENSE-2.0&quot;&lt;/span&gt;)));&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Bean&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;GroupedOpenApi&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;publicApi&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;GroupedOpenApi&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;builder&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #dcdcaa;&quot;&gt;group&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;1.0.0&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #dcdcaa;&quot;&gt;pathsToMatch&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/api/**&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #dcdcaa;&quot;&gt;build&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Spring doc OpenAPI uses GroupedOpenApi to configure a subset of the services to be documented and group them by a name, etc. This configuration will include all APIs under /api/** path.&lt;/p&gt;&lt;p&gt;You can provide custom information about your API using the OpenAPI class. This allows you to change default values such as the title, description, version, license, and contact information. With this configuration, the generated documentation will include the specified title, description, version, contact, and license information.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhk06fp_ivlxobOQk4AxMLIR5dXnqnZmglITiI6RfhuGw2NvgENA0qJ6oahagudco5vz6x8IfBwgVM2_8JX1xV5jrY9JN8KaQyz6sdPmIbfUxIJRsfSO9YrhvbsCjqYZzSTPWXcjLIBaRbYxteYI3jbviSqTKpdzC8enoUyg6XM5teMs9ivdOBDgA&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Spring Boot Generated Swagger Info&quot; data-original-height=&quot;337&quot; data-original-width=&quot;1531&quot; height=&quot;92&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhk06fp_ivlxobOQk4AxMLIR5dXnqnZmglITiI6RfhuGw2NvgENA0qJ6oahagudco5vz6x8IfBwgVM2_8JX1xV5jrY9JN8KaQyz6sdPmIbfUxIJRsfSO9YrhvbsCjqYZzSTPWXcjLIBaRbYxteYI3jbviSqTKpdzC8enoUyg6XM5teMs9ivdOBDgA=w419-h92&quot; title=&quot;Spring Boot Generated Swagger Info&quot; width=&quot;419&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;As an alternative to the Spring Java Configuration class, you can define a class with the &lt;b&gt;@OpenAPIDefinition&amp;nbsp;&lt;/b&gt;annotation and include complete documentation under that annotation. I have included examples of both in my GitHub repository(&lt;a href=&quot;https://github.com/cnapagoda/spring-boot-swagger/tree/master/spring-boot-3-swagger-3-with-openapidefinition&quot; target=&quot;_blank&quot;&gt;spring-boot-3-swagger-3-with-openapidefinition&lt;/a&gt;).&lt;/p&gt;&lt;p&gt;&lt;b&gt;Controller and POJO Level Documentation :&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;To document individual controllers and methods, use annotations from the Swagger library:&lt;/p&gt;&lt;p&gt;&lt;b&gt;@Operation&lt;/b&gt; annotation to describe the resources and methods.&lt;/p&gt;&lt;p&gt;&lt;b&gt;@ApiResponses&lt;/b&gt; annotation to describe other responses that can be returned by the operation (e.g., 200 OK or 202 Accepted).&lt;/p&gt;&lt;p&gt;&lt;b&gt;@Schema&lt;/b&gt; annotation to describe the properties of the POJO (Bean) class or class.&lt;/p&gt;&lt;p&gt;&lt;b&gt;@Parameter&lt;/b&gt; annotation to describe the parameters&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;@Hidden&lt;/b&gt; annotation&amp;nbsp;hide specific API endpoint or controller from auto-generated OpenAPI documentation.&lt;/p&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;package&lt;/span&gt; com.chandana.helloworld.controller;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; java.util.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;HashMap&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; java.util.&lt;span style=&quot;color: #b8d7a3;&quot;&gt;Map&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;springframework&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;HttpStatus&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;springframework&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseEntity&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;springframework&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;web&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;bind&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;annotation&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;DeleteMapping&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;springframework&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;web&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;bind&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;annotation&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;GetMapping&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;springframework&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;web&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;bind&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;annotation&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PathVariable&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;springframework&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;web&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;bind&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;annotation&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PostMapping&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;springframework&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;web&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;bind&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;annotation&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PutMapping&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;springframework&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;web&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;bind&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;annotation&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestBody&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;springframework&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;web&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;bind&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;annotation&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestMapping&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;springframework&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;web&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;bind&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;annotation&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RestController&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;io&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;swagger&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;v3&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;oas&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;annotations&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Operation&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;io&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;swagger&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;v3&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;oas&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;annotations&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Parameter&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;io&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;swagger&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;v3&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;oas&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;annotations&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;responses&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ApiResponse&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;io&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;swagger&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;v3&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;oas&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;annotations&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;responses&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ApiResponses&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;io&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;swagger&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;v3&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;oas&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;annotations&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;tags&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Tag&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RestController&lt;/span&gt;&lt;/div&gt;&lt;div&gt;@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/api/greetings&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Tag&lt;/span&gt;(name = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;greetings&quot;&lt;/span&gt;, description = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;These are greetings API operations&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;GreetingController&lt;/span&gt; {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #b8d7a3;&quot;&gt;Map&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Integer&lt;/span&gt;, &lt;span style=&quot;color: #4ec9b0;&quot;&gt;GreetingResponse&lt;/span&gt;&amp;gt; examples = &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;HashMap&lt;/span&gt;&amp;lt;&amp;gt;();&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;GetMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/{id}&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Operation&lt;/span&gt;(summary = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Get example by ID&quot;&lt;/span&gt;, description = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Retrieve an example resource by its ID&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ApiResponses&lt;/span&gt;(value = {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ApiResponse&lt;/span&gt;(responseCode = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;200&quot;&lt;/span&gt;, description = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Successful operation&quot;&lt;/span&gt;),&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ApiResponse&lt;/span&gt;(responseCode = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;404&quot;&lt;/span&gt;, description = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Greeting not found&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; })&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;GreetingResponse&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;getExample&lt;/span&gt;(&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PathVariable&lt;/span&gt; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Parameter&lt;/span&gt;(allowEmptyValue = &lt;span style=&quot;color: #569cd6;&quot;&gt;false&lt;/span&gt;, required = &lt;span style=&quot;color: #569cd6;&quot;&gt;true&lt;/span&gt;) &lt;span style=&quot;color: #4ec9b0;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;id&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;GreetingResponse&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;example&lt;/span&gt; = examples.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;get&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;id&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;example&lt;/span&gt; == &lt;span style=&quot;color: #569cd6;&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&amp;gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;HttpStatus&lt;/span&gt;.&lt;span style=&quot;color: #9cdcfe;&quot;&gt;NOT_FOUND&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&amp;gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;example&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;HttpStatus&lt;/span&gt;.&lt;span style=&quot;color: #9cdcfe;&quot;&gt;OK&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PostMapping&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Operation&lt;/span&gt;(summary = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Create a new example&quot;&lt;/span&gt;, description = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Create a new example resource&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ApiResponses&lt;/span&gt;(value = {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ApiResponse&lt;/span&gt;(responseCode = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;201&quot;&lt;/span&gt;, description = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Greeting created&quot;&lt;/span&gt;),&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ApiResponse&lt;/span&gt;(responseCode = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;400&quot;&lt;/span&gt;, description = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Invalid input&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; })&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;GreetingResponse&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;createExample&lt;/span&gt;(@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestBody&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;GreetingRequest&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;request&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;GreetingResponse&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;example&lt;/span&gt; = &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;GreetingResponse&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Created &quot;&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;request&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;getMessage&lt;/span&gt;());&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;id&lt;/span&gt; = examples.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;size&lt;/span&gt;() + &lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; examples.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;put&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;id&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;example&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&amp;gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;example&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;HttpStatus&lt;/span&gt;.&lt;span style=&quot;color: #9cdcfe;&quot;&gt;CREATED&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PutMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/{id}&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Operation&lt;/span&gt;(summary = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Update an example by ID&quot;&lt;/span&gt;, description = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Update an existing example resource by its ID&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ApiResponses&lt;/span&gt;(value = {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ApiResponse&lt;/span&gt;(responseCode = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;200&quot;&lt;/span&gt;, description = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Greeting updated&quot;&lt;/span&gt;),&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ApiResponse&lt;/span&gt;(responseCode = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;404&quot;&lt;/span&gt;, description = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Greeting not found&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; })&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;GreetingResponse&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;updateExample&lt;/span&gt;(&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PathVariable&lt;/span&gt; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Parameter&lt;/span&gt;(allowEmptyValue = &lt;span style=&quot;color: #569cd6;&quot;&gt;false&lt;/span&gt;, required = &lt;span style=&quot;color: #569cd6;&quot;&gt;true&lt;/span&gt;) &lt;span style=&quot;color: #4ec9b0;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;id&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestBody&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;GreetingRequest&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;request&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;GreetingResponse&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;example&lt;/span&gt; = examples.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;get&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;id&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;example&lt;/span&gt; == &lt;span style=&quot;color: #569cd6;&quot;&gt;null&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&amp;gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;HttpStatus&lt;/span&gt;.&lt;span style=&quot;color: #9cdcfe;&quot;&gt;NOT_FOUND&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;example&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;setMessage&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Updated &quot;&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;request&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;getMessage&lt;/span&gt;());&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&amp;gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;example&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;HttpStatus&lt;/span&gt;.&lt;span style=&quot;color: #9cdcfe;&quot;&gt;OK&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;DeleteMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/{id}&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Operation&lt;/span&gt;(summary = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Delete an example by ID&quot;&lt;/span&gt;, description = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Delete an example resource by its ID&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ApiResponses&lt;/span&gt;(value = {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ApiResponse&lt;/span&gt;(responseCode = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;204&quot;&lt;/span&gt;, description = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Greeting deleted&quot;&lt;/span&gt;),&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;ApiResponse&lt;/span&gt;(responseCode = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;404&quot;&lt;/span&gt;, description = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Greeting not found&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; })&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Void&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;deleteExample&lt;/span&gt;(&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PathVariable&lt;/span&gt; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Parameter&lt;/span&gt;(allowEmptyValue = &lt;span style=&quot;color: #569cd6;&quot;&gt;false&lt;/span&gt;, required = &lt;span style=&quot;color: #569cd6;&quot;&gt;true&lt;/span&gt;) &lt;span style=&quot;color: #4ec9b0;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;id&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (!examples.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;containsKey&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;id&lt;/span&gt;)) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&amp;gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;HttpStatus&lt;/span&gt;.&lt;span style=&quot;color: #9cdcfe;&quot;&gt;NOT_FOUND&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; examples.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;remove&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;id&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;ResponseEntity&lt;/span&gt;&amp;lt;&amp;gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;HttpStatus&lt;/span&gt;.&lt;span style=&quot;color: #9cdcfe;&quot;&gt;NO_CONTENT&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;p&gt;After adding these annotations, the final generated Swagger documentation will be enriched with detailed information about your API endpoints and data models.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Swagger documentation published at :&amp;nbsp;http://localhost:8080/swagger-ui/index.html&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiKCFjlSPRnADwo_QR6HupO6DS9SsQ0RH6mPPOuGutEAI74zsCZO2uBXTGAqUrqc1qtkTx5XgQYeuwz8pmidVbGtAo2jAfyUTGcALSGJ2TAJsdS42HqMhDsHJw0ICXzjsXJaVsJ6SKvRLSXjzsDBBO1vPeUJRLkn1WNntQ3ukbgHTtCQdP47A0aXg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Spring Boot Generated Complete Swagger Documentation&quot; data-original-height=&quot;784&quot; data-original-width=&quot;1150&quot; height=&quot;272&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiKCFjlSPRnADwo_QR6HupO6DS9SsQ0RH6mPPOuGutEAI74zsCZO2uBXTGAqUrqc1qtkTx5XgQYeuwz8pmidVbGtAo2jAfyUTGcALSGJ2TAJsdS42HqMhDsHJw0ICXzjsXJaVsJ6SKvRLSXjzsDBBO1vPeUJRLkn1WNntQ3ukbgHTtCQdP47A0aXg=w400-h272&quot; title=&quot;Spring Boot Generated Complete Swagger Documentation&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Greeting Request &amp;amp; Response Model:&lt;/b&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;package&lt;/span&gt; com.chandana.helloworld.controller;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; io.swagger.v3.oas.annotations.media.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Schema&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Schema&lt;/span&gt;(&lt;span style=&quot;color: #dcdcaa;&quot;&gt;description&lt;/span&gt; = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;The example request message&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;GreetingRequest&lt;/span&gt; {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Schema&lt;/span&gt;(&lt;span style=&quot;color: #dcdcaa;&quot;&gt;description&lt;/span&gt; = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;The example message&quot;&lt;/span&gt;, &lt;span style=&quot;color: #dcdcaa;&quot;&gt;example&lt;/span&gt; = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Hello, World!&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; message;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #6a9955;&quot;&gt;// Getters and setters&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;getMessage&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; message;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;setMessage&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;message&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;this&lt;/span&gt;.message = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;message&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;package&lt;/span&gt; com.chandana.helloworld.controller;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; io.swagger.v3.oas.annotations.media.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Schema&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;GreetingResponse&lt;/span&gt; {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Schema&lt;/span&gt;(&lt;span style=&quot;color: #dcdcaa;&quot;&gt;description&lt;/span&gt; = &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;The example response message&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; message;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;GreetingResponse&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;message&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;this&lt;/span&gt;.message = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;message&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #6a9955;&quot;&gt;// Getters and setters&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;getMessage&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; message;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;setMessage&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;message&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;this&lt;/span&gt;.message = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;message&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier; font-size: x-small;&quot;&gt;&lt;b&gt;&lt;i&gt;Please refrain from copying content to other websites. You can download the &lt;a href=&quot;https://github.com/cnapagoda/spring-boot-swagger&quot; target=&quot;_blank&quot;&gt;Swagger Spring Boot Project&lt;/a&gt; source code from my GitHub repository.&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/4047360125916280454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2024/06/integrate-swagger-3-with-spring-boot3-api.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/4047360125916280454'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/4047360125916280454'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2024/06/integrate-swagger-3-with-spring-boot3-api.html' title='Integrate Swagger 3 with Spring Boot Rest API'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEhk06fp_ivlxobOQk4AxMLIR5dXnqnZmglITiI6RfhuGw2NvgENA0qJ6oahagudco5vz6x8IfBwgVM2_8JX1xV5jrY9JN8KaQyz6sdPmIbfUxIJRsfSO9YrhvbsCjqYZzSTPWXcjLIBaRbYxteYI3jbviSqTKpdzC8enoUyg6XM5teMs9ivdOBDgA=s72-w419-h92-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-2091227082893369890</id><published>2024-06-20T21:02:00.006+09:30</published><updated>2024-06-30T12:08:04.626+09:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Maven"/><category scheme="http://www.blogger.com/atom/ns#" term="Microservices"/><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>Building a RESTful Service with Spring Boot 3</title><content type='html'>&lt;p&gt;&amp;nbsp;This blog post is an upgraded version of my &lt;a href=&quot;https://blog.napagoda.com/2017/09/building-restful-service-using-spring.html&quot;&gt;2017&lt;/a&gt; guide on building RESTful services using Spring Boot. It includes updates for the latest Spring Boot version, best practices, and enhanced code examples.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Creating Spring boot project is&amp;nbsp;straightforward,&amp;nbsp;You can create the structure of your project using &quot;Spring Initialiser,&quot; an online tool where you can add all the desired dependencies to your project&#39;s POM file. Since I am a big fan of Maven, I generated a Maven project.&lt;/p&gt;&lt;p&gt;In the Spring Initializer UI, you can choose the Language, Spring Boot Version, Project Group ID, artifact name, etc. Please refer below screenshot for information I have provided while generating the project.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgzQWkMoca5WLM7nvVm9m9JoGVQ4dljEmbvHVsQA8iZ0zg8saHTV-EViuPvzUzkuBFux93SYU_LOnS5mG66QWbR5RgHPh4g9AwqOHfEI0aEcOAuL_t3EZU5Zy2_R4j6hp17R2RujDBjDUTnYck8qx3MmqRPOmhmZZCKUoGWftBACNNIKJULYHDM4w&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Spring Initialiser&quot; data-original-height=&quot;524&quot; data-original-width=&quot;1198&quot; height=&quot;204&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgzQWkMoca5WLM7nvVm9m9JoGVQ4dljEmbvHVsQA8iZ0zg8saHTV-EViuPvzUzkuBFux93SYU_LOnS5mG66QWbR5RgHPh4g9AwqOHfEI0aEcOAuL_t3EZU5Zy2_R4j6hp17R2RujDBjDUTnYck8qx3MmqRPOmhmZZCKUoGWftBACNNIKJULYHDM4w=w554-h204&quot; title=&quot;Spring Initialiser&quot; width=&quot;554&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;When clicking on &quot;Generate Project&quot;, it will download zipped maven project into your computer. Unzip it and import into an IDE. The initial project structure is like below.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh0yHCcpTDJrsGDS8IqAnWAFCb3JIJlCOWCGRdJ2ohoN74E-Pm8TwrUG9qr1mprR4wxNAw1__2yw8Pvx8RHom6V3wGxPp8MBjsiNA8XKub2j_YMRWk1rwZverDFshQPMB03slCAHd8dJtZfcwlLWJozA2sMDdLphITzJt3y5Hwt-lwRXGlRd9t6iQ&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Spring Boot Project Structure&quot; data-original-height=&quot;443&quot; data-original-width=&quot;424&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh0yHCcpTDJrsGDS8IqAnWAFCb3JIJlCOWCGRdJ2ohoN74E-Pm8TwrUG9qr1mprR4wxNAw1__2yw8Pvx8RHom6V3wGxPp8MBjsiNA8XKub2j_YMRWk1rwZverDFshQPMB03slCAHd8dJtZfcwlLWJozA2sMDdLphITzJt3y5Hwt-lwRXGlRd9t6iQ&quot; title=&quot;Spring Boot Project Structure&quot; width=&quot;230&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;In my HelloWorld REST service implementation, it accepts user&#39;s name as a path parameter(or URL parameter) and returns a greeting JSON payload(response). So I am expecting to invoke my REST service by calling below URL: APP_NAME/api/hello/chandana.&lt;/p&gt;&lt;div&gt;The @RestController is a way to implement RESTFul service using Spring. So, this new controller class is going to name as HelloWorldController. @RequestMapping annotation maps HTTP requests to the handler. This @RequestMapping annotation can be used in class-level and/or method-level as well. If you have multiple request mappings for a method or class, you can add one @RequestMapping annotation with a list of values. So my HelloWorldController class looks like below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;package&lt;/span&gt; com.chandana.helloworld;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;GetMapping&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PathVariable&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestMapping&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RestController&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RestController&lt;/span&gt;&lt;/div&gt;&lt;div&gt;@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/api&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;HelloWorldController&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;welcome&lt;/span&gt;() {&lt;span style=&quot;color: #6a9955;&quot;&gt;// Welcome page, non-rest&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Welcome to RestTemplate Example.&quot;&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/hello/{name}&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Greeting&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;message&lt;/span&gt;(@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PathVariable&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Greeting&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;msg&lt;/span&gt; = &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;Greeting&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;, &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Hello &quot;&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;msg&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;GetMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/greeting/{name}/{message}&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Greeting&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;message&lt;/span&gt;(@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PathVariable&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;, @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PathVariable&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;message&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Greeting&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;msg&lt;/span&gt; = &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;Greeting&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;message&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;msg&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can use&amp;nbsp;@GetMapping, @PostMapping, @PutMapping, @DeleteMapping, @PatchMapping annotations as well, these are variation of @RequestMapping to support each&amp;nbsp;HTTP methods.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;So everything is in place. you can build and run Spring Boot project using below maven command. It will compile the project and run it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;mvn spring-boot:run&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;Once the Spring Boot DispatcherServlet is started, you can invoke the following API URLs:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;http://localhost:8080/api/hello/Alex - This API supports all HTTP methods.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;http://localhost:8080/api/greeting/Alex/WelCome - This API only supports the HTTP GET method.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b style=&quot;background-color: white; color: #757575; font-family: Roboto, sans-serif; font-size: 15px;&quot;&gt;Final Project Structure:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj2JCozRh-lEGeFtfWohLwYmoSTxXnDrlO_F9fXIijQSDf1BmR0GW9PuRKYUOpbaHPsbBfSaN9-F3gldkCHFC5cO9_hA9Sdjf0Ebm9fIlXCA52Njo0hNWRiWOi-mom4_y9cV3JSZlH8HzXLS7uu1JtCiDurBTb7DZEf9K9W2Y12Azov044Rs5TjSQ&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Spring Boot Final Project Structure&quot; data-original-height=&quot;423&quot; data-original-width=&quot;409&quot; height=&quot;307&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj2JCozRh-lEGeFtfWohLwYmoSTxXnDrlO_F9fXIijQSDf1BmR0GW9PuRKYUOpbaHPsbBfSaN9-F3gldkCHFC5cO9_hA9Sdjf0Ebm9fIlXCA52Njo0hNWRiWOi-mom4_y9cV3JSZlH8HzXLS7uu1JtCiDurBTb7DZEf9K9W2Y12Azov044Rs5TjSQ=w297-h307&quot; title=&quot;Spring Boot Final Project Structure&quot; width=&quot;297&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;b style=&quot;background-color: white; color: #757575; font-family: Roboto, sans-serif; font-size: 15px;&quot;&gt;Greeting POJO class:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b style=&quot;background-color: white; color: #757575; font-family: Roboto, sans-serif; font-size: 15px;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;package&lt;/span&gt; com.chandana.helloworld;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Greeting&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; player;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; message;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;Greeting&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;player&lt;/span&gt;, &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;message&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;this&lt;/span&gt;.player = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;player&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;this&lt;/span&gt;.message = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;message&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;getPlayer&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; player;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;setPlayer&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;player&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;this&lt;/span&gt;.player = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;player&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;getMessage&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; message;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;setMessage&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;message&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;this&lt;/span&gt;.message = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;message&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;b style=&quot;background-color: white; color: #757575; font-family: Roboto, sans-serif; font-size: 15px;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b style=&quot;background-color: white; color: #757575; font-family: Roboto, sans-serif; font-size: 15px;&quot;&gt;POM XML:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b style=&quot;background-color: white; color: #757575; font-family: Roboto, sans-serif; font-size: 15px;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;xml&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt; version&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;1.0&quot;&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt; encoding&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;UTF-8&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;project&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;xmlns&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;http://maven.apache.org/POM/4.0.0&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;xmlns&lt;/span&gt;:&lt;span style=&quot;color: #9cdcfe;&quot;&gt;xsi&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;xsi&lt;/span&gt;:&lt;span style=&quot;color: #9cdcfe;&quot;&gt;schemaLocation&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;modelVersion&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;4.0.0&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;modelVersion&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;parent&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;groupId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;org.springframework.boot&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;groupId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;artifactId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;spring-boot-starter-parent&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;artifactId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;3.3.0&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;relativePath&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;lt;!-- lookup parent from repository --&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;parent&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;groupId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;com.chandana&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;groupId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;artifactId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;helloworld&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;artifactId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;0.0.1-SNAPSHOT&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;Hello World&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;description&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;Demo project for Spring Boot&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;description&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;url&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;licenses&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;license&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;licenses&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;developers&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;developer&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;developers&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;scm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;connection&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;developerConnection&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;tag&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;url&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;scm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;properties&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;java.version&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;17&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;java.version&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;properties&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dependencies&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dependency&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;groupId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;org.springframework.boot&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;groupId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;artifactId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;spring-boot-starter-web&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;artifactId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dependency&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dependency&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;groupId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;org.springframework.boot&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;groupId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;artifactId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;spring-boot-starter-test&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;artifactId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;scope&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;test&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;scope&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dependency&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;dependencies&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;build&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;plugins&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;plugin&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;groupId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;org.springframework.boot&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;groupId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;artifactId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;spring-boot-maven-plugin&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;artifactId&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;plugin&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;plugins&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;build&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;project&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;b style=&quot;background-color: white; color: #757575; font-family: Roboto, sans-serif; font-size: 15px;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b style=&quot;background-color: white; color: #757575; font-family: Roboto, sans-serif; font-size: 15px;&quot;&gt;HelloWorldController class:&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b style=&quot;background-color: white; color: #757575; font-family: Roboto, sans-serif; font-size: 15px;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;package&lt;/span&gt; com.chandana.helloworld;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;GetMapping&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PathVariable&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestMapping&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;import&lt;/span&gt; org.springframework.web.bind.annotation.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RestController&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RestController&lt;/span&gt;&lt;/div&gt;&lt;div&gt;@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/api&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;HelloWorldController&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;welcome&lt;/span&gt;() {&lt;span style=&quot;color: #6a9955;&quot;&gt;// Welcome page, non-rest&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Welcome to RestTemplate Example.&quot;&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;RequestMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/hello/{name}&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Greeting&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;message&lt;/span&gt;(@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PathVariable&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Greeting&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;msg&lt;/span&gt; = &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;Greeting&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;, &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Hello &quot;&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;msg&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;GetMapping&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;/greeting/{name}/{message}&quot;&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Greeting&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;message&lt;/span&gt;(@&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PathVariable&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;, @&lt;span style=&quot;color: #4ec9b0;&quot;&gt;PathVariable&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;message&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Greeting&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;msg&lt;/span&gt; = &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;Greeting&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;message&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;msg&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style=&quot;font-family: courier; font-size: x-small;&quot;&gt;&lt;b&gt;&lt;i&gt;
Please refrain from copying content to other websites
&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/2091227082893369890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2024/06/building-restful-service-spring-boot-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/2091227082893369890'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/2091227082893369890'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2024/06/building-restful-service-spring-boot-3.html' title='Building a RESTful Service with Spring Boot 3'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEgzQWkMoca5WLM7nvVm9m9JoGVQ4dljEmbvHVsQA8iZ0zg8saHTV-EViuPvzUzkuBFux93SYU_LOnS5mG66QWbR5RgHPh4g9AwqOHfEI0aEcOAuL_t3EZU5Zy2_R4j6hp17R2RujDBjDUTnYck8qx3MmqRPOmhmZZCKUoGWftBACNNIKJULYHDM4w=s72-w554-h204-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-6013441930031748674</id><published>2024-04-22T17:48:00.002+09:30</published><updated>2024-06-14T09:27:29.588+09:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="WSO2"/><title type='text'>Custom Mediator cannot be found by synapse-core </title><content type='html'>&lt;blockquote&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&amp;nbsp;Caused by: java.lang.ClassNotFoundException: com.chandana.test.CustomMediator cannot be found by synapse-core_4.0.0.wso2v20_43&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:512)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:423)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:415)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:155)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at org.apache.synapse.config.xml.ClassMediatorFactory.createSpecificMediator(ClassMediatorFactory.java:100)&lt;/div&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;If you try to build a WSO2 Custom mediator for Micro Integrator 4.2.0 using Maven, you might encounter above exception in the logs. Based on my understanding, there are two ways to overcome this issue. The first option is to use Integration Studio to export the custom mediator JAR file. However, in my use case, it’s not feasible. After going through the WSO2 Integration Studio source code, I found that it uses different Maven-bundle-plugin instructions than what’s available in the pom.xml file.&lt;/p&gt;&lt;p&gt;I have overcome this issue by adding &amp;lt;_removeheaders&amp;gt;Import-Package,Private-Package&amp;lt;/_removeheaders&amp;gt; to the Maven-bundle-plugin instructions.&lt;/p&gt;

&lt;pre&gt;&lt;p style=&quot;background-color: white; border: 0px; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variant-position: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #319999; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px; white-space: normal;&quot;&gt;&amp;lt;plugin&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; border: 0px; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variant-position: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #319999; font-family: consolas; font-size: 13.3333px; white-space: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;groupId&amp;gt;org.apache.felix&amp;lt;/groupId&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; border: 0px; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variant-position: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #319999; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px; white-space: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;artifactId&amp;gt;maven-bundle-plugin&amp;lt;/artifactId&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; border: 0px; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variant-position: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #319999; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px; white-space: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;version&amp;gt;2.3.4&amp;lt;/version&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; border: 0px; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variant-position: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #319999; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px; white-space: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;extensions&amp;gt;true&amp;lt;/extensions&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; border: 0px; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variant-position: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #319999; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px; white-space: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;configuration&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; border: 0px; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variant-position: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #319999; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px; white-space: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;instructions&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; border: 0px; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variant-position: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #319999; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px; white-space: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Bundle-SymbolicName&amp;gt;CustomClassMediator&amp;lt;/Bundle-SymbolicName&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; border: 0px; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variant-position: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #319999; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px; white-space: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Bundle-Name&amp;gt;CustomClassMediator&amp;lt;/Bundle-Name&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; border: 0px; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variant-position: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #319999; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px; white-space: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Export-Package&amp;gt;com.chandana.test&amp;lt;/Export-Package&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; border: 0px; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variant-position: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #319999; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px; white-space: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;DynamicImport-Package&amp;gt;*&amp;lt;/DynamicImport-Package&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; border: 0px; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variant-position: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #319999; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px; white-space: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;_removeheaders&amp;gt;Import-Package,Private-Package&amp;lt;/_removeheaders&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; border: 0px; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variant-position: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #319999; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px; white-space: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/instructions&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; border: 0px; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variant-position: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #319999; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px; white-space: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/configuration&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; border: 0px; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variant-position: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #319999; font-family: consolas;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px; white-space: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/plugin&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/6013441930031748674/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2024/04/custom-mediator-cannot-be-found-by.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/6013441930031748674'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/6013441930031748674'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2024/04/custom-mediator-cannot-be-found-by.html' title='Custom Mediator cannot be found by synapse-core '/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-4735773833509562633</id><published>2022-09-10T06:43:00.001+09:30</published><updated>2024-06-23T15:08:46.847+09:30</updated><title type='text'>Adding XML Declaration - WSO2 </title><content type='html'>&lt;div&gt;&lt;div&gt;The XML declaration is a processing instruction that identifies the document is in XML format. While working on one of the integration scenarios, I noticed that WSO2 is not sending the XML declaration in the response or backend request message as expected. However, I was able to see it in the log messages.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To overcome this issue, you can set below the AXIS2 property before sending a message out.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To Add XML declaration:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;lt;property name=&quot;WRITE_XML_DECLARATION&quot; scope=&quot;axis2&quot; value=&quot;true&quot;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Also you can use below additional properties to set custom encoding type and set values for standalone.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;lt;property name=XML_DECLARATION_ENCODING&quot; scope=&quot;axis2&quot; value=&quot;UTF-16&quot;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;lt;property name=&quot;XML_DECLARATION_STANDALONE&quot; scope=&quot;axis2&quot; value=&quot;no&quot;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/4735773833509562633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2022/09/adding-xml-declaration-wso2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/4735773833509562633'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/4735773833509562633'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2022/09/adding-xml-declaration-wso2.html' title='Adding XML Declaration - WSO2 '/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-4403456225041387636</id><published>2020-12-01T08:00:00.017+10:30</published><updated>2024-06-14T09:30:47.788+09:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="WSO2"/><title type='text'>Integrate With Mutual Certificate Authentication based Service</title><content type='html'>&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;There are many ways to secure a Service/API using different Authentication mechanisms. Mutual Certificate authentication(AKA: Client Certificate Authentication) is one of the ways to secure Service or API. &lt;br /&gt;&lt;br /&gt;Recently I was trying to integrate with an API which is secured using Mutual Certificate Authentication. In this scenario, the backend service team gave me their certificate-based on PKCS#12. &lt;br /&gt;&lt;br /&gt;When integrating this backend system with WSO2 Platform, we have to use &#39;Multi-HTTPS transport&#39;. With this &#39;Multi-HTTPS transport&#39;, it will grant great flexibility to define different SSL profiles with separate trust stores and key stores for different IPs or hosts. This custom SSL profile can be implemented for Client to Synapse Runtime(Client --&amp;gt; ESB) or Synapse Runtime to Backend(ESB --&amp;gt; Backend). If it is Client to ESB, then you have to define custom SSL Profiles in the transportReceiver section.&lt;br /&gt;&lt;br /&gt;In my use-case, it was for ESB to Backend. So I had to add custom SSL profiles into the transportSender section of the axis2.xml file. Since I have a PKCS#12 based certificate file, I don&#39;t need to convert it to JKS or anything.&lt;br /&gt;&lt;br /&gt;Let&#39;s assume Mutual Certificate Authentication based backend API URL is &lt;a href=&quot;https://backendhost.com/api/users&quot;&gt;https://backendhost.com/api/users&lt;/a&gt;. The Custom SSL profiles configuration in the axis2.xml(or senderprofiles.xml in WSO2 EI 7&lt;span style=&quot;background-color: rgba(236, 236, 236, 0.5); color: #37474f; font-family: &amp;quot;Roboto Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 10.88px;&quot;&gt;)&lt;/span&gt;&amp;nbsp;is like below. &lt;div&gt;&lt;span class=&quot;im&quot; style=&quot;background-color: white; color: #500050; font-family: Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;im&quot; style=&quot;background-color: white; color: #500050; font-family: Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;!--HTML generated using hilite.me--&gt;&lt;div style=&quot;background: rgb(255, 255, 255); border-color: gray; border-image: initial; border-style: solid; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;&lt;pre style=&quot;line-height: 125%; margin: 0px;&quot;&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;transportSender&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;https&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;class=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;org.apache.synapse.transport.passthru.PassThroughHttpSSLSender&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
	&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;parameter&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;non-blocking&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;locked=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;false&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;true&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/parameter&amp;gt;&lt;/span&gt;
	&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;parameter&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;keystore&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;locked=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;false&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
		&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;KeyStore&amp;gt;&lt;/span&gt;
			&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Location&amp;gt;&lt;/span&gt;repository/resources/security/wso2carbon.jks&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Location&amp;gt;&lt;/span&gt;
			&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Type&amp;gt;&lt;/span&gt;JKS&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Type&amp;gt;&lt;/span&gt;
			&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Password&amp;gt;&lt;/span&gt;wso2carbon&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Password&amp;gt;&lt;/span&gt;
			&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;KeyPassword&amp;gt;&lt;/span&gt;wso2carbon&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/KeyPassword&amp;gt;&lt;/span&gt;
		&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/KeyStore&amp;gt;&lt;/span&gt;
	&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/parameter&amp;gt;&lt;/span&gt;
	&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;parameter&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;truststore&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;locked=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;false&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
		&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;TrustStore&amp;gt;&lt;/span&gt;
			&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Location&amp;gt;&lt;/span&gt;repository/resources/security/client-truststore.jks&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Location&amp;gt;&lt;/span&gt;
			&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Type&amp;gt;&lt;/span&gt;JKS&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Type&amp;gt;&lt;/span&gt;
			&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Password&amp;gt;&lt;/span&gt;wso2carbon&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Password&amp;gt;&lt;/span&gt;
		&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/TrustStore&amp;gt;&lt;/span&gt;
	&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/parameter&amp;gt;&lt;/span&gt;
	&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;parameter&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;customSSLProfiles&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
		&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;profile&amp;gt;&lt;/span&gt;
			&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;servers&amp;gt;&lt;/span&gt;backendhost.com:443&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/servers&amp;gt;&lt;/span&gt;
			&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;KeyStore&amp;gt;&lt;/span&gt;
				&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Location&amp;gt;&lt;/span&gt;repository/resources/security/backendcertificate.p12&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Location&amp;gt;&lt;/span&gt;
				&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Type&amp;gt;&lt;/span&gt;PKCS12&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Type&amp;gt;&lt;/span&gt;
				&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Password&amp;gt;&lt;/span&gt;certificatePassword&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Password&amp;gt;&lt;/span&gt;
				&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;KeyPassword&amp;gt;&lt;/span&gt;certificatePassword&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/KeyPassword&amp;gt;&lt;/span&gt;
			&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/KeyStore&amp;gt;&lt;/span&gt;
		&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/profile&amp;gt;&lt;/span&gt;			
	&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/parameter&amp;gt;&lt;/span&gt;
	&lt;span style=&quot;color: #888888;&quot;&gt;&amp;lt;!--&amp;lt;parameter name=&quot;HostnameVerifier&quot;&amp;gt;DefaultAndLocalhost&amp;lt;/parameter&amp;gt;--&amp;gt;&lt;/span&gt;
	&lt;span style=&quot;color: #888888;&quot;&gt;&amp;lt;!--supports Strict|AllowAll|DefaultAndLocalhost or the default if none specified --&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/transportSender&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Docs:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href=&quot;https://docs.wso2.com/display/EI611/Multi-HTTPS+Transport&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Multi-HTTPS Transport -&amp;nbsp; WSO2 ESB/EI&lt;/a&gt;&lt;div&gt;&lt;a href=&quot;https://ei.docs.wso2.com/en/7.2.0/micro-integrator/setup/transport_configurations/multi-https-transport/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Multi-HTTPS Transport -&amp;nbsp; WSO2 EI 7&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/4403456225041387636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2020/12/integrate-with-mutual-certificate.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/4403456225041387636'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/4403456225041387636'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2020/12/integrate-with-mutual-certificate.html' title='Integrate With Mutual Certificate Authentication based Service'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-5968666331620140198</id><published>2020-02-20T22:32:00.005+10:30</published><updated>2024-06-30T12:12:28.225+09:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="OpenSource"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2"/><title type='text'>CSV to SOAP Message conversion with Smooks Mediator</title><content type='html'>Smook Mediator available in WSO2 EI/ESB can be used to do various message transformations. For an example read &lt;a href=&quot;https://blog.lakmali.com/2013/08/csv-to-xml-transformation-with-wso2-esb.html&quot; target=&quot;_blank&quot;&gt;CSV file and transform to XML&lt;/a&gt;. I had a requirement where I wanted to load a CSV file content into the database. So, my initial idea was to convert CSV content into XML, then use the XSLT mediator to generate a data service request. But it will be a costly operation with lots of resource consumption.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Therefore, instead of generating a data service request via XSLT, I tried to use the options available in Smooks. Smooks provides FreeMaker based templating support that can be used to convert CSV to SOAP.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here, first I have created a sample input CSV file and expected Data Service sample request message. With this, it will be very easy to generate data mapping. Below are the examples of CSV and Data Service models&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;Sample.csv:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
UserId,NameFirst,NameLast&lt;/div&gt;
&lt;div&gt;
1,Chandana,Napagoda&lt;/div&gt;
&lt;div&gt;
2,John,Tester&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;SampleOut.xml :&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;lt;au:addUsers_batch_req xmlns:au=&quot;https://blog.napagoda.com&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;au:addUsers&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;au:UserId&amp;gt;1&amp;lt;/au:UserId&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;au:NameFirst&amp;gt;Chandana&amp;lt;/au:NameFirst&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;au:NameLast&amp;gt;Napagoda&amp;lt;/au:NameLast&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;au:System&amp;gt;-1234&amp;lt;/au:System&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/au:addUsers&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;au:addUsers&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;au:UserId&amp;gt;2&amp;lt;/au:UserId&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;au:NameFirst&amp;gt;John&amp;lt;/au:NameFirst&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;au:NameLast&amp;gt;Tester&amp;lt;/au:NameLast&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;au:System&amp;gt;-1234&amp;lt;/au:System&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/au:addUsers&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/au:addUsers_batch_req&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
When I created the Smook configuration using WSO2 IDE, the view will be like this&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEij_xBrZ3O8jeGEWze_rq7ZlEF6FqedxHObGtxacCtd7feUl44uXo1z9CF7yQg4Fpx6SML9IzgappiOhLd78ZSeE0Fs2mKV6Stpbv59B63-YLpGWSV9rD_pLCsPOn35t1Nxf8mUlg/s1600/smooks-1.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Eclipse Smooks UI&quot; border=&quot;0&quot; data-original-height=&quot;388&quot; data-original-width=&quot;814&quot; height=&quot;305&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEij_xBrZ3O8jeGEWze_rq7ZlEF6FqedxHObGtxacCtd7feUl44uXo1z9CF7yQg4Fpx6SML9IzgappiOhLd78ZSeE0Fs2mKV6Stpbv59B63-YLpGWSV9rD_pLCsPOn35t1Nxf8mUlg/w640-h305/smooks-1.PNG&quot; title=&quot;Eclipse Smooks UI&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Next, click on the input task, then select input CSV file as input data. After that, define fields in the CSV file, using the Input configuration section. In Addition to above, I have skipped the first line, and each record was marked as User, and parent Element defined as Users.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcEXOwf3xEHhRfLZPsW3OmfFZNe0mJZ6xvd8LzWPZz2aoM8QdgUi10gwj2ii4NE3SXtyII3UkDwTtDqqiPs-GuPMzpigcT_tLdFsut6K27hUv-xuU7PqO7d-NO7h70O5Gwa7KIaQ/s1600/smooks-2.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Eclipse Smooks Mapping&quot; border=&quot;0&quot; data-original-height=&quot;700&quot; data-original-width=&quot;1132&quot; height=&quot;393&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcEXOwf3xEHhRfLZPsW3OmfFZNe0mJZ6xvd8LzWPZz2aoM8QdgUi10gwj2ii4NE3SXtyII3UkDwTtDqqiPs-GuPMzpigcT_tLdFsut6K27hUv-xuU7PqO7d-NO7h70O5Gwa7KIaQ/w640-h393/smooks-2.PNG&quot; title=&quot;Eclipse Smooks Mapping&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Next, right-click on the &#39;Input Task&#39;, and mouse hover on the &#39;Add Task&#39; option and click on the &#39;Apply Template&#39; option.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNpxIdcNmfqOU49ipH7Zse8u3fikAe1CTrxlBMXPgCT0Ztuxay5R0nzM5DsFc_4a5_N40ZJLolxolE3TPLGWvkMFvCt9BIeR7Cl0gAiCz_ziAxXVZmw1rmoKBkk8_3nzQXf_7foA/s1600/smooks-3.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Eclipse Smooks Add Template&quot; border=&quot;0&quot; data-original-height=&quot;282&quot; data-original-width=&quot;829&quot; height=&quot;216&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNpxIdcNmfqOU49ipH7Zse8u3fikAe1CTrxlBMXPgCT0Ztuxay5R0nzM5DsFc_4a5_N40ZJLolxolE3TPLGWvkMFvCt9BIeR7Cl0gAiCz_ziAxXVZmw1rmoKBkk8_3nzQXf_7foA/w640-h216/smooks-3.PNG&quot; title=&quot;Eclipse Smooks Add Template&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You will get a dialogue like below to select the output message type. For me, it is XML.&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2B6pTOiMqcvN35Q2vDoVCW2Rjlj6MDX5AX4CWzCF2YxKMe3Hmso_GYN9W9xUX3chflZNnEk3au_AkM0XN-aogg-5a1fXWP6u8V8dfhFwlrKxAf0nFOjepj3_FAC5vOubOLEmNUw/s1600/smooks-4.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Eclipse Smooks Add Output type&quot; border=&quot;0&quot; data-original-height=&quot;412&quot; data-original-width=&quot;685&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2B6pTOiMqcvN35Q2vDoVCW2Rjlj6MDX5AX4CWzCF2YxKMe3Hmso_GYN9W9xUX3chflZNnEk3au_AkM0XN-aogg-5a1fXWP6u8V8dfhFwlrKxAf0nFOjepj3_FAC5vOubOLEmNUw/w400-h240/smooks-4.PNG&quot; title=&quot;Eclipse Smooks Add Output type&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
In the next dialogue, I can select my Output file format(Data Service Request).&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl8Qk0SfkSeCrcd2Rc_J6mTMnvfmZMz-KsDWL1YJ54xk2RKMA3mBm9Bnri00JCnCNbeek1GvSOuxdVVlsz6ibhBJffKnScr_kSWpBFmotz_Mf6uj7E5aXLmFi2jRD0t7mwABlF2Q/s1600/smooks-5.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: left;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;592&quot; data-original-width=&quot;688&quot; height=&quot;343&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl8Qk0SfkSeCrcd2Rc_J6mTMnvfmZMz-KsDWL1YJ54xk2RKMA3mBm9Bnri00JCnCNbeek1GvSOuxdVVlsz6ibhBJffKnScr_kSWpBFmotz_Mf6uj7E5aXLmFi2jRD0t7mwABlF2Q/s400/smooks-5.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Once we select the Smooks Output model and click on the &#39;Finish&#39; button, Initial data mapping screen will look like below.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU9tzWUxTbHojuAmnU-ktAgzCWEd4yGFugaJ_wAofzEF1M5cH1eP0OkJ9UZ8uFKlrLiUPFvpGNNQwOL4RujxpOBbf7INDoWKNmUwya9T9YWsHs7JOZptFfgQW_1C5oLSBIpazm2w/s1600/smooks-6.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;432&quot; data-original-width=&quot;779&quot; height=&quot;353&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU9tzWUxTbHojuAmnU-ktAgzCWEd4yGFugaJ_wAofzEF1M5cH1eP0OkJ9UZ8uFKlrLiUPFvpGNNQwOL4RujxpOBbf7INDoWKNmUwya9T9YWsHs7JOZptFfgQW_1C5oLSBIpazm2w/s640/smooks-6.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Next, select &#39;User&#39; element from the input model and drop it into &#39;addUsers&#39; output model. This will generate necessary Freemaker template elements to iterate input rows.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjt6Kfc9jXp04yxjNg7Y_KTUB_ZeXAKr6PoyNG45puYfOD6kiy8atJaeQX8BwrLcnguewaOMWKaSZq4bJ6QbJmEE51jTJrAjnt_5UKjsTVrCeQc47elxBuTdbes9nBe4Zm_z5Iiw/s1600/smooks-7.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;538&quot; data-original-width=&quot;841&quot; height=&quot;408&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjt6Kfc9jXp04yxjNg7Y_KTUB_ZeXAKr6PoyNG45puYfOD6kiy8atJaeQX8BwrLcnguewaOMWKaSZq4bJ6QbJmEE51jTJrAjnt_5UKjsTVrCeQc47elxBuTdbes9nBe4Zm_z5Iiw/s640/smooks-7.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
Next map each input element into expected output elements. When ding that, you have to select each leaf element from the input model and drop into the output leaf element.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8-Esllzl8mJI8n2ByBexQyz2-m0oXbHvkhhHdiwAwW5aOwt1cu14aUacXHiBId20eleXQZINw6omJB4wrSdWQKWHiJBrK9t6D3vUEQ0cdFAEq1FWXCJyfryL5WZtm0BGJOilMFw/s1600/smooks-8.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;560&quot; data-original-width=&quot;806&quot; height=&quot;443&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8-Esllzl8mJI8n2ByBexQyz2-m0oXbHvkhhHdiwAwW5aOwt1cu14aUacXHiBId20eleXQZINw6omJB4wrSdWQKWHiJBrK9t6D3vUEQ0cdFAEq1FWXCJyfryL5WZtm0BGJOilMFw/s640/smooks-8.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
When navigating to source view of Smooks configuration, below configuration has been auto-generated.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&amp;lt;smooks-resource-list xmlns=&quot;http://www.milyn.org/xsd/smooks-1.1.xsd&quot; xmlns:csv=&quot;http://www.milyn.org/xsd/smooks/csv-1.2.xsd&quot; xmlns:ftl=&quot;http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;lt;params&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;param name=&quot;stream.filter.type&quot;&amp;gt;SAX&amp;lt;/param&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;param name=&quot;inputType&quot;&amp;gt;input.csv&amp;lt;/param&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;param name=&quot;input.csv&quot; type=&quot;input.type.actived&quot;&amp;gt;File:/E:\test\done\Sample.csv&amp;lt;/param&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;lt;/params&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;lt;csv:reader fields=&quot;UserId,NameFirst,NameLast&quot; recordElementName=&quot;User&quot; rootElementName=&quot;Users&quot; skipLines=&quot;1&quot;/&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;lt;ftl:freemarker applyOnElement=&quot;#document&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;ftl:template&amp;gt;&amp;lt;![CDATA[&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;au:addUsers_batch_req xmlns:au=&quot;https://blog.napagoda.com&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;#list .vars[&quot;Users&quot;][&quot;User&quot;] as User&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;au:addUsers&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;au:UserId&amp;gt;${.vars[&quot;User&quot;][&quot;UserId&quot;]}&amp;lt;/au:UserId&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;au:NameFirst&amp;gt;${.vars[&quot;User&quot;][&quot;NameFirst&quot;]}&amp;lt;/au:NameFirst&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;au:NameLast&amp;gt;${.vars[&quot;User&quot;][&quot;NameLast&quot;]}&amp;lt;/au:NameLast&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/au:addUsers&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/#list&amp;gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/au:addUsers_batch_req&amp;gt;]]&amp;gt;&amp;lt;/ftl:template&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;param name=&quot;modelSrc&quot;&amp;gt;File:/E:\test\done\SampleOut.xml&amp;lt;/param&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;param name=&quot;modelSrcType&quot;&amp;gt;XML&amp;lt;/param&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;param name=&quot;messageType&quot;&amp;gt;XML&amp;lt;/param&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;param name=&quot;templateDataProvider&quot;&amp;gt;input&amp;lt;/param&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;lt;/ftl:freemarker&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;lt;resource-config selector=&quot;#document&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;resource&amp;gt;org.milyn.delivery.DomModelCreator&amp;lt;/resource&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;lt;/resource-config&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/smooks-resource-list&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/5968666331620140198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2020/02/csv-to-soap-message-conversion-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/5968666331620140198'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/5968666331620140198'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2020/02/csv-to-soap-message-conversion-with.html' title='CSV to SOAP Message conversion with Smooks Mediator'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEij_xBrZ3O8jeGEWze_rq7ZlEF6FqedxHObGtxacCtd7feUl44uXo1z9CF7yQg4Fpx6SML9IzgappiOhLd78ZSeE0Fs2mKV6Stpbv59B63-YLpGWSV9rD_pLCsPOn35t1Nxf8mUlg/s72-w640-h305-c/smooks-1.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-3111963177901125568</id><published>2019-12-03T20:53:00.000+10:30</published><updated>2019-12-03T20:53:28.751+10:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="OpenSource"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2"/><title type='text'>Configure Kerberos based Authentication into WSO2 Datasources </title><content type='html'>&lt;br /&gt;
As you know, Kerberos can be used to authenticate System or users reside on a none secured network. In my use case, I have Windows AD and MSSQL server and I have a couple of WSO2 Servers running on Linux systems.&lt;br /&gt;
&lt;br /&gt;
In my initial setup I have configured, WSO2 servers has to use SQL users. But instead of using SQL users, I prefer to use AD users. So I have started configuring Kerberos and faced a lot of troubles.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you are starting from scratch, I would recommend writing a Java class to connect MSSQL server using Kerberos. Then You can identify all small mistakes such as character case issues, typos, JDBC driver compatibility issues, etc.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Below are a few issues I have faced:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
1) CASE is significant in krb5.conf file&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
2) I found that we need to use MSSQL JDBC 6.4 version in order to get new tickets. But if you are just planning use pre-generated tickets, you can use the older version as well.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here are the steps you need follow when configuring Kerberos with WSO2&amp;nbsp;Enterprise Integrator.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;1) Define your krb5.conf&amp;nbsp;&lt;/b&gt;&lt;b&gt;File&lt;/b&gt;&lt;b&gt;.&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
In my config file, I have defined two KDC and admin server(KDC) which will handle the database administration requests and all KDC(master and worker) will generate credentials. KDCs are your Active directory server hostnames&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;i&gt;[libdefaults]&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;default_realm = NAPAGODA.COM&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;[realms]&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;NAPAGODA.COM = {&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;kdc = dc1.napagoda.com&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;kdc = dc2.napagoda.com&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;admin_server = dc1.napagoda.com&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;default_domain = NAPAGODA.COM&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;[domain_realm]&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp; .napagoda.com = NAPAGODA.COM&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp; napagoda.com = NAPAGODA.COM&lt;/i&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;2) . Configure&amp;nbsp;jaas.conf&amp;nbsp;&lt;/b&gt;&lt;b&gt;File&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This file needs to be created under &#39;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;repository/conf/identity&lt;/span&gt;&lt;/b&gt;/&#39; directory. With WSO2 Enterprise Integrator product they have moved conf directory into product home. However, still, this file needs to be created based on the old folder structure. So make sure to use &#39;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;repository/conf/identity&lt;/span&gt;&lt;/b&gt;/&#39;. Luckily, if not, it will display an error message in the log file(or console).&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;i&gt;SQLJDBCDriver {&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp;com.sun.security.auth.module.Krb5LoginModule required useTicketCache=true;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;};&lt;/i&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;3). Locating the krb5.conf File&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you have created your krb5.conf file inside lib/security directory of the JRE, you don&#39;t need to set the environment variable. Otherwise, you have to pass &#39;krb5.conf&#39; file location as a &#39;java.security.krb5.conf&#39; environment variable. &lt;a href=&quot;https://docs.oracle.com/javase/8/docs/technotes/guides/security/jgss/tutorials/KerberosReq.html&quot; target=&quot;_blank&quot;&gt;Oracle Docs&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
ex:&amp;nbsp;&lt;b&gt;-Djava.security.krb5.conf=/file/location/krb5.conf&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
4) Configure WSO2 Datasources&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You can use&amp;nbsp;Kerberos based Authentication in your datasources XML files or datasources defined via the &#39;admin console&#39;. But make sure to pass correct parameters into SQL connection URL to use&amp;nbsp;Kerberos&amp;nbsp;Authentication. Please note, in the connection user and password fields, you can AD user&#39;s credentials.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
ex:&lt;b&gt;&amp;nbsp;jdbc:sqlserver://your.sql.server.com;database=database_name;&lt;span style=&quot;color: red;&quot;&gt;integratedSecurity=true;authenticationScheme=JavaKerberos&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
- &lt;a href=&quot;http://janbernhardt.blogspot.com/2017/02/kerberos-debugging-in-java.html&quot; target=&quot;_blank&quot;&gt;Kerberos Debugging in Java&lt;/a&gt;&lt;br /&gt;
- &lt;a href=&quot;https://www.microsoft.com/en-us/download/details.aspx?id=56615&quot; target=&quot;_blank&quot;&gt;Microsoft JDBC Driver 6.4 for SQL Server&lt;/a&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/3111963177901125568/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2019/12/configure-kerberos-based-authentication.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/3111963177901125568'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/3111963177901125568'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2019/12/configure-kerberos-based-authentication.html' title='Configure Kerberos based Authentication into WSO2 Datasources '/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-1404252299118784278</id><published>2019-12-01T08:30:00.000+10:30</published><updated>2019-12-01T08:30:05.634+10:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="WSO2"/><category scheme="http://www.blogger.com/atom/ns#" term="XML"/><category scheme="http://www.blogger.com/atom/ns#" term="XSLT"/><title type='text'>Compare Two XML Elements and Filter using WSO2 EI</title><content type='html'>&lt;br /&gt;
Think about an integration scenario, where you are getting a list of data from a service endpoint(Data 1) and you want to exclude or match this response against the data returned by another service endpoint(Data 2).&lt;br /&gt;
&lt;br /&gt;
In such a situation, first, you need to have a unique attribute in both data set to exclude or match elements. So in my use case, list of data and matching content is as below&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;CodeLists&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;CodeList&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;O&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Name&amp;gt;&lt;/span&gt;Open&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Name&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/CodeList&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;CodeList&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;C&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Name&amp;gt;&lt;/span&gt;Cancelled&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Name&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/CodeList&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;CodeList&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;X&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Name&amp;gt;&lt;/span&gt;Denied&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Name&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/CodeList&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;CodeList&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;P&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Name&amp;gt;&lt;/span&gt;Pending&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Name&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/CodeList&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;CodeList&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;D&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Name&amp;gt;&lt;/span&gt;Duplicate&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Name&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/CodeList&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/CodeLists&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
Data 1&lt;/div&gt;
&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;CodeLists&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;CodeList&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;O&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Name&amp;gt;&lt;/span&gt;Open&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Name&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/CodeList&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;CodeList&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;P&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Name&amp;gt;&lt;/span&gt;Pending&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Name&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/CodeList&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/CodeLists&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;Data 2&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
So here I am going to use WSO2 Enterprise Integrator and its XSLT mediator to filter the results. First I am joining all the elements that need to be hidden into a single Synapse property. &lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;property&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;elementsToBeHide&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;expression=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;string-join(//CodeLists/CodeList/Id, &#39;,&#39;)&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;scope=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;default&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;STRING&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
Then I am calling my XSLT with elementsToBeHide as a parameter.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;xslt&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;key=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;conf:/xslts/xslt_FilterResults.xslt&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;property&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;elementsToBeHide&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;expression=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;$ctx:elementsToBeHide&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/xslt&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
My XSLT file is stored in the registry. However, if you are using a Micro Integrator profile, you can add this XSLT as a local entry.&amp;nbsp; Inside my XSLT document, I am looping all code list elements and check whether each ID exists in &#39;elementsToBeHide&#39; parameter. You can use the same XSLT Choose Condition to filter data based on matching or not matching scenarios. In my example, if ID is not matching to the current ID, it will be added to Code element.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #557799;&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;xsl:stylesheet&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;version=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;2.0&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns:xsl=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://www.w3.org/1999/XSL/Transform&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns:xsi=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&lt;/span&gt;
 &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns:xs=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://www.w3.org/2001/XMLSchema&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns:sy=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://ws.apache.org/ns/synapse&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns:fn=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://www.w3.org/2005/xpath-functions&quot;&lt;/span&gt;
 &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns:i=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;xsl:strip-space&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;elements=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;*&quot;&lt;/span&gt; &lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
 
 &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;xsl:param&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;elementsToBeHide&quot;&lt;/span&gt; &lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;

 &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;xsl:template&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;match=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;/CodeLists&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;CodeLists&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;CodeList&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;xsl:for-each&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;select=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;CodeList&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;xsl:choose&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
             &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;xsl:when&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;test=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;matches($elementsToBeHide,Id)&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
       &lt;span style=&quot;color: #888888;&quot;&gt;&amp;lt;!-- match senarios --&amp;gt;&lt;/span&gt;
             &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;/xsl:when&amp;gt;&lt;/span&gt;
             &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;xsl:otherwise&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
       &lt;span style=&quot;color: #888888;&quot;&gt;&amp;lt;!-- not matching --&amp;gt;&lt;/span&gt;
              &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Code&amp;gt;&lt;/span&gt;
       &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Name&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;xsl:value-of&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;select=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;Name&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&amp;lt;/Name&amp;gt;&lt;/span&gt;
       &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;xsl:value-of&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;select=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;Id&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Code&amp;gt;&lt;/span&gt;
             &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;/xsl:otherwise&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;/xsl:choose&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;/xsl:for-each&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/CodeList&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/CodeLists&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;/xsl:template&amp;gt;&lt;/span&gt; 
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;&amp;lt;/xsl:stylesheet&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
The output of the XSLT transformation is as below and it only includes elements which are not matching to the filtering data set.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;CodeLists&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;CodeList&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Code&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;C&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Name&amp;gt;&lt;/span&gt;Cancelled&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Name&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Code&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Code&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;X&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Name&amp;gt;&lt;/span&gt;Denied&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Name&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Code&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Code&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;D&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Name&amp;gt;&lt;/span&gt;Duplicate&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Name&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Code&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/CodeList&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/CodeLists&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/1404252299118784278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2019/12/compare-two-xml-elements-and-filter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/1404252299118784278'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/1404252299118784278'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2019/12/compare-two-xml-elements-and-filter.html' title='Compare Two XML Elements and Filter using WSO2 EI'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-532691561380321932</id><published>2019-01-04T22:35:00.001+10:30</published><updated>2019-01-04T22:35:31.229+10:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="XML"/><category scheme="http://www.blogger.com/atom/ns#" term="XSLT"/><title type='text'>XSLT - Modify Date and DateTime value</title><content type='html'>If you want to perform date and time related opertions with XSLT &#39;date&#39; or &#39;dateTime&#39; values, you can use&amp;nbsp;&#39;xs:yearMonthDuration&#39; or &#39;xs:dayTimeDuration&#39; function to achieve this. You can add or reduce years, months, date, hours or even minutes through those functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&amp;nbsp;xs:yearMonthDuration&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
For this function input value is year month duration and it should be passed in&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/ISO_8601#Durations&quot;&gt;ISO_8601 format&lt;/a&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
n- the [n] is replaced by the value for each of the date and time elements&lt;br /&gt;
P - The duration designator(for period).&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
nY- the number of years.&lt;/div&gt;
&lt;div&gt;
nM- the number of months.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
ex: &lt;i&gt;xs:yearMonthDuration(&#39;P1Y2M&#39;)&lt;/i&gt; - 1 Year and 2 Months&lt;/div&gt;
&lt;div&gt;
ex:&amp;nbsp;&lt;i&gt;xs:yearMonthDuration(&#39;-P1Y2M&#39;)&lt;/i&gt;&amp;nbsp;- Negative 1 Year and 2 Months&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;xs:dayTimeDuration&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
For this function input value is day time duration and it also needs to be passed in&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/ISO_8601#Durations&quot;&gt;ISO_8601 format&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
n- the [n] is replaced by the value for each of the date and time elements&lt;br /&gt;
P - The duration designator(for&amp;nbsp;period).&lt;/div&gt;
&lt;div&gt;
nD- the number of days.&lt;/div&gt;
&lt;div&gt;
T- The date and time separator.&lt;/div&gt;
&lt;div&gt;
nH-&amp;nbsp;the number of hours.&lt;/div&gt;
&lt;div&gt;
nM- the number of minutes.&lt;/div&gt;
&lt;div&gt;
nS&amp;nbsp;- the number of seconds.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
ex: xs:dayTimeDuration(&#39;P3D&#39;) - 3 Days&lt;br /&gt;
&lt;div&gt;
ex: xs:dayTimeDuration(&#39;-P3D&#39;) - Negative 3 days&lt;/div&gt;
ex: xs:dayTimeDuration(&#39;P6DT50H80S&#39;) - 6 days, 50 hours, and 80 seconds&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
Example XSLT :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?xml version=&quot;1.0&quot;?&amp;gt;&lt;br /&gt;
&amp;lt;xsl:stylesheet version=&quot;2.0&quot;&lt;br /&gt;
&amp;nbsp; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&lt;br /&gt;
&amp;nbsp; xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:output method=&quot;text&quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:variable name=&quot;dT&quot; as=&quot;xs:dateTime&quot;&amp;nbsp; &amp;nbsp;select=&quot;xs:dateTime(&#39;2016-02-29T00:00:01&#39;)&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:variable name=&quot;d&quot; as=&quot;xs:date&quot; select=&quot;xs:date(&#39;2016-02-29&#39;)&quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:template match=&quot;/&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;xsl:text&amp;gt;Add 1 Year and 2 Months : &amp;lt;/xsl:text&amp;gt; &amp;lt;xsl:value-of select=&quot;($d+ xs:yearMonthDuration(&#39;P1Y2M&#39;))&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;xsl:text&amp;gt;&amp;amp;#xA;Negative 1 Year and 2 Month : &amp;lt;/xsl:text&amp;gt; &amp;lt;xsl:value-of select=&quot;($d+ xs:yearMonthDuration(&#39;-P1Y2M&#39;))&quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;xsl:text&amp;gt;&amp;amp;#xA;Add 3 Days : &amp;lt;/xsl:text&amp;gt; &amp;lt;xsl:value-of select=&quot;($dT+ xs:dayTimeDuration(&#39;P3D&#39;))&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;xsl:text&amp;gt;&amp;amp;#xA;Negative 3 days : &amp;lt;/xsl:text&amp;gt; &amp;lt;xsl:value-of select=&quot;($dT+xs:dayTimeDuration(&#39;-P3D&#39;))&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;xsl:text&amp;gt;&amp;amp;#xA;Add 6 days, 50 hours, and 80 seconds : &amp;lt;/xsl:text&amp;gt; &amp;lt;xsl:value-of select=&quot;($dT+ xs:dayTimeDuration(&#39;P6DT50H80S&#39;))&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;/xsl:template&amp;gt;&lt;br /&gt;
&amp;lt;/xsl:stylesheet&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/532691561380321932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2019/01/xslt-modify-date-and-datetime-value.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/532691561380321932'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/532691561380321932'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2019/01/xslt-modify-date-and-datetime-value.html' title='XSLT - Modify Date and DateTime value'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-8251001797362582878</id><published>2018-07-26T19:24:00.005+09:30</published><updated>2018-07-26T19:25:09.773+09:30</updated><title type='text'>WSO2 EI/ESB Change Backend Response Status Code</title><content type='html'>&lt;div&gt;
With WSO2 Enterprise Integrator or Enterprise Service Bus servers, if you want to change the backend server response code, you can set custom status status code as below:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&amp;lt;property name=&quot;HTTP_SC&quot; scope=&quot;axis2&quot; type=&quot;STRING&quot; value=&quot;403&quot;/&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you are getting&amp;nbsp;&#39;HTTP/1.1 202 Accepted&#39; response from your backend, you need to set &quot;SC_ACCEPTED&quot; as false by setting a custom&amp;nbsp;SC_ACCEPTED&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Ex:&amp;nbsp; Receiving 202 from backend and change it to 200&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;lt;filter regex=&quot;202&quot; source=&quot;$axis2:HTTP_SC&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;then&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property action=&quot;remove&quot; name=&quot;HTTP_SC&quot; scope=&quot;axis2&quot;/&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&quot;SC_ACCEPTED&quot; scope=&quot;axis2&quot; value=&quot;false&quot;/&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;property name=&quot;HTTP_SC&quot; scope=&quot;axis2&quot; type=&quot;STRING&quot; value=&quot;200&quot;/&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/then&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;else/&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/filter&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/8251001797362582878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2018/07/wso2-eiesb-change-backend-response.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/8251001797362582878'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/8251001797362582878'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2018/07/wso2-eiesb-change-backend-response.html' title='WSO2 EI/ESB Change Backend Response Status Code'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-269143548066637786</id><published>2018-06-06T17:38:00.000+09:30</published><updated>2018-06-06T17:38:53.563+09:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="WSO2"/><title type='text'>Read XML content of the LocalEntry in WSO2 ESB</title><content type='html'>&lt;div&gt;
Local Entry is one of the data storage points in the WSO2 Enterprise Service Bus, where you can store text strings, XML content, and File URLs.&amp;nbsp; I have been asked a question that, how can we read the content of the local entry&amp;nbsp;if it as an XML file.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Below is an example to read the content of the local entry(Name: NameOfLocalEntry) and assign&amp;nbsp;the value of XML elements as properties.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Content of Local Entry:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;lt;?xml version=&quot;1.0&quot;?&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;Server&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;userName&amp;gt;chandana&amp;lt;/userName&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;URL&amp;gt;blog.napagoda.com&amp;lt;/URL&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/Server&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Synapse Configuration:&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;lt;property name=&quot;localEntry&quot; expression=&quot;get-property(&#39;NameOfLocalEntry&#39;)&quot; scope=&quot;default&quot; type=&quot;OM&quot;/&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;property name=&quot;userName&quot; expression=&quot;$ctx:localEntry//*[local-name()=&#39;userName&#39;]&quot;/&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;property name=&quot;URL&quot; expression=&quot;$ctx:localEntry//*[local-name()=&#39;URL&#39;]&quot;/&amp;gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/269143548066637786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2018/06/read-xml-content-of-localentry-in-wso2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/269143548066637786'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/269143548066637786'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2018/06/read-xml-content-of-localentry-in-wso2.html' title='Read XML content of the LocalEntry in WSO2 ESB'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-4585785998245653704</id><published>2018-04-30T21:05:00.000+09:30</published><updated>2018-04-30T21:05:17.046+09:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="OpenSource"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2"/><category scheme="http://www.blogger.com/atom/ns#" term="XML"/><title type='text'>Payload Factory Mediators for JSON Message</title><content type='html'>WSO2 ESB/EI PayloadFactory mediator can be used to replace the contents of a message. As an example, if the backend is accepting a different message structure than what you are receiving, you can use PayloadFactory mediator to change the message structure. Other than that, if you want to transform XML payload into JSON or JSON to XML with different message structure you can use this mediator.&lt;br /&gt;
&lt;br /&gt;
Recently, I faced an issue while transforming a message into JSON which is originally read from a CSV file(using &lt;a href=&quot;https://blog.lakmali.com/2013/08/csv-to-xml-transformation-with-wso2-esb.html&quot; target=&quot;_blank&quot;&gt;Smooks Mediator&lt;/a&gt;). This message can have empty values in the content sometimes and such messages look like below:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&amp;lt;Users&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;lt;User&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;lt;FirstName&amp;gt;Chandana&amp;lt;/FirstName&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;lt;MiddleName/&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;lt;/Users&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;lt;/User&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
I initially wrote a payload factory mediator like below:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&amp;lt;payloadFactory media-type=&quot;json&quot;&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;format&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp;{&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &quot;UserInfo&quot;: {&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &quot;fName&quot;: &quot;$1&quot;,&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &quot;mName&quot;: &quot;$2&quot;&lt;/i&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/format&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;args&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;arg evaluator=&quot;xml&quot; expression=&quot;//User/FirstName&quot;/&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;arg evaluator=&quot;xml&quot; expression=&quot;//User/MiddleName&quot;/&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/args&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;lt;/payloadFactory&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
JSON Output from the Payloadfactory&amp;nbsp;mediator :&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;{&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &quot;UserInfo&quot;: {&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &quot;fName&quot;: &quot;Chandana&quot;,&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &quot;mName&quot;: &quot;{&quot;MiddleName&quot;:null}&quot;,&lt;/i&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
So you can see that JSON output is malformed, but this will work perfectly when you have a value for MiddleName field.&lt;br /&gt;
&lt;br /&gt;
To avoid this issue, what we have to do is, when we are passing arguments to the PayloadFactory mediator, we should pass text values(ex: FirstName/text()) instead of the XML object.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&amp;lt;payloadFactory media-type=&quot;json&quot;&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;format&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp;{&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &quot;UserInfo&quot;: {&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &quot;fName&quot;: &quot;$1&quot;,&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &quot;mName&quot;: &quot;$2&quot;&lt;/i&gt;&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/format&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;args&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;arg evaluator=&quot;xml&quot; expression=&quot;//User/FirstName/text()&quot;/&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;arg evaluator=&quot;xml&quot; expression=&quot;//User/MiddleName/text()&quot;/&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/args&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;lt;/payloadFactory&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/4585785998245653704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2018/04/payload-factory-mediators-for-json.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/4585785998245653704'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/4585785998245653704'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2018/04/payload-factory-mediators-for-json.html' title='Payload Factory Mediators for JSON Message'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-8778067255644973529</id><published>2018-02-22T06:58:00.000+10:30</published><updated>2018-02-22T08:51:38.113+10:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="WSO2"/><title type='text'> WSO2 ESB - How to use filter inside iterate mediator</title><content type='html'>&lt;br /&gt;
WSO2 ESB&#39;s Iterate mediator plays a very powerful role in the Splitter Enterprise Integration Pattern. Splitter Enterprise Integration Pattern is used when messages contain multiple elements that might have to be processed in different ways. The Splitter breaks out the composite message into a series of individual messages, each containing data related to one item.&lt;br /&gt;
&lt;br /&gt;
WSO2 ESB Iterate mediator split the message based on a given expression and process them separately. So think about a use case like you are getting multiple order items and you want to enrich each order item, by calling another endpoint and finally we need to aggregate all the enriched items.&lt;br /&gt;
&lt;br /&gt;
There you can use the Iterate mediator and after that aggregate mediator to aggregate all the enriched items.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt; ESB Proxy Service:&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #557799;&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;proxy&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://ws.apache.org/ns/synapse&quot;&lt;/span&gt;
       &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;IteService&quot;&lt;/span&gt;
       &lt;span style=&quot;color: #0000cc;&quot;&gt;transports=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http,https&quot;&lt;/span&gt;
       &lt;span style=&quot;color: #0000cc;&quot;&gt;statistics=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;disable&quot;&lt;/span&gt;
       &lt;span style=&quot;color: #0000cc;&quot;&gt;trace=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;disable&quot;&lt;/span&gt;
       &lt;span style=&quot;color: #0000cc;&quot;&gt;startOnLoad=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;target&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;inSequence&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;iterate&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;aggregateid&quot;&lt;/span&gt;
                  &lt;span style=&quot;color: #0000cc;&quot;&gt;preservePayload=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;true&quot;&lt;/span&gt;
                  &lt;span style=&quot;color: #0000cc;&quot;&gt;attachPath=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;//Collection&quot;&lt;/span&gt;
                  &lt;span style=&quot;color: #0000cc;&quot;&gt;expression=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;//Collection/Job&quot;&lt;/span&gt;
                  &lt;span style=&quot;color: #0000cc;&quot;&gt;sequential=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;target&amp;gt;&lt;/span&gt;
               &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;sequence&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;enrich&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;source&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;body&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;clone=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;target&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;property&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;property=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;originalRequest&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/enrich&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;payloadFactory&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;media-type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;xml&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;format&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;p:echoInt&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns:p=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://echo.services.core.carbon.wso2.org&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
                           &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;in&amp;gt;&lt;/span&gt;$1&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/in&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/p:echoInt&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/format&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;args&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;arg&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;evaluator=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;xml&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;expression=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;$body/Collection/Job/Id&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/args&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/payloadFactory&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;property&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;SOAPAction&quot;&lt;/span&gt;
                            &lt;span style=&quot;color: #0000cc;&quot;&gt;value=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;&amp;amp;#34;echoInt&amp;amp;#34;&quot;&lt;/span&gt;
                            &lt;span style=&quot;color: #0000cc;&quot;&gt;scope=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;transport&quot;&lt;/span&gt;
                            &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;STRING&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;call&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;endpoint&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;address&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;uri=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;https://localhost:8243/services/echo&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/endpoint&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/call&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;property&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns:ns=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://echo.services.core.carbon.wso2.org&quot;&lt;/span&gt;
                            &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;echoResponse&quot;&lt;/span&gt;
                            &lt;span style=&quot;color: #0000cc;&quot;&gt;expression=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;$body/ns:echoIntResponse&quot;&lt;/span&gt;
                            &lt;span style=&quot;color: #0000cc;&quot;&gt;scope=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;default&quot;&lt;/span&gt;
                            &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;OM&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;enrich&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;source&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;property&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;clone=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;true&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;property=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;originalRequest&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;target&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;body&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/enrich&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;enrich&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;source&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;property&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;clone=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;true&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;property=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;echoResponse&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;target&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;action=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;child&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xpath=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;$body/Collection&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/enrich&amp;gt;&lt;/span&gt;
               &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/sequence&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/target&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/iterate&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;property&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;Collections&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;scope=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;default&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Collections&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;aggregate&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;aggregateid&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;completeCondition&amp;gt;&lt;/span&gt;
               &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;messageCount&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;min=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;-1&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;max=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/completeCondition&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;onComplete&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;expression=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;$body/Collection&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;enclosingElementProperty=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;Collections&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
               &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;respond/&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/onComplete&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/aggregate&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/inSequence&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/target&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;description/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/proxy&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Request:&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;soapenv:Envelope&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns:soapenv=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;soapenv:Header/&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;soapenv:Body&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Collection&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Job&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;12345&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Job&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Job&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;12346&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Job&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Collection&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/soapenv:Body&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/soapenv:Envelope&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;Let me expand this use case. Assume we just need to enrich some of the items only. To do that, we have to use filter mediator inside the Iterate mediator. If we update our existing code with the filter mediator logic, it will never reach to the aggregate on-complete logic. The reason is aggregate mediator waits for total messages that came into the iterate mediator, but due to the filter logic, some messages aren&#39;t supposed to be included in the aggregation. To avoid this, what we can do is, we have to define this Iterate mediator inside the In-Sequence and after all the logic inside the Iterate mediator( before the tag) you have to add a loopback mediator and need to move aggregate mediator into Out-Sequence. This will call the aggregate mediator for all the messages.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Example:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
ESB Proxy Service:&lt;br /&gt;
&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #557799;&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;proxy&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://ws.apache.org/ns/synapse&quot;&lt;/span&gt;
       &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;IteFilterService&quot;&lt;/span&gt;
       &lt;span style=&quot;color: #0000cc;&quot;&gt;transports=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http,https&quot;&lt;/span&gt;
       &lt;span style=&quot;color: #0000cc;&quot;&gt;statistics=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;disable&quot;&lt;/span&gt;
       &lt;span style=&quot;color: #0000cc;&quot;&gt;trace=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;disable&quot;&lt;/span&gt;
       &lt;span style=&quot;color: #0000cc;&quot;&gt;startOnLoad=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;target&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;inSequence&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;iterate&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;aggregateid&quot;&lt;/span&gt;
                  &lt;span style=&quot;color: #0000cc;&quot;&gt;preservePayload=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;true&quot;&lt;/span&gt;
                  &lt;span style=&quot;color: #0000cc;&quot;&gt;attachPath=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;//Collection&quot;&lt;/span&gt;
                  &lt;span style=&quot;color: #0000cc;&quot;&gt;expression=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;//Collection/Job&quot;&lt;/span&gt;
                  &lt;span style=&quot;color: #0000cc;&quot;&gt;sequential=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;target&amp;gt;&lt;/span&gt;
               &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;sequence&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;property&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;JobId&quot;&lt;/span&gt;
                            &lt;span style=&quot;color: #0000cc;&quot;&gt;expression=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;string(//Job/Id)&quot;&lt;/span&gt;
                            &lt;span style=&quot;color: #0000cc;&quot;&gt;scope=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;default&quot;&lt;/span&gt;
                            &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;STRING&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;filter&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;source=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;$ctx:JobId&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;regex=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;[0-9]+&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;log&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;level=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;full&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;property&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;JobId&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;expression=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;string(//Job/Id)&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/log&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;enrich&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;source&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;body&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;clone=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;target&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;property&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;property=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;originalRequest&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/enrich&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;payloadFactory&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;media-type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;xml&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;format&amp;gt;&lt;/span&gt;
                           &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;p:echoInt&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns:p=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://echo.services.core.carbon.wso2.org&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
                              &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;in&amp;gt;&lt;/span&gt;$1&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/in&amp;gt;&lt;/span&gt;
                           &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/p:echoInt&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/format&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;args&amp;gt;&lt;/span&gt;
                           &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;arg&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;evaluator=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;xml&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;expression=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;$ctx:JobId&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/args&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/payloadFactory&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;property&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;SOAPAction&quot;&lt;/span&gt;
                               &lt;span style=&quot;color: #0000cc;&quot;&gt;value=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;&amp;amp;#34;echoInt&amp;amp;#34;&quot;&lt;/span&gt;
                               &lt;span style=&quot;color: #0000cc;&quot;&gt;scope=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;transport&quot;&lt;/span&gt;
                               &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;STRING&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;call&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;endpoint&amp;gt;&lt;/span&gt;
                           &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;address&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;uri=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;https://localhost:8243/services/echo&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/endpoint&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/call&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;property&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns:ns=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://echo.services.core.carbon.wso2.org&quot;&lt;/span&gt;
                               &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;echoResponse&quot;&lt;/span&gt;
                               &lt;span style=&quot;color: #0000cc;&quot;&gt;expression=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;$body/ns:echoIntResponse&quot;&lt;/span&gt;
                               &lt;span style=&quot;color: #0000cc;&quot;&gt;scope=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;default&quot;&lt;/span&gt;
                               &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;OM&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;enrich&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;source&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;property&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;clone=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;true&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;property=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;originalRequest&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;target&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;body&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/enrich&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;enrich&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;source&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;property&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;clone=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;true&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;property=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;echoResponse&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;target&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;action=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;child&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xpath=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;$body/Collection&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
                     &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/enrich&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/filter&amp;gt;&lt;/span&gt;
                  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;loopback/&amp;gt;&lt;/span&gt;
               &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/sequence&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/target&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/iterate&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/inSequence&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;outSequence&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;property&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;Collections&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;scope=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;default&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Collections&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;aggregate&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;aggregateid&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;completeCondition&amp;gt;&lt;/span&gt;
               &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;messageCount&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;min=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;-1&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;max=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;-1&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/completeCondition&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;onComplete&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;expression=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;$body/Collection&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;enclosingElementProperty=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;Collections&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
               &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;respond/&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/onComplete&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/aggregate&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/outSequence&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/target&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;description/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/proxy&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Request:&lt;br /&gt;
&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;soapenv:Envelope&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns:soapenv=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;soapenv:Header/&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;soapenv:Body&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Collection&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Job&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;AAAA&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Job&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Job&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;12345&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Job&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Job&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;Id&amp;gt;&lt;/span&gt;12346&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Id&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Job&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/Collection&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/soapenv:Body&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/soapenv:Envelope&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/8778067255644973529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2018/02/wso2-esb-how-to-use-filter-inside.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/8778067255644973529'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/8778067255644973529'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2018/02/wso2-esb-how-to-use-filter-inside.html' title=' WSO2 ESB - How to use filter inside iterate mediator'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-2710651271101744767</id><published>2017-12-19T08:56:00.000+10:30</published><updated>2017-12-19T08:56:22.269+10:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="OpenSource"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2"/><title type='text'>WSO2 ESB/EI Callout Mediator Error Scenario</title><content type='html'>&lt;br /&gt;
When using WSO2 Enterprise Service Bus, you can use &lt;a href=&quot;https://docs.wso2.com/display/ESB490/Call+Mediator&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Call&lt;/a&gt;, &lt;a href=&quot;https://docs.wso2.com/display/ESB490/Send+Mediator&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Send &lt;/a&gt;and &lt;a href=&quot;https://docs.wso2.com/display/ESB490/Callout+Mediator&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Callout&lt;/a&gt; mediators to invoke a service. If you are calling multiple service calls within your meditation sequence, you have to use either Call mediator or Callout mediator.&lt;br /&gt;
&lt;br /&gt;
As per the documentation, WSO2 Team is recommending to use Call mediator instead of the Callout mediator, due to much better performance. However, due to some legacy requirements, we might need to stay with Callout mediator for the time being.&lt;br /&gt;
&lt;br /&gt;
In my use case, there are some mediation scenarios with mutual SSL. So if you have noticed an &quot;UnrecoverableKeyException: Password verification failed&quot; exception in the WSO2Carbon log file and terminal when invoking an endpoint(backend service) using callout mediator, I would recommend you to check the Java SSL keyStore Password(values of the javax.net.ssl.keyStorePassword and javax.net.ssl.trustStorePassword environment variables) in&amp;nbsp; the &lt;esb_home&gt;/bin/wso2server.sh file or relevant location.&lt;/esb_home&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #997700; font-weight: bold;&quot;&gt;TID:&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;[-&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1234&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;[]&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;2017&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;12&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;16&lt;/span&gt; &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;13&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;04&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;28&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;193&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;]&lt;/span&gt;  INFO &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;axis2&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;transport&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;http&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;HTTPSender&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;-&lt;/span&gt;  Unable to sendViaPost to url&lt;span style=&quot;color: #333333;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #997700; font-weight: bold;&quot;&gt;http:&lt;/span&gt;&lt;span style=&quot;color: #888888;&quot;&gt;//blog.napagoda.com] {org.apache.axis2.transport.http.HTTPSender} UUID:[d7602d4a-17ac-4b95-b459-7fec3ffa44c0]&lt;/span&gt;
java&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;net&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;SocketException&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt; java&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;NoSuchAlgorithmException&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt; Error constructing implementation &lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #997700; font-weight: bold;&quot;&gt;algorithm:&lt;/span&gt; Default&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #997700; font-weight: bold;&quot;&gt;provider:&lt;/span&gt; SunJSSE&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #997700; font-weight: bold;&quot;&gt;class:&lt;/span&gt; sun&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;ssl&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;SSLContextImpl&lt;/span&gt;$DefaultSSLContext&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at javax&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;net&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;ssl&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;DefaultSSLSocketFactory&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;throwException&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;SSLSocketFactory&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;248&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at javax&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;net&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;ssl&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;DefaultSSLSocketFactory&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;createSocket&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;SSLSocketFactory&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;285&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;commons&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;httpclient&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;protocol&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;SSLProtocolSocketFactory&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;createSocket&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;SSLProtocolSocketFactory&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;155&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;commons&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;httpclient&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;HttpConnection&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;open&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;HttpConnection&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;707&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;commons&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;httpclient&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;MultiThreadedHttpConnectionManager&lt;/span&gt;$HttpConnectionAdapter&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;open&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;MultiThreadedHttpConnectionManager&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1361&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;commons&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;httpclient&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;HttpMethodDirector&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;executeWithRetry&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;HttpMethodDirector&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;387&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;commons&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;httpclient&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;HttpMethodDirector&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;executeMethod&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;HttpMethodDirector&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;171&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;commons&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;httpclient&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;HttpClient&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;executeMethod&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;HttpClient&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;397&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;axis2&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;transport&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;http&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;AbstractHTTPSender&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;executeMethod&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;AbstractHTTPSender&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;688&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;axis2&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;transport&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;http&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;HTTPSender&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;sendViaPost&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;HTTPSender&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;195&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;axis2&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;transport&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;http&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;HTTPSender&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;send&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;HTTPSender&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;77&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;axis2&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;transport&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;http&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;CommonsHTTPTransportSender&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;writeMessageWithCommons&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;CommonsHTTPTransportSender&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;451&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;axis2&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;transport&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;http&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;CommonsHTTPTransportSender&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;invoke&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;CommonsHTTPTransportSender&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;278&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;axis2&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;engine&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;AxisEngine&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;send&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;AxisEngine&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;442&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;axis2&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;description&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;OutInAxisOperationClient&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;send&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;OutInAxisOperation&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;430&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;axis2&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;description&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;OutInAxisOperationClient&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;executeImpl&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;OutInAxisOperation&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;225&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;axis2&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;client&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;OperationClient&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;execute&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;OperationClient&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;149&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;synapse&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;message&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;senders&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;blocking&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;BlockingMsgSender&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;sendReceive&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;BlockingMsgSender&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;310&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;synapse&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;message&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;senders&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;blocking&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;BlockingMsgSender&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;send&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;BlockingMsgSender&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;216&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        &lt;b&gt;at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;synapse&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediators&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;builtin&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;CalloutMediator&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediate&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;CalloutMediator&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;180&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;&lt;/b&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;synapse&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediators&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;AbstractListMediator&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediate&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;AbstractListMediator&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;89&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;synapse&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediators&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;AbstractListMediator&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediate&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;AbstractListMediator&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;56&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;synapse&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediators&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;SequenceMediator&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediate&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;SequenceMediator&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;149&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;synapse&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediators&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;SequenceMediator&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediate&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;SequenceMediator&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;221&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;synapse&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediators&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;AbstractListMediator&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediate&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;AbstractListMediator&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;89&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;synapse&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediators&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;AbstractListMediator&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediate&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;AbstractListMediator&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;56&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;synapse&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediators&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;SequenceMediator&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;mediate&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;SequenceMediator&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;149&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;synapse&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;core&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;axis2&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;ProxyServiceMessageReceiver&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;receive&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;ProxyServiceMessageReceiver&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;197&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;axis2&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;engine&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;AxisEngine&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;receive&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;AxisEngine&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;180&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;synapse&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;transport&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;passthru&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;ServerWorker&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;processEntityEnclosingRequest&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;ServerWorker&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;395&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;synapse&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;transport&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;passthru&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;ServerWorker&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;ServerWorker&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;142&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at org&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;apache&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;axis2&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;transport&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;threads&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;NativeWorkerPool&lt;/span&gt;$1&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;NativeWorkerPool&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;172&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at java&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;util&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;concurrent&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;ThreadPoolExecutor&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;runWorker&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;ThreadPoolExecutor&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1142&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at java&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;util&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;concurrent&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;ThreadPoolExecutor&lt;/span&gt;$Worker&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;ThreadPoolExecutor&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;617&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at java&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;lang&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;Thread&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;Thread&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;745&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
Caused &lt;span style=&quot;color: #997700; font-weight: bold;&quot;&gt;by:&lt;/span&gt; java&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;NoSuchAlgorithmException&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt; Error constructing implementation &lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #997700; font-weight: bold;&quot;&gt;algorithm:&lt;/span&gt; Default&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #997700; font-weight: bold;&quot;&gt;provider:&lt;/span&gt; SunJSSE&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #997700; font-weight: bold;&quot;&gt;class:&lt;/span&gt; sun&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;ssl&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;SSLContextImpl&lt;/span&gt;$DefaultSSLContext&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at java&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;Provider&lt;/span&gt;$Service&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;newInstance&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;Provider&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1617&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at sun&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;jca&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;GetInstance&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getInstance&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;GetInstance&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;236&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at sun&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;jca&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;GetInstance&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getInstance&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;GetInstance&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;164&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at javax&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;net&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;ssl&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;SSLContext&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getInstance&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;SSLContext&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;156&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at javax&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;net&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;ssl&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;SSLContext&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getDefault&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;SSLContext&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;96&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at javax&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;net&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;ssl&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;SSLSocketFactory&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getDefault&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;SSLSocketFactory&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;122&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: #333333;&quot;&gt;...&lt;/span&gt; &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;33&lt;/span&gt; more
Caused &lt;span style=&quot;color: #997700; font-weight: bold;&quot;&gt;by:&lt;/span&gt; java&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;io&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;IOException&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt; Keystore was tampered with&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; or password was incorrect
        at sun&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;provider&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;JavaKeyStore&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;engineLoad&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;JavaKeyStore&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;780&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at sun&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;provider&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;JavaKeyStore&lt;/span&gt;$JKS&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;engineLoad&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;JavaKeyStore&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;56&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at sun&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;provider&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;KeyStoreDelegator&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;engineLoad&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;KeyStoreDelegator&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;224&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at sun&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;provider&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;JavaKeyStore&lt;/span&gt;$DualFormatJKS&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;engineLoad&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;JavaKeyStore&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;70&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at java&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;KeyStore&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;load&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;KeyStore&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1445&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at sun&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;ssl&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;SSLContextImpl&lt;/span&gt;$DefaultSSLContext&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getDefaultKeyManager&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;SSLContextImpl&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;852&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at sun&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;ssl&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;SSLContextImpl&lt;/span&gt;$DefaultSSLContext&lt;span style=&quot;color: #333333;&quot;&gt;.&amp;lt;&lt;/span&gt;init&lt;span style=&quot;color: #333333;&quot;&gt;&amp;gt;(&lt;/span&gt;SSLContextImpl&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;732&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at sun&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;reflect&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;GeneratedConstructorAccessor131&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;newInstance&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;Unknown Source&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at sun&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;reflect&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;DelegatingConstructorAccessorImpl&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;newInstance&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;DelegatingConstructorAccessorImpl&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;45&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at java&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;lang&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;reflect&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;Constructor&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;newInstance&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;Constructor&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;423&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        at java&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;Provider&lt;/span&gt;$Service&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;newInstance&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;Provider&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1595&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: #333333;&quot;&gt;...&lt;/span&gt; &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;38&lt;/span&gt; more
Caused &lt;span style=&quot;color: #997700; font-weight: bold;&quot;&gt;by:&lt;/span&gt; java&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;UnrecoverableKeyException&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Password verification failed&lt;/span&gt;
        at sun&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;security&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;provider&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;JavaKeyStore&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;engineLoad&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;JavaKeyStore&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;java&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;778&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: #333333;&quot;&gt;...&lt;/span&gt; &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;48&lt;/span&gt; more
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/2710651271101744767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2017/12/wso2-esbei-callout-mediator-error.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/2710651271101744767'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/2710651271101744767'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2017/12/wso2-esbei-callout-mediator-error.html' title='WSO2 ESB/EI Callout Mediator Error Scenario'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-7487091152328787320</id><published>2017-12-10T10:05:00.000+10:30</published><updated>2017-12-10T10:05:23.588+10:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="OpenSource"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2"/><title type='text'>WSO2 ESB/EI Send XML content to backend </title><content type='html'>When sending XML content inside the payload to the backend via WSO2 ESB,&amp;nbsp; we have to encode it and send it. In my usecase,&amp;nbsp; I have a Data Service which is accepting&amp;nbsp;XML content as a parameter.&lt;br /&gt;
&lt;br /&gt;
To implement&amp;nbsp;this requirement, we can&#39;t directly define CDATA(blocks of text that are not parsed by XML parser) inside the payload factory mediator. So we have two option to do so.&lt;br /&gt;
&lt;br /&gt;
The first option is that&amp;nbsp;Encode XML content using Script mediator and use encoded&amp;nbsp;value inside the payload factory mediator. You can read&amp;nbsp;&lt;a href=&quot;http://marxsoftware.blogspot.com.au/2013/07/escaping-xml-with-groovy-21.html&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Hasitha&#39;s blog&lt;/a&gt; on this topic.&lt;br /&gt;
&lt;br /&gt;
The second&amp;nbsp;option is storing the format section of the payload factory mediator, in the registry. There you can directly define the CDATA tags inside the XML content stored in the registry. This allows you to define &amp;nbsp;CDATA inside payload factory mediator.&lt;br /&gt;
&lt;br /&gt;
An example usecase&amp;nbsp;is as below:&lt;br /&gt;
&lt;br /&gt;
PayloadFacroy Mediator:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #557799;&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;payloadFactory&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;media-type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;xml&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;format&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;key=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;conf:/format/Common_Error_Message.xml&quot;&lt;/span&gt; &lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;args&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;arg&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;evaluator=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;xml&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;expression=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;$ctx:ORIGINAL_MESSAGE&quot;&lt;/span&gt; &lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;arg&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;expression=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;$axis2:HTTP_SC&quot;&lt;/span&gt; &lt;span style=&quot;color: #007700;&quot;&gt;/&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/args&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/payloadFactory&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Registry Content:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #557799;&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;xs:logError&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns:xs=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://wso2.org/services/data/error&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;xs:originalPayload&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #557799;&quot;&gt;&amp;lt;![CDATA[$1]]&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/xs:originalPayload&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;xs:statusCode&amp;gt;&lt;/span&gt;$2&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/xs:statusCode&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/xs:logError&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/7487091152328787320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2017/12/wso2-esbei-send-xml-content-to-backend.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/7487091152328787320'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/7487091152328787320'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2017/12/wso2-esbei-send-xml-content-to-backend.html' title='WSO2 ESB/EI Send XML content to backend '/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-3249407697543343254</id><published>2017-10-14T00:30:00.000+10:30</published><updated>2017-10-14T00:30:37.014+10:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Maven"/><category scheme="http://www.blogger.com/atom/ns#" term="OpenSource"/><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>Secure Spring Boot  REST API using Basic Authentication</title><content type='html'>This is the third post of my Spring Boot Blog post series. In the very first post, I talked about my experience with &lt;a href=&quot;http://blog.napagoda.com/2017/09/building-restful-service-using-spring.html&quot; target=&quot;_blank&quot;&gt;creating RESTFul Services using Spring Boot.&lt;/a&gt; Then I have expanded the sample to &lt;a href=&quot;http://blog.napagoda.com/2017/09/integrating-swagger-with-spring-boot.html&quot; target=&quot;_blank&quot;&gt;integrate with Swagger &lt;/a&gt;documentation. In this post, I am going to expand above sample with security aspect.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What is API Security&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
API Security is a wide area with many different definitions, meanings, and solutions. The main key terms in API security are Authorization, Authentication, Encryption, Federation, and Delegation. However, I am not going to talk about each of them here.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What is Authentication&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Authentication is used to reliably determine the identity of an end user and give access to the resources based on the correctly identified user.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What is Basic Authentication&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Basic Authentication is the simplest way to enforce access controling to resources. Here, the HTTP user agent provides the username and the password when making a request. The string containing the username and password separated by a colon is Base64 encoded before sending to the backend when authentication is required.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;How to Invoke Basic Auth Protected API&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Option 1: Send Authorization header. This value is base64 encoded username:password&lt;br /&gt;
&lt;br /&gt;
Ex: &quot;Authorization: Basic Y2hhbmRhbmE6Y2hhbmRhbmE=&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;curl -X GET http://localhost:8080/admin/hello/chandana -H &#39;authorization: Basic Y2hhbmRhbmE6Y2hhbmRhbmE=&#39;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Option 2: Using URL:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;curl -X GET -u username:password&amp;nbsp; http://localhost:8080/admin/hello/chandana&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OK, we talked about basic stuff. So let&#39;s move to see how to secure a REST API using Spring Security. You can download the initial sample code from my GitHub repo(Swagger Spring Boot Project source code)&lt;br /&gt;
&lt;br /&gt;
To enhance our previous sample with basic auth security, first I am going to add &quot;spring-boot-starter-security&quot; and &quot;spring-boot-starter-tomcat&quot; dependencies into the pom file.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;        &lt;span style=&quot;color: #888888;&quot;&gt;&amp;lt;!-- --&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework.boot&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-boot-starter-security&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;javax.servlet&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;javax.servlet-api&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;version&amp;gt;&lt;/span&gt;3.1.0&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Next step is that our configuration class is annotated with @EnableWebSecurity annotation and configuration class is extended from the WebSecurityConfigurerAdapter. The EnableWebSecurity annotation will enable Spring-Security web security support.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #555555; font-weight: bold;&quot;&gt;@Configuration&lt;/span&gt;
&lt;span style=&quot;color: #555555; font-weight: bold;&quot;&gt;@EnableSwagger2&lt;/span&gt;
&lt;span style=&quot;color: #555555; font-weight: bold;&quot;&gt;@EnableWebSecurity&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #bb0066; font-weight: bold;&quot;&gt;ApplicationConfig&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;extends&lt;/span&gt; WebSecurityConfigurerAdapter &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Overridden configure(HttpSecurity) method is used to define which URL paths should be secured and which should not be. In my example &quot;/&quot; and &quot;/api&quot; paths are not required any authentication and any other paths(ex:&amp;nbsp; &quot;admin&quot;) should be authenticated with basic auth.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #555555; font-weight: bold;&quot;&gt;@Override&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;configure&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;HttpSecurity http&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;throws&lt;/span&gt; Exception &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
        http&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;csrf&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;disable&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
        http&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;authorizeRequests&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;antMatchers&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;/api/**&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;permitAll&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;()&lt;/span&gt;
        &lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;anyRequest&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;authenticated&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
        http&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;httpBasic&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;authenticationEntryPoint&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;basicAuthenticationPoint&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
&lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
In the configureGlobal(AuthenticationManagerBuilder) method, I have created an in-memory user store with a user called &#39;chandana&#39;. There I have added username, password, and userole for the in-memory user.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;    &lt;span style=&quot;color: #555555; font-weight: bold;&quot;&gt;@Autowired&lt;/span&gt;
    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;configureGlobal&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;AuthenticationManagerBuilder auth&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;throws&lt;/span&gt; Exception &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
        auth&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;inMemoryAuthentication&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;withUser&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;chandana&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;password&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;chandana&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;roles&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;USER&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
    &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
In Addition to that, you can see that I have added autowired BasicAuthenticationPoint, into my config class. Purpose of the BasicAuthenticationEntryPoint class is to set the &quot;WWW-Authenticate&quot; header to the response. So, web browsers will display a dialog to enter usename and password based on basic authentication mechanism(WWW-Authenticate header)&lt;br /&gt;
&lt;br /&gt;
Then you can run the sample using &quot;mvn spring-boot:run&quot;. When you are accessing &quot;localhost:8080/api/hello/chandana&quot; basic authentication is not required to invoke the api. However, if you try to access the &quot;localhost:8080/admin/hello/chandana&quot; it will be required to provide basic auth credentials to access the resource.&lt;br /&gt;
&lt;br /&gt;
AppConfig class:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; package com.chandana.helloworld.config;  
 import org.springframework.beans.factory.annotation.Autowired;  
 import org.springframework.context.annotation.Bean;  
 import org.springframework.context.annotation.Configuration;  
 import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;  
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;  
 import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;  
 import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;  
 import springfox.documentation.builders.ApiInfoBuilder;  
 import springfox.documentation.builders.PathSelectors;  
 import springfox.documentation.builders.RequestHandlerSelectors;  
 import springfox.documentation.service.ApiInfo;  
 import springfox.documentation.service.Contact;  
 import springfox.documentation.spi.DocumentationType;  
 import springfox.documentation.spring.web.plugins.Docket;  
 import springfox.documentation.swagger2.annotations.EnableSwagger2;  
 @Configuration  
 @EnableSwagger2  
 @EnableWebSecurity  
 public class ApplicationConfig extends WebSecurityConfigurerAdapter {  
   @Autowired  
   private BasicAuthenticationPoint basicAuthenticationPoint;  
   @Bean  
   public Docket api() {  
     return new Docket(DocumentationType.SWAGGER_2)  
         .apiInfo(getApiInfo())  
         .select()  
         .apis(RequestHandlerSelectors.basePackage(&quot;com.chandana.helloworld.controllers&quot;))  
         .paths(PathSelectors.any())  
         .build();  
   }  
   @Override  
   protected void configure(HttpSecurity http) throws Exception {  
     http.csrf().disable();  
     http.authorizeRequests().antMatchers(&quot;/&quot;, &quot;/api/**&quot;).permitAll()  
     .anyRequest().authenticated();  
     http.httpBasic().authenticationEntryPoint(basicAuthenticationPoint);  
   }  
   private ApiInfo getApiInfo() {  
     Contact contact = new Contact(&quot;Chandana Napagoda&quot;, &quot;http://blog.napagoda.com&quot;, &quot;cnapagoda@gmail.com&quot;);  
     return new ApiInfoBuilder()  
         .title(&quot;Example Api Title&quot;)  
         .description(&quot;Example Api Definition&quot;)  
         .version(&quot;1.0.0&quot;)  
         .license(&quot;Apache 2.0&quot;)  
         .licenseUrl(&quot;http://www.apache.org/licenses/LICENSE-2.0&quot;)  
         .contact(contact)  
         .build();  
   }  
   @Autowired  
   public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {  
     auth.inMemoryAuthentication().withUser(&quot;chandana&quot;).password(&quot;chandana&quot;).roles(&quot;USER&quot;);  
   }  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
BasicAuthenticationEntryPoint&amp;nbsp; class:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; package com.chandana.helloworld.config;  
 import org.springframework.security.core.AuthenticationException;  
 import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint;  
 import org.springframework.stereotype.Component;  
 import java.io.IOException;  
 import java.io.PrintWriter;  
 import javax.servlet.ServletException;  
 import javax.servlet.http.HttpServletRequest;  
 import javax.servlet.http.HttpServletResponse;  
 @Component  
 public class BasicAuthenticationPoint extends BasicAuthenticationEntryPoint {  
   @Override  
   public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authEx)  
       throws IOException, ServletException {  
     response.addHeader(&quot;WWW-Authenticate&quot;, &quot;Basic realm=&quot; +getRealmName());  
     response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);  
     PrintWriter writer = response.getWriter();  
     writer.println(&quot;HTTP Status 401 - &quot; + authEx.getMessage());  
   }  
   @Override  
   public void afterPropertiesSet() throws Exception {  
     setRealmName(&quot;Chandana&quot;);  
     super.afterPropertiesSet();  
   }  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
You can download &lt;a href=&quot;https://github.com/cnapagoda/spring-boot-basic-auth&quot; target=&quot;_blank&quot;&gt;Spring Boot Basic Auth Project&lt;/a&gt; source code from my GitHub repo as well.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/3249407697543343254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2017/10/secure-spring-boot-rest-api-using-basic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/3249407697543343254'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/3249407697543343254'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2017/10/secure-spring-boot-rest-api-using-basic.html' title='Secure Spring Boot  REST API using Basic Authentication'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-5769489755198971384</id><published>2017-09-16T22:53:00.000+09:30</published><updated>2018-05-27T17:44:43.836+09:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="OpenSource"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2 Governance Registry"/><title type='text'>Introduction to WSO2 Registry Mounting </title><content type='html'>This post is based on the common questions raised about registry mounting and how it works etc. Below are the main questions people ask:&lt;br /&gt;
&lt;br /&gt;
1). How mounting works?&lt;br /&gt;
2). What is the difference between Config Registry and Governance Registry?&lt;br /&gt;
3). Can I use databases other than H2 for Local Registry?&lt;br /&gt;
4). What is meant by mount path and target path?&lt;br /&gt;
5). Do I need to configure “remoteInstance” URL?&lt;br /&gt;
6). What should I use as the cacheId?&lt;br /&gt;
&lt;br /&gt;
So let&#39;s start with how to configure a registry mount. When you are configuring the registry mount, you have to add the relevant data source to the master-datasources.xml file. In addition to that, you have to add mounting related configuration into the registry.xml file as well.&lt;br /&gt;
&lt;br /&gt;
In the master-datasources.xml file you have to just configure a JDBC data source by providing JDBC URL, username, password, validation queries, connection optimization parameters, etc. An example data source entry will look like below. &lt;span style=&quot;color: red;&quot;&gt;Note: You need to add below configuration in addition to the existing &#39;WSO2CarbonDB&#39; data source.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;

&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;datasource&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;name&amp;gt;&lt;/span&gt;WSO2CarbonDB_Gov&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/name&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;description&amp;gt;&lt;/span&gt;The datasource used for registry- config/governance&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/description&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;jndiConfig&amp;gt;&lt;/span&gt;
                &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;name&amp;gt;&lt;/span&gt;jdbc/WSO2CarbonDB_Gov&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/name&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/jndiConfig&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;definition&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;RDBMS&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
                &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;configuration&amp;gt;&lt;/span&gt;
                    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;url&amp;gt;&lt;/span&gt;jdbc:mysql://blog.napagoda.com:3306/REGISTRY_DB?autoReconnect=true&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/url&amp;gt;&lt;/span&gt;
                    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;username&amp;gt;&lt;/span&gt;chandana&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/username&amp;gt;&lt;/span&gt;
                    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;password&amp;gt;&lt;/span&gt;password&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/password&amp;gt;&lt;/span&gt;
                    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;driverClassName&amp;gt;&lt;/span&gt;com.mysql.jdbc.Driver&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/driverClassName&amp;gt;&lt;/span&gt;
                    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;maxActive&amp;gt;&lt;/span&gt;50&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/maxActive&amp;gt;&lt;/span&gt;
                    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;maxWait&amp;gt;&lt;/span&gt;60000&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/maxWait&amp;gt;&lt;/span&gt;
                    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;testOnBorrow&amp;gt;&lt;/span&gt;true&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/testOnBorrow&amp;gt;&lt;/span&gt;
                    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;validationQuery&amp;gt;&lt;/span&gt;SELECT 1&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/validationQuery&amp;gt;&lt;/span&gt;
                    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;validationInterval&amp;gt;&lt;/span&gt;30000&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/validationInterval&amp;gt;&lt;/span&gt;
                &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/configuration&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/definition&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/datasource&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
In the registry.xml file, there are many vexed areas available. So let’s see an example mounting configuration first.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;dbConfig&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;mounted_registry&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;dataSource&amp;gt;&lt;/span&gt;jdbc/WSO2CarbonDB_Gov&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/dataSource&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/dbConfig&amp;gt;&lt;/span&gt;

&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;remoteInstance&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;url=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;https://localhost:9443/registry&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;id&amp;gt;&lt;/span&gt;instanceid&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;dbConfig&amp;gt;&lt;/span&gt;mounted_registry&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/dbConfig&amp;gt;&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;readOnly&amp;gt;&lt;/span&gt;false&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/readOnly&amp;gt;&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;enableCache&amp;gt;&lt;/span&gt;true&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/enableCache&amp;gt;&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;registryRoot&amp;gt;&lt;/span&gt;/&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/registryRoot&amp;gt;&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;cacheId&amp;gt;&lt;/span&gt;chandana@jdbc:mysql://blog.napagoda.com:3306/REGISTRY_DB?autoReconnect=true&amp;lt;/cacheId&amp;gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/remoteInstance&amp;gt;&lt;/span&gt;

&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;mount&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;path=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;/_system/config&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;overwrite=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;instanceId&amp;gt;&lt;/span&gt;instanceid&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/instanceId&amp;gt;&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;targetPath&amp;gt;&lt;/span&gt;/_system/apimconfig&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/targetPath&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/mount&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;mount&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;path=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;/_system/governance&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;overwrite=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;instanceId&amp;gt;&lt;/span&gt;instanceid&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/instanceId&amp;gt;&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;targetPath&amp;gt;&lt;/span&gt;/_system/governance&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/targetPath&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/mount&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;;&quot;&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
You can see that when defining a mounting configuration, I have added four sections of configurations. They are ‘dbConfig’, ‘remoteInstance’ and two sections of the ‘mount’ entry.&lt;br /&gt;
&lt;br /&gt;
I think it&#39;s easy to explain from the mount entry first, then remoteInstance and dbConfig. In the mount entry, you can configure path, overwrite, targetPath, and instanceId.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;Mount&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;path &lt;/b&gt;- Path is a location in the registry which is similar to a file system path. Resources stored inside this path will be store in relevant configured DB.&lt;br /&gt;
&lt;b&gt;overwrite&lt;/b&gt;- (Virtual, True, False)Whether an existing collection/resource at the given path would be overwritten or not. Virtual means changes are only stored in the memory and will not be written into the DB.&lt;br /&gt;
&lt;b&gt;instanceId &lt;/b&gt;- Reference to the ‘remoteInstance’.&lt;br /&gt;
&lt;b&gt;targetPath &lt;/b&gt;- The path which is stored in the database.&lt;br /&gt;
&lt;br /&gt;
In nutshell, any registry paths which are starting with the value in the path section will be stored in the DB against targetPath(path will be replaced with targetPath and stored in the DB). When retrieving registry path it will do the reverse replacement as well. &amp;nbsp;So this target path will not be visible to you at all. If you are too curious to know about that, you can verify it by querying REG_PATH table.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;remoteInstance&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&#39;remoteInstance&#39; is the mapping between &#39;dbConfig&#39; and Mounts. This mapping is handled via &#39;id&#39; and &#39;dbConfig&#39; elements. The &#39;id&#39; value referred in the each mounting configurations and value of dbConfig element should be same as dbConfig name. In addition to that &#39;cacheId&#39; is one of the most important configurations in this section.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;url &lt;/b&gt;- Registry URL of the local registry instance. This is only used in the WSO2 Governance Registry product. So you can use any value for the other products.&lt;br /&gt;
&lt;b&gt;readOnly &lt;/b&gt;- Whether the instance is read-only.&lt;br /&gt;
&lt;b&gt;registryRoot &lt;/b&gt;- The root of the registry instance.&lt;br /&gt;
&lt;b&gt;enableCache &lt;/b&gt;- Whether caching is enabled or not.&lt;br /&gt;
&lt;b&gt;cacheId &lt;/b&gt;- This is an unique identification of the remote instance used in distributed caching layer. &amp;nbsp;Here we are recommending to use the cache id as registry DBUsername@DBUrl.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;b&gt;dbConfig&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This dbConfig is a reference to the data source added in the master-datasources.xml file. Note that you should not remove or modify default dbConfig available in the registry.xml file. Instead of that, you need to add a new dbConfig element. Further, as the name of the newly adding dbConfig, you should use a name other than &#39;wso2registry&#39;, since it has been used as the default dbConfig name.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So, let me answer to other questions. Any WSO2 product(released before 2018) internally consist three registry spaces. they are local, config and governance.&lt;br /&gt;
&lt;br /&gt;
Local Registry(repository) is used to store instance specific information such as last index time&#39;, etc.&lt;br /&gt;
Config Registry(repository) is the place to store information that can only be shared with same products and if multinode product cluster, this section will be shared.&lt;br /&gt;
Governance Registry(repository) is the place to store configurations and data that are shared across the whole WSO2 platform.&lt;br /&gt;
&lt;br /&gt;
We are recommending to store config and governance sections in an external database system. Since the Local Registry(repository) section is instance specific, we are recommending to store it with default H2 database. Information which are stored in the local registry are fail-safe and can be recovered. Please note that if you are willing to store Local section in an external RDBMS, you have to create a separate database(schema) for each instance.&lt;br /&gt;
&lt;br /&gt;
So let’s &amp;nbsp;move on to validating my mounting configuration. In your &#39;remoteInstance&#39; configuration you have to correctly refer the dbConfig name. This DB config name should not be the same one which we used for Local Registry. In addition that, you have to properly map each &#39;mount&#39; section to the &#39;remoteInstance&#39; using the instanceId.&lt;br /&gt;
&lt;br /&gt;
If you have any questions which are related to registry mounting, you can comment here. I am happy to help you.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/5769489755198971384/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2017/09/introduction-to-wso2-registry-mounting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/5769489755198971384'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/5769489755198971384'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2017/09/introduction-to-wso2-registry-mounting.html' title='Introduction to WSO2 Registry Mounting '/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-1397836182888757343</id><published>2017-09-12T00:04:00.001+09:30</published><updated>2024-06-23T01:05:41.210+09:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Maven"/><category scheme="http://www.blogger.com/atom/ns#" term="OpenSource"/><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>Integrating Swagger with Spring Boot REST API</title><content type='html'>&lt;div&gt;&lt;b&gt;Update Notice&lt;/b&gt;: This blog post was published on 2017 and may contain outdated information. For the most up-to-date guide on&lt;a href=&quot;https://blog.napagoda.com/2024/06/integrate-swagger-3-with-spring-boot3-api.html&quot; target=&quot;_blank&quot;&gt; integrating Swagger with Spring Boot REST API&lt;/a&gt;, please refer to my latest post :&amp;nbsp;&lt;a href=&quot;https://blog.napagoda.com/2024/06/integrate-swagger-3-with-spring-boot3-api.html&quot;&gt;https://blog.napagoda.com/2024/06/integrate-swagger-3-with-spring-boot3-api.html&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;In the last post, I talked about my experience with &lt;a href=&quot;http://blog.napagoda.com/2017/09/building-restful-service-using-spring.html&quot; target=&quot;_blank&quot;&gt;creating RESTFul Services using Spring Boot&lt;/a&gt;. When creating a REST API, proper documentation is a mandatory part of it.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt; &lt;b&gt;What is Swagger?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://swagger.io/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Swagger&lt;/a&gt;(Swagger 2) is a specification for describing and documenting a REST API. It specifies the format of the REST web services including URL, Resources, methods, etc. Swagger will generate documentation from the application code and handle the rendering part as well.&lt;br /&gt;
&lt;br /&gt;
In this post, I am going to integrate Swagger 2 documentation into a Spring Boot based REST web service. So I am going to use &lt;a href=&quot;http://springfox.github.io/springfox/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Springfox&lt;/a&gt; implementation to generate the swagger documentation. If you want to know how to run/build Spring Boot project, please refer my previous post.&lt;br /&gt;
&lt;br /&gt;
Springfox provides two dependencies to generate API Doc and Swagger UI. If you are not expecting to integrate Swagger UI into your API level, no need to add &amp;nbsp;Swagger UI dependency.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;dependency&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;groupId&amp;gt;io.springfox&amp;lt;/groupId&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;artifactId&amp;gt;springfox-swagger2&amp;lt;/artifactId&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;version&amp;gt;2.7.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/dependency&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dependency&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;groupId&amp;gt;io.springfox&amp;lt;/groupId&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;artifactId&amp;gt;springfox-swagger-ui&amp;lt;/artifactId&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;version&amp;gt;2.7.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/dependency&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
@&lt;a href=&quot;http://springfox.github.io/springfox/javadoc/2.5.0/springfox/documentation/swagger2/annotations/EnableSwagger2.html&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;EnableSwagger2&lt;/a&gt; annotation enables Springfox Swagger support in the class. &amp;nbsp;To document the service, Springfox uses a Docket. The Docket helps to configure a subset of the services to be documented and group them by a name, etc. The most hidden concept is that the Springfox works by examining an application at runtime using API semantics based on spring configurations. In other words, you have to create a Spring Java Configuration class which uses spring’s @Configuration&lt;br /&gt;
&lt;br /&gt;
In My example, I am generating a swagger documentation based on the RestController classes I have added.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class ApplicationConfig {

    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.basePackage(&quot;com.chandana.helloworld.controllers&quot;))
                .paths(PathSelectors.any())
                .build();
    }
}

&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Since I have added two controllers, this will group(tag) each controller related APIs separately.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsQVhAzw4NL4IhkEqm_5Prlj9JaY2JFwEu4NQmTY-QFxHSHUf40YQdBQYZlG96fmtlql024IR4PLAey-qICgKGFieSJVMxg7Bqo0DkIWyupK3P2a_fYON42FGRlq6gw04D3warow/s1600/basic+swagger+ui.png&quot;&gt;&lt;img alt=&quot;Generated Swagger UI&quot; border=&quot;0&quot; data-original-height=&quot;604&quot; data-original-width=&quot;1378&quot; height=&quot;175&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsQVhAzw4NL4IhkEqm_5Prlj9JaY2JFwEu4NQmTY-QFxHSHUf40YQdBQYZlG96fmtlql024IR4PLAey-qICgKGFieSJVMxg7Bqo0DkIWyupK3P2a_fYON42FGRlq6gw04D3warow/s400/basic+swagger+ui.png&quot; title=&quot;Generated Swagger UI&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Out of the box, Springfox &amp;nbsp;provides five predicates and they are any, none, withClassAnnotation, withMethodAnnotation and basePackage.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;ApiInfo&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Swagger provides some default values such as “API Documentation”, “Created by Contact Email”, “Apache 2.0”. So you can change these default values by adding apiInfo(ApiInfo apiInfo) method. The ApiInfo class contains custom information about the API.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;@Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(getApiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage(&quot;com.chandana.helloworld.controllers&quot;))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo getApiInfo() {
        Contact contact = new Contact(&quot;Chandana Napagoda&quot;, &quot;http://blog.napagoda.com&quot;, &quot;cnapagoda@gmail.com&quot;);
        return new ApiInfoBuilder()
                .title(&quot;Example Api Title&quot;)
                .description(&quot;Example Api Definition&quot;)
                .version(&quot;1.0.0&quot;)
                .license(&quot;Apache 2.0&quot;)
                .licenseUrl(&quot;http://www.apache.org/licenses/LICENSE-2.0&quot;)
                .contact(contact)
                .build();
    }

&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Once ApiInfo is added, the generated documentation looks similar to this:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL1M0TfnMv-4O4UU3jcfTFPjh1AIPwFcwlcRb6XaQ01raT4NuvTaQYSxkRfZLBmxabqSi1kTTISI_zoB17xq9fdg_K8dhhsHgZcFPYgvCvP-PaJHC_gPLW-ZPjYMj0IhR73tcC3A/s1600/swagger-with-appinfo.png&quot;&gt;&lt;img alt=&quot;Swagger UI with App Info&quot; border=&quot;0&quot; data-original-height=&quot;522&quot; data-original-width=&quot;1250&quot; height=&quot;166&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL1M0TfnMv-4O4UU3jcfTFPjh1AIPwFcwlcRb6XaQ01raT4NuvTaQYSxkRfZLBmxabqSi1kTTISI_zoB17xq9fdg_K8dhhsHgZcFPYgvCvP-PaJHC_gPLW-ZPjYMj0IhR73tcC3A/s400/swagger-with-appinfo.png&quot; title=&quot;Swagger UI with App Info&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt; &lt;b&gt;Controller and POJO Level Documentation&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
@Api annotation is used to explain each rest controller class.&lt;br /&gt;
@ApiOperation annotation is used to explain to describe the resources and methods.&lt;br /&gt;
@ApiResponse annotation &amp;nbsp;is used to explain to describe other responses that can be returned by the operation.ex: 200 ok or 202 accepted, etc.&lt;br /&gt;
&amp;nbsp;@ApiModelProperty annotation to describe the properties of the POJO(Bean) class.&lt;br /&gt;
&lt;br /&gt;
After adding above annotation, final generated swagger documentation looks like below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpzmyVqKAR9JCu0xoG1g05OsYpYIML3zaNjzM7fv_ULlvCHVA5IHQP9wpPCbVSVVnbzuhlgidobjRVFeUp2PBBvpYG3cloFrB2gUTVhJ4-pg6w7jNvjI393Xv_5QINoFYbQYuJmg/s1600/final-swagger-ui.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Complex and Beautiful REST Documentation with Swagger&quot; border=&quot;0&quot; data-original-height=&quot;922&quot; data-original-width=&quot;1207&quot; height=&quot;305&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpzmyVqKAR9JCu0xoG1g05OsYpYIML3zaNjzM7fv_ULlvCHVA5IHQP9wpPCbVSVVnbzuhlgidobjRVFeUp2PBBvpYG3cloFrB2gUTVhJ4-pg6w7jNvjI393Xv_5QINoFYbQYuJmg/s400/final-swagger-ui.png&quot; title=&quot;Complex and Beautiful REST Documentation with Swagger&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
Spring RestController class:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
package com.chandana.helloworld.controllers;

import com.chandana.helloworld.bean.Greeting;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(&quot;/api&quot;)
@Api(value = &quot;user&quot;, description = &quot;Rest API for user operations&quot;, tags = &quot;User API&quot;)
public class HelloWorldController {

    @RequestMapping(value = &quot;/hello/{name}&quot;, method = RequestMethod.GET, produces = &quot;application/json&quot;)
    @ApiOperation(value = &quot;Display greeting message to non-admin user&quot;, response = Greeting.class)
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = &quot;OK&quot;),
            @ApiResponse(code = 404, message = &quot;The resource not found&quot;)
    }
    )
    public Greeting message(@PathVariable String name) {
        Greeting msg = new Greeting(name, &quot;Hello &quot; + name);
        return msg;
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Greeting model class:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
package com.chandana.helloworld.bean;

import io.swagger.annotations.ApiModelProperty;

public class Greeting {

    @ApiModelProperty(notes = &quot;Provided user name&quot;, required =true)
    private String player;

    @ApiModelProperty(notes = &quot;The system generated greeting message&quot; , readOnly =true)
    private String message;

    public Greeting(String player, String message) {
        this.player = player;
        this.message = message;
    }

    public String getPlayer() {
        return player;
    }

    public void setPlayer(String player) {
        this.player = player;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
AppConfig class:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
package com.chandana.helloworld.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class ApplicationConfig {

    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(getApiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage(&quot;com.chandana.helloworld.controllers&quot;))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo getApiInfo() {
        Contact contact = new Contact(&quot;Chandana Napagoda&quot;, &quot;http://blog.napagoda.com&quot;, &quot;cnapagoda@gmail.com&quot;);
        return new ApiInfoBuilder()
                .title(&quot;Example Api Title&quot;)
                .description(&quot;Example Api Definition&quot;)
                .version(&quot;1.0.0&quot;)
                .license(&quot;Apache 2.0&quot;)
                .licenseUrl(&quot;http://www.apache.org/licenses/LICENSE-2.0&quot;)
                .contact(contact)
                .build();
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You can download &lt;a href=&quot;https://github.com/cnapagoda/spring-boot-swagger&quot; target=&quot;_blank&quot;&gt;Swagger Spring Boot Project source code&lt;/a&gt; from my GitHub repo as well.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/1397836182888757343/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2017/09/integrating-swagger-with-spring-boot.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/1397836182888757343'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/1397836182888757343'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2017/09/integrating-swagger-with-spring-boot.html' title='Integrating Swagger with Spring Boot REST API'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsQVhAzw4NL4IhkEqm_5Prlj9JaY2JFwEu4NQmTY-QFxHSHUf40YQdBQYZlG96fmtlql024IR4PLAey-qICgKGFieSJVMxg7Bqo0DkIWyupK3P2a_fYON42FGRlq6gw04D3warow/s72-c/basic+swagger+ui.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-3535059119457791783</id><published>2017-09-08T02:37:00.004+09:30</published><updated>2024-06-23T14:55:57.015+09:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Maven"/><category scheme="http://www.blogger.com/atom/ns#" term="Microservices"/><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>Building a RESTFul Service using Spring Boot</title><content type='html'>&lt;div&gt;&lt;b&gt;Update Notice&lt;/b&gt;: &lt;i&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;This blog post was published on 2017 and may contain outdated information. For the most up-to-date guide on &lt;a href=&quot;https://blog.napagoda.com/2024/06/building-restful-service-spring-boot-3.html&quot; target=&quot;_blank&quot;&gt;developing RESTful services with Spring Boot&lt;/a&gt;, please refer to my latest post:&amp;nbsp;&lt;a href=&quot;https://blog.napagoda.com/2024/06/building-restful-service-spring-boot-3.html&quot;&gt;https://blog.napagoda.com/2024/06/building-restful-service-spring-boot-3.html&lt;/a&gt; Thank you!&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Everyone is talking about Microservices such as &lt;a href=&quot;http://wso2.com/products/microservices-framework-for-java/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;WSO2 Microservice Framework&lt;/a&gt;, &lt;a href=&quot;https://projects.spring.io/spring-boot/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Spring Boot&lt;/a&gt;, etc. Since I haven&#39;t worked on any Spring related project since a very long time, I thought to implement a simple RESTFul service using Spring Boot.&lt;br /&gt;
&lt;br /&gt;
So I started with Spring documentation. It is straightforward. &amp;nbsp;You can create the structure of your project using &quot;&lt;a href=&quot;http://start.spring.io/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Spring Initializr&lt;/a&gt;&quot;. This is an online tool where you can add all the desired dependencies to your project POM file. Since I am a big fan of Maven, I am generating a maven project.&lt;br /&gt;
&lt;br /&gt;
In the Spring Initializr UI, you can choose the Language, Spring Boot Version, Project Group ID, artifact name, etc. Please refer below screenshot for information I have provided while generating the project.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibozwxW9YyEbK50k7M-5QOgxcNW9LQLdSXwdAVsIIQ674t1Q6k6ybyi01SMmqNom64Br7UinckXEL5QDut5qMwLY2YNVWP0J-XvTiOG3Yv_yX6CZKy6hBOuuXAjlzo1X7eR-5D_g/s1600/Spring+Initializr+%25282%2529.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Spring Initializr view&quot; border=&quot;0&quot; data-original-height=&quot;776&quot; data-original-width=&quot;1600&quot; height=&quot;193&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibozwxW9YyEbK50k7M-5QOgxcNW9LQLdSXwdAVsIIQ674t1Q6k6ybyi01SMmqNom64Br7UinckXEL5QDut5qMwLY2YNVWP0J-XvTiOG3Yv_yX6CZKy6hBOuuXAjlzo1X7eR-5D_g/s400/Spring+Initializr+%25282%2529.png&quot; title=&quot;Spring Initializr view&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
When clicking on &quot;Generate Project&quot;, it will download zipped maven project into your computer. Unzip it and import into an IDE. The initial project structure is like below.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEistvSJr_pbZlv2I9VEsObtAIgXwxHIP9gcry6k04ObqGNarcbMKaRuVElwC2MehRoKbGJWgb_A-Ea8CaOuxOx3eIHaoWxM5WOcSwpbwFsRkCI-90ZaK54fkIaXw9B2T-s20yOtHw/s1600/2.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Spring Boot project view&quot; border=&quot;0&quot; data-original-height=&quot;465&quot; data-original-width=&quot;448&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEistvSJr_pbZlv2I9VEsObtAIgXwxHIP9gcry6k04ObqGNarcbMKaRuVElwC2MehRoKbGJWgb_A-Ea8CaOuxOx3eIHaoWxM5WOcSwpbwFsRkCI-90ZaK54fkIaXw9B2T-s20yOtHw/s200/2.png&quot; title=&quot;Spring Boot project view&quot; width=&quot;192&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
In my HelloWorld REST service implementation, it accepts user&#39;s name as a path parameter(or URL parameter) and returns a greeting JSON payload(response). So I am expecting to invoke my REST service by calling below URL: APP_NAME/api/hello/chandana.&lt;br /&gt;
&lt;br /&gt;
The &lt;a href=&quot;https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/bind/annotation/RestController.html&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;@RestController&lt;/a&gt; is a way to implement RESTFul service using Spring. So, this new controller class is going to name as HelloWorldController. @RequestMapping annotation maps HTTP requests to the handler. This @RequestMapping annotation can be used in class-level and/or method-level as well. If you have multiple request mappings for a method or class, you can add one @RequestMapping annotation with a list of values.&amp;nbsp;So my HelloWorldController class looks like below.&lt;br /&gt;
&lt;br /&gt;
&lt;!--HTML generated using hilite.me--&gt;&lt;br /&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0px;&quot;&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;package&lt;/span&gt; com&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;chandana&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;helloworld&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;com.chandana.helloworld.bean.Greeting&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;org.springframework.web.bind.annotation.PathVariable&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;org.springframework.web.bind.annotation.RequestMapping&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;org.springframework.web.bind.annotation.RestController&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #555555; font-weight: bold;&quot;&gt;@RestController&lt;/span&gt;
&lt;span style=&quot;color: #555555; font-weight: bold;&quot;&gt;@RequestMapping&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;/api&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #bb0066; font-weight: bold;&quot;&gt;HelloWorldController&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;

    &lt;span style=&quot;color: #555555; font-weight: bold;&quot;&gt;@RequestMapping&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; String &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;welcome&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #888888;&quot;&gt;//Welcome page, non-rest&lt;/span&gt;
        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;Welcome to RestTemplate Example.&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #555555; font-weight: bold;&quot;&gt;@RequestMapping&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;/hello/{name}&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; Greeting &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;message&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #555555; font-weight: bold;&quot;&gt;@PathVariable&lt;/span&gt; String name&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;

        Greeting  msg &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; Greeting&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;name&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;Hello &quot;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;+&lt;/span&gt; name&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;return&lt;/span&gt; msg&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Note: If you notice Spring Boot 1.5.6 not importing classes correctly and displaying an error message as &quot;Cannot resolve symbol RestController&quot; in your IDE, you need to downgrade the spring version that is used in the project. Spring Boot 1.5.6 by default uses Spring 4.3.10.RELEASE dependency and it need to be downgraded to 4.3.9.RELEASE. So please add &amp;lt;spring.version&amp;gt;4.3.9.RELEASE&amp;lt;/spring.version&amp;gt; on the properties section of your POM file.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
So everything is in place. I can build and run Spring Boot project using below maven command. It will compile the project and run it.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;mvn spring-boot:run&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
While starting the server you can notice registered REST service URL in the console like below&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;INFO 9556 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped &quot;&lt;b&gt;{[/api/hello/{name}]}&lt;/b&gt;&quot; onto public com.chandana.helloworld.bean.Greeting com.chandana.helloworld.&lt;b&gt;HelloWorldController&lt;/b&gt;.&lt;b&gt;message&lt;/b&gt;(java.lang.String)&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;INFO 9556 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped &quot;&lt;b&gt;{[/api/]}&lt;/b&gt;&quot; onto public java.lang.String com.chandana.helloworld.&lt;b&gt;HelloWorldController&lt;/b&gt;.&lt;b&gt;welcome&lt;/b&gt;()2017-0&lt;/span&gt;&lt;br /&gt;
Finally, Can invoke REST Service by accessing this URL:&amp;nbsp;http://localhost:8080/api/hello/&lt;b&gt;NAME&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Final Project Structure:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6X7A1Bn3gHOcO-w18JW6r7nJ1tngwyjxF5iD7Nd_5FWFQ5aeMzDqacuZC3daNTJAc6FDVdam_tw3pKoEFPsknKIXsV-j9rNH_x8XQMEKulDGEByVfSjJRrHP7X4lXE_tmjRsmHw/s1600/final+project.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Spring Boot REST API project view&quot; border=&quot;0&quot; data-original-height=&quot;601&quot; data-original-width=&quot;476&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6X7A1Bn3gHOcO-w18JW6r7nJ1tngwyjxF5iD7Nd_5FWFQ5aeMzDqacuZC3daNTJAc6FDVdam_tw3pKoEFPsknKIXsV-j9rNH_x8XQMEKulDGEByVfSjJRrHP7X4lXE_tmjRsmHw/s320/final+project.png&quot; title=&quot;Spring Boot REST API project view&quot; width=&quot;252&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Greeting POJO class:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;!--HTML generated using hilite.me--&gt;&lt;br /&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0px;&quot;&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;package&lt;/span&gt; com&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;chandana&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;helloworld&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;bean&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #bb0066; font-weight: bold;&quot;&gt;Greeting&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;

    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;private&lt;/span&gt; String player&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;private&lt;/span&gt; String message&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;Greeting&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;String player&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; String message&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;player&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; player&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;message&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; message&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; String &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;getPlayer&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;return&lt;/span&gt; player&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;setPlayer&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;String player&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;player&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; player&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; String &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;return&lt;/span&gt; message&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;setMessage&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;String message&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;message&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; message&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;POM XML:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt; &lt;!--HTML generated using hilite.me--&gt;&lt;br /&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0px;&quot;&gt;&lt;span style=&quot;color: #557799;&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;project&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://maven.apache.org/POM/4.0.0&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000cc;&quot;&gt;xmlns:xsi=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&lt;/span&gt;
 &lt;span style=&quot;color: #0000cc;&quot;&gt;xsi:schemaLocation=&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;modelVersion&amp;gt;&lt;/span&gt;4.0.0&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/modelVersion&amp;gt;&lt;/span&gt;

 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;com.chandana&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;helloworld&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;version&amp;gt;&lt;/span&gt;0.0.1-SNAPSHOT&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;packaging&amp;gt;&lt;/span&gt;jar&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/packaging&amp;gt;&lt;/span&gt;

 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;name&amp;gt;&lt;/span&gt;helloworld&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/name&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;description&amp;gt;&lt;/span&gt;Demo project for Spring Boot&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/description&amp;gt;&lt;/span&gt;

 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;parent&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework.boot&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-boot-starter-parent&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;version&amp;gt;&lt;/span&gt;1.5.6.RELEASE&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;relativePath/&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #888888;&quot;&gt;&amp;lt;!-- lookup parent from repository --&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/parent&amp;gt;&lt;/span&gt;

 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;properties&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;project.build.sourceEncoding&amp;gt;&lt;/span&gt;UTF-8&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/project.build.sourceEncoding&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;project.reporting.outputEncoding&amp;gt;&lt;/span&gt;UTF-8&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/project.reporting.outputEncoding&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;java.version&amp;gt;&lt;/span&gt;1.8&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/java.version&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;spring.version&amp;gt;&lt;/span&gt;4.3.9.RELEASE&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/spring.version&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/properties&amp;gt;&lt;/span&gt;

 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;dependencies&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework.boot&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-boot-starter-web&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;

  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework.boot&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-boot-starter-test&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;scope&amp;gt;&lt;/span&gt;test&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/scope&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/dependencies&amp;gt;&lt;/span&gt;

 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;build&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;plugins&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;plugin&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework.boot&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-boot-maven-plugin&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/plugin&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/plugins&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/build&amp;gt;&lt;/span&gt;


&lt;span style=&quot;color: #007700;&quot;&gt;&amp;lt;/project&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt; &lt;b&gt;HelloWorldController class:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;!--HTML generated using hilite.me--&gt;&lt;br /&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;pre style=&quot;line-height: 125%; margin: 0px;&quot;&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;package&lt;/span&gt; com&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;chandana&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;helloworld&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;com.chandana.helloworld.bean.Greeting&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;org.springframework.web.bind.annotation.PathVariable&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;org.springframework.web.bind.annotation.RequestMapping&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;org.springframework.web.bind.annotation.RestController&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #555555; font-weight: bold;&quot;&gt;@RestController&lt;/span&gt;
&lt;span style=&quot;color: #555555; font-weight: bold;&quot;&gt;@RequestMapping&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;/api&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #bb0066; font-weight: bold;&quot;&gt;HelloWorldController&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;

    &lt;span style=&quot;color: #555555; font-weight: bold;&quot;&gt;@RequestMapping&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; String &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;welcome&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #888888;&quot;&gt;//Welcome page, non-rest&lt;/span&gt;
        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;Welcome to RestTemplate Example.&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: #555555; font-weight: bold;&quot;&gt;@RequestMapping&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;/hello/{name}&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; Greeting &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;message&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #555555; font-weight: bold;&quot;&gt;@PathVariable&lt;/span&gt; String name&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;

        Greeting  msg &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; Greeting&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;name&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;Hello &quot;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;+&lt;/span&gt; name&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;return&lt;/span&gt; msg&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Conclusion:&lt;/b&gt; As it seems, it is very straightforward to implement RESTFul services using Spring Boot. So I got an idea to implement backend of my “&lt;a href=&quot;https://play.google.com/store/apps/details?id=com.chandana.marketprice&amp;amp;hl=en&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Yield Price Sri Lanka&lt;/a&gt;” android app using Spring Boot. Besides, hoping to implement an Admin UI to manage price and commodity information and also a public web UI to display price details for users who don&#39;t have an Android app. Keep in touch.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/3535059119457791783/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2017/09/building-restful-service-using-spring.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/3535059119457791783'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/3535059119457791783'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2017/09/building-restful-service-using-spring.html' title='Building a RESTFul Service using Spring Boot'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibozwxW9YyEbK50k7M-5QOgxcNW9LQLdSXwdAVsIIQ674t1Q6k6ybyi01SMmqNom64Br7UinckXEL5QDut5qMwLY2YNVWP0J-XvTiOG3Yv_yX6CZKy6hBOuuXAjlzo1X7eR-5D_g/s72-c/Spring+Initializr+%25282%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-7179190299371821870</id><published>2017-08-08T03:45:00.003+09:30</published><updated>2024-06-27T20:30:28.042+09:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Java 8 lambda expression for list/array conversion</title><content type='html'>&lt;br /&gt;
1). Convert List&lt;string&gt; to List&lt;integer&gt; ( List of Strings to List of Integers)&lt;br /&gt;&lt;br /&gt;List&amp;lt;Integer&amp;gt;&amp;nbsp;&lt;integer&gt; integerList = stringList.stream().map(Integer::parseInt).collect(Collectors.toList());&amp;nbsp;&lt;/integer&gt;&lt;/integer&gt;&lt;/string&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
// the longer full lambda version:&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
List&amp;lt;Integer&amp;gt;&amp;nbsp;&lt;integer&gt; integerList &amp;nbsp;= stringList.stream().map(s -&amp;gt; Integer.parseInt(s)).collect(Collectors.toList());&lt;/integer&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
2).&amp;nbsp;Convert List&lt;string&gt; to int[](List of Strings to int array)&lt;/string&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
int[] intArray = stringList.stream().mapToInt(Integer::parseInt).toArray();&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
3).&amp;nbsp;Convert String[] to List&lt;integer&gt; ( String array to List of Integers)&lt;/integer&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
List&amp;lt;Integer&amp;gt;&amp;nbsp;&lt;integer&gt; integerList&amp;nbsp;= Stream.of(array).map(Integer::parseInt).collect(Collectors.toList());&lt;/integer&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
4).&amp;nbsp;Convert String[] to int[] (String array to int array)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
int[] intArray = Stream.of(stringArray).mapToInt(Integer::parseInt).toArray();&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
5).&amp;nbsp;Convert String[] to List&lt;double&gt; (String array to Double List)&lt;/double&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
List&amp;lt;Double&amp;gt;&lt;double&gt; doubleList = Stream.of(stringArray).map(Double::parseDouble).collect(Collectors.toList());&lt;/double&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
6).&amp;nbsp;Convert int[] to String[] (int array&amp;nbsp;to String array)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
String[] stringArray = Arrays.stream(intArray).mapToObj(Integer::toString).toArray(String[]::new);&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
7). &amp;nbsp;Convert 2D int[][] to&amp;nbsp;List&lt;list nteger=&quot;&quot;&gt;&amp;gt; ( 2D int array to nested Integer&amp;nbsp;List)&lt;/list&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
List&amp;lt;Integer&amp;gt;&amp;nbsp;&amp;nbsp;list = Arrays.stream(dataSet).map(Arrays::asList).collect(Collectors.toList());&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/7179190299371821870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2017/08/java-8-lambda-expression-for-listarray.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/7179190299371821870'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/7179190299371821870'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2017/08/java-8-lambda-expression-for-listarray.html' title='Java 8 lambda expression for list/array conversion'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-18481069.post-1981695791510416118</id><published>2017-08-01T11:47:00.000+09:30</published><updated>2017-08-01T12:06:53.327+09:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="OpenSource"/><category scheme="http://www.blogger.com/atom/ns#" term="Solr"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2"/><title type='text'>Manage Solr Data in WSO2 Server</title><content type='html'>Recently I was checking an issue faced by one of my colleague while automating &lt;a href=&quot;http://wso2.com/api-management/#download&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;WSO2 API Manager&lt;/a&gt; deployment. There, once the new pack is deployed by pointing to the existing databases, APIM Store didn&#39;t show existing APIs at once. It took some time to display all the existing APIs in the Store.&lt;br /&gt;
&lt;br /&gt;
The APIs are retrieved using the Solr based indexing in APIM. Therefore, the main reason for this behavior is that a fresh pack doesn&#39;t have existing Solr data and it takes some time to complete the indexing. Until that indexing process is completed, it will not show API in the Store instantly.&lt;br /&gt;
&lt;br /&gt;
To address this, you can follow one of the below approaches:&lt;br /&gt;
&lt;br /&gt;
1). Backup existing Solr data (&lt;b&gt;APIM_HOME/solr/data&lt;/b&gt;) from the existing deployment and added it to newly created pack.&lt;br /&gt;
&lt;img src=&quot;https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
2). Externalize Solr data directory. Solr data stored location can be configured via &lt;b&gt;core.properties&lt;/b&gt; file located in the &lt;b&gt;APIM_HOME/repository/conf/solr/registry-indexing&lt;/b&gt; directory. So you can update core.properties to store Solr data outside the product directory.</content><link rel='replies' type='application/atom+xml' href='https://blog.napagoda.com/feeds/1981695791510416118/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://blog.napagoda.com/2017/07/manage-solr-data-in-wso2-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/1981695791510416118'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/18481069/posts/default/1981695791510416118'/><link rel='alternate' type='text/html' href='https://blog.napagoda.com/2017/07/manage-solr-data-in-wso2-server.html' title='Manage Solr Data in WSO2 Server'/><author><name>Chandana Napagoda</name><uri>http://www.blogger.com/profile/11223582213733712096</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>