<?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-33519738</id><updated>2025-12-01T09:17:38.675+05:30</updated><category term="Axis2"/><category term="web services"/><category term="Spring"/><category term="Maven2"/><category term="XML"/><category term="Community"/><category term="POJO"/><category term="FOSS"/><category term="Acegi"/><category term="WSO2 AS"/><category term="WSO2 ESB"/><category term="ESB"/><category term="JAX-WS"/><category term="Rampart"/><category term="Synapse"/><category term="Woden"/><category term="ActiveMQ"/><category term="Axis2M"/><category term="Camel"/><category term="JMS"/><category term="JTable"/><category term="JasperReport"/><category term="Linux"/><category term="Sandesh2"/><category term="WSO2 APIM"/><category term="WebSocket"/><category term="Circuit Breaker"/><category term="Hasthi"/><category term="IEEE"/><category term="JavaEE"/><category term="JavaEE WebProfile"/><category term="Jetty"/><category term="Microservice"/><category term="OAuth 2.0"/><category term="OSGI"/><category term="Reflection"/><category term="Spring Integration"/><category term="Timeout"/><category term="WSO2"/><category term="WSO2 IS"/><title type='text'>sagara&#39;s Blog</title><subtitle type='html'>Days of my journey</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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>82</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-33519738.post-8810450367231517848</id><published>2015-05-02T14:34:00.000+05:30</published><updated>2015-05-15T12:31:15.876+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Circuit Breaker"/><category scheme="http://www.blogger.com/atom/ns#" term="ESB"/><category scheme="http://www.blogger.com/atom/ns#" term="Microservice"/><category scheme="http://www.blogger.com/atom/ns#" term="Timeout"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2 ESB"/><title type='text'>Timeout and Circuit Breaker Pattern in WSO2 Way </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
When we develop enterprise scale software systems it&#39;s hard to avoid mistakes, sometimes these mistakes teach us very important lessons to avoid same mistake over again and also to craft softwares in much better way. &amp;nbsp;Sometimes experienced developers recognize these repetitive solutions and fromalize them as &lt;i&gt;Design Patterns&lt;/i&gt;. Sometimes without knowing we may practise these patterns, in this post I try to describe two design patterns called &#39;Timeout&#39; and &#39;Circuit Breaker&#39; and how are they used in WSO2 stack specially within WSO2 ESB. &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Timeout Design Pattern&amp;nbsp;&lt;/b&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
Timeout pattern is not something new, it has been used widely from early days of computing and networking. The basic idea here is when one system communicate with another, systems should not wait infinity to receive messages instead after waiting for a pre-defined interval systems should release their resources and should assume that other party can&#39;t communicate at this time. &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
- Timeout improves fault isolation, &amp;nbsp;this is very important factor to avoid failures of one system propagate into another. &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
- Timeout also helps to manage and use system resources properly, since caller will not wait infinity it&#39;s possible to release expensive resources such as DB transactions, network connections etc.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
- Timeout is one way to achieve another important design principle called &quot;Fail Fast&quot;, this means if a transaction/activity can&#39;t complete it should notify or throw a suitable error as early as possible.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;/ul&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/AVvXsEjsptLnDtD10am9hez4pPWmyIulKa-qKISYiMU9Qr4zyCFmOyC4vixqQrp2mpuu3k92ZRSVEpv3W-re1C-tsjj4si1v8bKQJPl7mf7TV375vrqf6IacoQcF7NAL6SzGgXU2VNTo/s1600/ref-time-out.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;232&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsptLnDtD10am9hez4pPWmyIulKa-qKISYiMU9Qr4zyCFmOyC4vixqQrp2mpuu3k92ZRSVEpv3W-re1C-tsjj4si1v8bKQJPl7mf7TV375vrqf6IacoQcF7NAL6SzGgXU2VNTo/s1600/ref-time-out.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Now let&#39;s look at how Timeout design pattern is implemented in WSO2 ESB. In WSO2 ESB external systems are represented as &quot;Endpoints&quot;, these Endpoints encapsulate access URIs, QoS policies and availability of external systems. &lt;br /&gt;
&lt;br /&gt;
In ESB configuration language &amp;lt;timeout&amp;gt; element is used to configure timeout settings. Most important properties are given below.&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b&gt;duration&lt;/b&gt; &amp;nbsp;- This specify the time duration for timeout.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;responseAction&lt;/b&gt; - This specify what ESB should do to the current message once the timeout is exceeded. There are 2 possible values&amp;nbsp;&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;discard&lt;/b&gt; - simply discard current message.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;fault&lt;/b&gt; - redirect current message to immediate fault sequence. &amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;/ul&gt;
&lt;br /&gt;
As an example during the fault sequence one can persist those messages temporally and try to deliver them once the remote system is alive, WSO2 ESB supports out of the box concept called &lt;a href=&quot;https://docs.wso2.com/display/ESB481/Store+and+Forward+Using+JMS+Message+Stores&quot; target=&quot;_blank&quot;&gt;store-and-forward&lt;/a&gt; for this. &lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
Example Timeout Configuration&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; 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;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt; &amp;lt;endpoint name=&quot;TimeoutEP&quot;&amp;gt;  
&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt;   &amp;lt;address uri=&quot;http://localhost:9764/CalculatorService-war_1.0.0/services/calculator_service/call&quot;&amp;gt;  
    &amp;lt;timeout&amp;gt;  
&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;      &amp;lt;duration&amp;gt;200&amp;lt;/duration&amp;gt;  
      &amp;lt;responseAction&amp;gt;fault&amp;lt;/responseAction&amp;gt;  
&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt;    &amp;lt;/timeout&amp;gt;  
   &amp;lt;/address&amp;gt;  
&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt; &amp;lt;/endpoint&amp;gt;  
&lt;/b&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
In this sample, we try to call RESTful endpoint available on &lt;i&gt;http://localhost:9764/CalculatorService-war_1.0.0/services/calculator_service/call &lt;/i&gt;URL and timeout value is set to &lt;i&gt;200 ms&lt;/i&gt; once the above limit exceed messages will re-route to error handling sequence.&lt;br /&gt;
&lt;br /&gt;
Here I have given a ESB REST API which calls above endpoint. In this sample once the timeout exceeded client will notify with a error message. &lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; 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;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt; &amp;lt;api name=&quot;CalAPI&quot; context=&quot;/cal&quot;&amp;gt;  
&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt;   &amp;lt;resource methods=&quot;GET&quot;&amp;gt;  
    &amp;lt;inSequence&amp;gt;  
      &amp;lt;send&amp;gt;  
&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;       &amp;lt;endpoint key=&quot;TimeoutEP&quot;/&amp;gt;  
&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt;      &amp;lt;/send&amp;gt;  
    &amp;lt;/inSequence&amp;gt;  
    &amp;lt;outSequence&amp;gt;  
      &amp;lt;send/&amp;gt;  
    &amp;lt;/outSequence&amp;gt;  
    &amp;lt;faultSequence&amp;gt;  
      &amp;lt;header name=&quot;To&quot; action=&quot;remove&quot;&amp;gt;&amp;lt;/header&amp;gt;  
      &amp;lt;property name=&quot;RESPONSE&quot; value=&quot;true&quot;&amp;gt;&amp;lt;/property&amp;gt;  
      &amp;lt;property name=&quot;NO_ENTITY_BODY&quot; scope=&quot;axis2&quot; action=&quot;remove&quot;&amp;gt;&amp;lt;/property&amp;gt;  
      &amp;lt;log level=&quot;full&quot;&amp;gt;&amp;lt;/log&amp;gt;  
      &amp;lt;payloadFactory media-type=&quot;xml&quot;&amp;gt;  
       &amp;lt;format&amp;gt;  
         &amp;lt;ns:MyResponse xmlns:ns=&quot;http://services.samples&quot;&amp;gt;  
          &amp;lt;ns:Error&amp;gt;We can&#39;t response you at this time, we will reponse through E-mail soon&amp;lt;/ns:Error&amp;gt;  
         &amp;lt;/ns:MyResponse&amp;gt;  
       &amp;lt;/format&amp;gt;  
      &amp;lt;/payloadFactory&amp;gt;  
      &amp;lt;send/&amp;gt;  
    &amp;lt;/faultSequence&amp;gt;  
   &amp;lt;/resource&amp;gt;  
&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt; &amp;lt;/api&amp;gt;  
&lt;/b&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Circuit Breaker Pattern&lt;/h3&gt;
&lt;div&gt;
In his &lt;a href=&quot;https://pragprog.com/book/mnee/release-it&quot; target=&quot;_blank&quot;&gt;book&lt;/a&gt; Michael T. Nygard formalized and nicely presented Circuit Breaker pattern. I would recommend to read another excellent &lt;a href=&quot;http://martinfowler.com/bliki/CircuitBreaker.html&quot; target=&quot;_blank&quot;&gt;writing&lt;/a&gt; of Martin Fowler about this pattern. &amp;nbsp;&lt;/div&gt;
&lt;/div&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/AVvXsEiH3dQ6YVIjw5Wt9-vVvoeReboWwgO7LFr2yJt2epYrk9m6CAq7fX2ORKcAxvo8F9H_31bk1NIMhh9wHaa7bJ3gOnkypFhnfvn57BwHaSz2tEasF68bwBUa8p1owJFXcZrHA9tr/s1600/circuit-breaker-state-transition.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiH3dQ6YVIjw5Wt9-vVvoeReboWwgO7LFr2yJt2epYrk9m6CAq7fX2ORKcAxvo8F9H_31bk1NIMhh9wHaa7bJ3gOnkypFhnfvn57BwHaSz2tEasF68bwBUa8p1owJFXcZrHA9tr/s1600/circuit-breaker-state-transition.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
This is how&amp;nbsp;Fowler&amp;nbsp;introduce Circuit Breaker&amp;nbsp;pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;&quot;The basic idea behind the circuit breaker is very simple. You
  wrap a protected function call in a circuit breaker object, which monitors for
  failures. Once the failures reach a certain threshold, the circuit
  breaker trips, and all further calls to the circuit breaker return
  with an error, without the protected call being made at all. Usually
  you&#39;ll also want some kind of monitor alert if the circuit breaker
  trips.&quot;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: right;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;[Source -&amp;nbsp;http://martinfowler.com/bliki/CircuitBreaker.html ]&amp;nbsp;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;br /&gt;
Circuit Breaker pattern define three states.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b&gt;Closed&lt;/b&gt; - Circuit is closed and communication with remote party is possible without any communication issues.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Open&lt;/b&gt; &amp;nbsp;- After N times of failures&amp;nbsp;Circuit&amp;nbsp;goes to &amp;nbsp;open state.&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;For certain time interval system does not try to send messages to remote system further.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Client receive an error message. &amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;b&gt;Half-Open&lt;/b&gt; - After certain time interval&amp;nbsp;system try to send limited number of messages to remote system, if the communication is successful&amp;nbsp;Circuit is reset to Closed state. &amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Here is a simple state change diagram according to the&amp;nbsp;Circuit Breaker&amp;nbsp;pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFj1H04z_MOOMWiBcK1Rst1anfFn8if3IUDLXywt1zJCU1gsEnKAP-HlYp-F0cePlDGQTi9d-8cyRH9IUG0l2zUb4j3efo9nHgbJkBnJOQFx0EepHNpmG5sY40-sfg7SFslRR8/s1600/Screen+Shot+2015-05-02+at+12.05.26+PM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;401&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFj1H04z_MOOMWiBcK1Rst1anfFn8if3IUDLXywt1zJCU1gsEnKAP-HlYp-F0cePlDGQTi9d-8cyRH9IUG0l2zUb4j3efo9nHgbJkBnJOQFx0EepHNpmG5sY40-sfg7SFslRR8/s1600/Screen+Shot+2015-05-02+at+12.05.26+PM.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
WSO2 ESB &amp;nbsp;Endpoint includes feature-rich error handling mechanism that can be used to implement&amp;nbsp;Circuit Breaker&amp;nbsp;pattern. One difference is WSO2 ESB&amp;nbsp;endpoints status names are different from&amp;nbsp;Circuit Breaker&amp;nbsp;paten status&amp;nbsp;names.&lt;br /&gt;
&lt;br /&gt;
Now let&#39;s look at an example Endpoint definition, which in fact an improved version of above TimeoutEP.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; 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;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt; &amp;lt;endpoint name=&quot;CircuitBreakerEP&quot;&amp;gt;  
&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt;   &amp;lt;address uri=&quot;http://localhost:9764/CalculatorService-war_1.0.0/services/calculator_service/call&quot;&amp;gt;  
    &amp;lt;suspendOnFailure&amp;gt;  
&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;      &amp;lt;initialDuration&amp;gt;40000&amp;lt;/initialDuration&amp;gt;  
&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt;    &amp;lt;/suspendOnFailure&amp;gt;  
    &amp;lt;markForSuspension&amp;gt;  
      &amp;lt;errorCodes&amp;gt;101507,101508,101505,101506,101509,101500,101510,101001,101000,101503,101504,101501&amp;lt;/errorCodes&amp;gt;  
&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;      &amp;lt;retriesBeforeSuspension&amp;gt;3&amp;lt;/retriesBeforeSuspension&amp;gt;  
      &amp;lt;retryDelay&amp;gt;400&amp;lt;/retryDelay&amp;gt;  
&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt;    &amp;lt;/markForSuspension&amp;gt;  
    &amp;lt;timeout&amp;gt;  
&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;      &amp;lt;duration&amp;gt;200&amp;lt;/duration&amp;gt;  
      &amp;lt;responseAction&amp;gt;fault&amp;lt;/responseAction&amp;gt;  
&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt;    &amp;lt;/timeout&amp;gt;  
   &amp;lt;/address&amp;gt;  
&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt; &amp;lt;/endpoint&amp;gt;  
&lt;/b&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
Following are the important configuration details of above example.&amp;nbsp;&lt;/div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b&gt;initialDuration&lt;/b&gt; - Once the endpoint reach to &#39;suspended&#39; state ( &#39;open&#39; state &amp;nbsp;in&amp;nbsp;Circuit Breaker pattern), it waits for 400 ms to perform next retry.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;retriesBeforeSuspension&lt;/b&gt; - This is the failure count to move endpoint into &#39;Suspended&#39;&amp;nbsp;( &#39;open&#39; state &amp;nbsp;in&amp;nbsp;Circuit Breaker pattern)&amp;nbsp;state.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;retryDelay&lt;/b&gt; - This is the delay in between failure calls. &amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
You can use above &quot;CalAPI&quot; to test this endpoint as well.&amp;nbsp;&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;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: black; font-family: Times; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: black; font-family: Times; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; height: auto; line-height: 20px; margin: 0px; overflow: auto; padding: 0px; text-align: left; width: 646.46875px;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt; &amp;lt;api name=&quot;CalAPI&quot; context=&quot;/cal&quot;&amp;gt;  
&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt;   &amp;lt;resource methods=&quot;GET&quot;&amp;gt;  
    &amp;lt;inSequence&amp;gt;  
      &amp;lt;send&amp;gt;  
&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;       &amp;lt;endpoint key=&quot;CircuitBreakerEP&quot;/&amp;gt;  
&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt;      &amp;lt;/send&amp;gt;  
    &amp;lt;/inSequence&amp;gt;  
    &amp;lt;outSequence&amp;gt;  
      &amp;lt;send/&amp;gt;  
    &amp;lt;/outSequence&amp;gt;  
    &amp;lt;faultSequence&amp;gt;  
      &amp;lt;header name=&quot;To&quot; action=&quot;remove&quot;&amp;gt;&amp;lt;/header&amp;gt;  
      &amp;lt;property name=&quot;RESPONSE&quot; value=&quot;true&quot;&amp;gt;&amp;lt;/property&amp;gt;  
      &amp;lt;property name=&quot;NO_ENTITY_BODY&quot; scope=&quot;axis2&quot; action=&quot;remove&quot;&amp;gt;&amp;lt;/property&amp;gt;  
      &amp;lt;log level=&quot;full&quot;&amp;gt;&amp;lt;/log&amp;gt;  
      &amp;lt;payloadFactory media-type=&quot;xml&quot;&amp;gt;  
       &amp;lt;format&amp;gt;  
         &amp;lt;ns:MyResponse xmlns:ns=&quot;http://services.samples&quot;&amp;gt;  
          &amp;lt;ns:Error&amp;gt;We can&#39;t response you at this time, we will reponse through E-mail soon&amp;lt;/ns:Error&amp;gt;  
         &amp;lt;/ns:MyResponse&amp;gt;  
       &amp;lt;/format&amp;gt;  
      &amp;lt;/payloadFactory&amp;gt;  
      &amp;lt;send/&amp;gt;  
    &amp;lt;/faultSequence&amp;gt;  
   &amp;lt;/resource&amp;gt;  
&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt; &amp;lt;/api&amp;gt;  
&lt;/b&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Internal Implementation&lt;/h3&gt;
I have included following details to clarify pattern implementation in terms of WSO2 ESB concepts, you may skip this section if you are not interested about internal implementation details.&lt;br /&gt;
&lt;br /&gt;
Following two diagrams illustrate state flow of original&amp;nbsp;Circuit Breaker&amp;nbsp;pattern and WSO2 ESB&amp;nbsp;implementation. Basically WSO2 ESB Endpoint &quot;&lt;i&gt;Active&lt;/i&gt;&quot; state is identical to &quot;&lt;i&gt;Closed&lt;/i&gt;&quot; state of the pattern and &quot;&lt;i&gt;Open&lt;/i&gt;&quot; state is identical to ESB Endpoint &quot;&lt;i&gt;Suspended&lt;/i&gt;&quot; state. One main difference is, in WSO2 ESB there is no separate state as &quot;&lt;i&gt;Half-Open&lt;/i&gt;&quot;, &quot;&lt;i&gt;Suspend&lt;/i&gt;&quot; state encapsulates logics belong to both &quot;&lt;i&gt;Open&lt;/i&gt;&quot; and &quot;&lt;i&gt;Half-Open&quot; &lt;/i&gt;states&lt;i&gt;.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Another difference &amp;nbsp;is, in WSO2 ESB after 1st failure, Endpoint is moved into &quot;&lt;i&gt;Timeout&lt;/i&gt;&quot; state and successive attempts will be executed from &quot;&lt;i&gt;Timeout&lt;/i&gt;&quot; state.&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/AVvXsEjFj1H04z_MOOMWiBcK1Rst1anfFn8if3IUDLXywt1zJCU1gsEnKAP-HlYp-F0cePlDGQTi9d-8cyRH9IUG0l2zUb4j3efo9nHgbJkBnJOQFx0EepHNpmG5sY40-sfg7SFslRR8/s1600/Screen+Shot+2015-05-02+at+12.05.26+PM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;401&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFj1H04z_MOOMWiBcK1Rst1anfFn8if3IUDLXywt1zJCU1gsEnKAP-HlYp-F0cePlDGQTi9d-8cyRH9IUG0l2zUb4j3efo9nHgbJkBnJOQFx0EepHNpmG5sY40-sfg7SFslRR8/s1600/Screen+Shot+2015-05-02+at+12.05.26+PM.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
Circuit Breaker pattern flow.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&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/AVvXsEgAFWE9zUHQsPdwvhQyNeKhdeMiwl58kqnjuT9f_55dZWPfx9dh58T7_mqCgFvK5_fGjQWqzV-INR2jV1Cc_rbwNziMiVB5yXjNxEJLcRV2TQLALJPE5snXrfc5oF5rdpFFG_nE/s1600/Screen+Shot+2015-05-02+at+12.56.40+PM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;465&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAFWE9zUHQsPdwvhQyNeKhdeMiwl58kqnjuT9f_55dZWPfx9dh58T7_mqCgFvK5_fGjQWqzV-INR2jV1Cc_rbwNziMiVB5yXjNxEJLcRV2TQLALJPE5snXrfc5oF5rdpFFG_nE/s1600/Screen+Shot+2015-05-02+at+12.56.40+PM.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
WSO2 ESB &amp;nbsp;internal flow&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
Following are some advanced configurations that can be used to achieve more flexible and &amp;nbsp;more complex implementations of&amp;nbsp;Circuit Breaker&amp;nbsp;pattern.&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b&gt;errorCodes&lt;/b&gt; - You can define what the failure code that&amp;nbsp;Circuit Breaker&amp;nbsp;should act on. Complete list of supported status codes can be found &lt;a href=&quot;https://docs.wso2.com/display/ESB460/Error+Handling+and+Error+Codes&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;progressionFactor&lt;/b&gt;, &lt;b&gt;maximumDuration&lt;/b&gt;&amp;nbsp;- By combining &amp;nbsp;with &quot;&lt;b&gt;retriesBeforeSuspension&lt;/b&gt;&quot; property you can form more complex and dynamic retry behaviours, for more details refer &lt;a href=&quot;https://docs.wso2.com/display/ESB481/Endpoint+Error+Handling&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;b&gt;NOTE&lt;/b&gt; &amp;nbsp;: -&amp;nbsp;&lt;span style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;&quot;&gt;In &lt;a href=&quot;http://wso2.com/api-management/&quot;&gt;WSO2 API Manger&lt;/a&gt;, &lt;a href=&quot;https://docs.wso2.com/display/AM180/Key+Concepts&quot;&gt;API-Gateway&lt;/a&gt; is a lightweight ESB node hence above discussed &quot;Timeout&quot; and &quot;&lt;/span&gt;Circuit Breaker&lt;span style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;&quot;&gt;&quot; pattern implementations can be seamlessly used in WSO2 API Manger as well. &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;page&quot; title=&quot;Page 4&quot;&gt;
&lt;div class=&quot;layoutArea&quot;&gt;
&lt;div class=&quot;column&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/8810450367231517848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/8810450367231517848?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/8810450367231517848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/8810450367231517848'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2015/05/timeout-and-circuit-breaker-pattern-in.html' title='Timeout and Circuit Breaker Pattern in WSO2 Way '/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07344103594883335708</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/AVvXsEjsptLnDtD10am9hez4pPWmyIulKa-qKISYiMU9Qr4zyCFmOyC4vixqQrp2mpuu3k92ZRSVEpv3W-re1C-tsjj4si1v8bKQJPl7mf7TV375vrqf6IacoQcF7NAL6SzGgXU2VNTo/s72-c/ref-time-out.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-2944321770073676403</id><published>2014-08-04T10:23:00.003+05:30</published><updated>2014-08-04T10:23:49.063+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="JavaEE"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaEE WebProfile"/><category scheme="http://www.blogger.com/atom/ns#" term="JAX-WS"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2 AS"/><title type='text'>JavaEE WebProfile support in WSO2 AS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
Some of the regular questions we receive from WSO2 Application Server users are abut JavaEE WebProfile support. &amp;nbsp;Does WSO2 AS support for&amp;nbsp;WebProfile ?&amp;nbsp;&amp;nbsp;If so what is&amp;nbsp;the possible time line ? &amp;nbsp;Any plans to support EJB ? are some of the very common queries.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
Instead of answering to above questions again and again we thought to explain our strategy on both JavaEE and JavaEE-WebProfile, implementation details and expected time line through a detailed white paper. &amp;nbsp;Recently we have finished this paper and already published on our website, here is the &lt;a href=&quot;http://wso2.com/whitepapers/evaluating-java-ee-application-migration-and-java-ee-service-migration-to-wso2-application-server/&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt;. &amp;nbsp;In summery WSO2 AS will support for JavaEE WebProfile with it&#39;s 6.0 version.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
Following diagram provides you an idea about JavaEE specifications supported in WSO2 AS 5.2.1 which is the latest released version. Though&amp;nbsp;WSO2 AS 5.2.1version is not fully supported for WebProfile it support for number of specifications defined under both WebProfile and Full profile.&amp;nbsp;&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/AVvXsEjRXN42MjiPXJe3nrhM52qdVf4m_LrQlcj84EnoXsWxWc8oOULIf8JVMj8xVgSfdJ0KIPlKno0yGlMCuSn-UBEEx6UZ111Vp2OdX645NaaCzonHA5f3IlnU2RmhHr7woUmoGg_c/s1600/Screen+Shot+2014-08-03+at+9.10.31+PM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRXN42MjiPXJe3nrhM52qdVf4m_LrQlcj84EnoXsWxWc8oOULIf8JVMj8xVgSfdJ0KIPlKno0yGlMCuSn-UBEEx6UZ111Vp2OdX645NaaCzonHA5f3IlnU2RmhHr7woUmoGg_c/s1600/Screen+Shot+2014-08-03+at+9.10.31+PM.png&quot; height=&quot;380&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;i&gt;( Here all dark coloured specifications are supported in AS 5.2.1 version and light&amp;nbsp;coloured specifications are not supported in AS 5.2.1)&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;a href=&quot;http://wso2.com/whitepapers/evaluating-java-ee-application-migration-and-java-ee-service-migration-to-wso2-application-server/&quot; target=&quot;_blank&quot;&gt;Link to the white paper&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
Additionally WSO2 AS use number of certified and proved open source frameworks to support JavaEE WebProfile, most of them from Apache. &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCKYAb208vs_x6umyh0kn8vFT_mFVDwg1I1qOvuRPh9ULSQ9czHwKUduRyPOvRas27e4CcC575Lm4rgep8VeMldqhGIRteWqUd52tT89pCcDG4SjmmFvTjPrNMqZD-i_DWIKwv/s1600/Screen+Shot+2014-08-03+at+8.51.36+PM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCKYAb208vs_x6umyh0kn8vFT_mFVDwg1I1qOvuRPh9ULSQ9czHwKUduRyPOvRas27e4CcC575Lm4rgep8VeMldqhGIRteWqUd52tT89pCcDG4SjmmFvTjPrNMqZD-i_DWIKwv/s1600/Screen+Shot+2014-08-03+at+8.51.36+PM.png&quot; height=&quot;458&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/2944321770073676403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/2944321770073676403?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/2944321770073676403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/2944321770073676403'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2014/08/javaee-webprofile-support-in-wso2-as.html' title='JavaEE WebProfile support in WSO2 AS'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07344103594883335708</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/AVvXsEjRXN42MjiPXJe3nrhM52qdVf4m_LrQlcj84EnoXsWxWc8oOULIf8JVMj8xVgSfdJ0KIPlKno0yGlMCuSn-UBEEx6UZ111Vp2OdX645NaaCzonHA5f3IlnU2RmhHr7woUmoGg_c/s72-c/Screen+Shot+2014-08-03+at+9.10.31+PM.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-6780452123472871989</id><published>2014-08-03T20:43:00.001+05:30</published><updated>2014-08-03T20:43:32.316+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="WebSocket"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2 AS"/><title type='text'>Secure Java WebSocket endpoints</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br class=&quot;Apple-interchange-newline&quot; /&gt;
During one of my previous &lt;a href=&quot;http://ssagara.blogspot.com/2014/07/websocket-security-patterns.html&quot; target=&quot;_blank&quot;&gt;post&lt;/a&gt; I have explained few security patterns that can be used with Java WebSocket applications and how to call them from client side applications including browser based and rich agent based clients. In this post I explain how to secure server side WebSocket endpoints easily, in fact if you are already familiar with security model defined by the Java Servlet specification there is nothing new, you could use same security model for WebSocket server endpoints as well. &amp;nbsp;Let&#39;s take an example and discuss, consider following use case.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;ol&gt;&lt;ol&gt;
&lt;li&gt;&lt;i&gt;Endpoint URL to secure &amp;nbsp; &amp;nbsp; &amp;nbsp; - /securewebsocket&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Transport level security &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- HTTPS&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Allow roles &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;- admin&amp;nbsp;&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Authentication metod &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - Basic&lt;/i&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;
Here in this use case we want to secure a WebSocket endpoint deployed on &quot;/securewebsocket&quot; URL. Users with only &quot;admin&quot; role can establish WebSocket connection and they should use SSL for transport level security, additionally server will use &amp;nbsp;HTTP BasicAuth to authenticate users during the handshake.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial; font-size: small;&quot;&gt;
We can fulfil above security requirement easily by adding following entries into web.xml file.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;   &amp;lt;security-constraint&amp;gt;  
       &amp;lt;display-name&amp;gt;Secure WebSocket Endpoint&amp;lt;/display-name&amp;gt;  
       &amp;lt;web-resource-collection&amp;gt;  
          &amp;lt;web-resource-name&amp;gt;Secure WebSocket Endpoint&amp;lt;/web-resource-name&amp;gt;  
          &amp;lt;url-pattern&amp;gt;/securewebsocket&amp;lt;/url-pattern&amp;gt;  
          &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;  
       &amp;lt;/web-resource-collection&amp;gt;  
       &amp;lt;auth-constraint&amp;gt;  
         &amp;lt;role-name&amp;gt;admin&amp;lt;/role-name&amp;gt;  
       &amp;lt;/auth-constraint&amp;gt;  
       &amp;lt;user-data-constraint&amp;gt;  
          &amp;lt;transport-guarantee&amp;gt;CONFIDENTIAL&amp;lt;/transport-guarantee&amp;gt;  
       &amp;lt;/user-data-constraint&amp;gt;  
   &amp;lt;/security-constraint&amp;gt;                        
   &amp;lt;login-config&amp;gt;  
     &amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;  
     &amp;lt;realm-name&amp;gt;basic&amp;lt;/realm-name&amp;gt;  
   &amp;lt;/login-config&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial; font-size: small;&quot;&gt;
Now let&#39;s let&#39;s look at what are the various we could use for authentication and authorization.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;b&gt;Authentication options&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
1. BASIC&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
This is the basic authentication schema where client sends set of user name and password as a encoded string along with a HTTP header. In case of browser based clients browser pop-up a dialog to enter user name and password.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
2. FORM&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
In form based authentication application developers create a HTML login page to send user name and password. This approach is similar to &quot;Basic&quot; but flexible &amp;nbsp;to have customized&amp;nbsp;login page.&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
3. DIGEST&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
Much secure than above two options, it specially applies a hash function to the password before sending to he server.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
4. CLIENT-CERT&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
This also a better authentication schema where client is authenticated using client&#39;s digital certificate. &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;b&gt;Authorization options&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
1. NONE&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
This indicate server should accept any connection including unprotected connections. &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
2. INTEGRAL &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
This ensures that the data be sent between client and server in such a way that it cannot be changed in transit.&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
3. CONFIDENTIAL &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
During the data transmissions this ensures other entities can&#39;t observer contents of the transmission.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;&amp;nbsp;In practice web servers treat the CONFIDENTIAL and INTEGRAL transport guarantee values identical.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #222222; font-family: arial; font-size: x-small;&quot;&gt;In both CONFIDENTIAL and INTEGRAL options clients should use secure WebSocket (wss://) protocol.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;span style=&quot;color: #222222; font-family: arial; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/6780452123472871989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/6780452123472871989?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/6780452123472871989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/6780452123472871989'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2014/08/secure-java-websocket-endpoints.html' title='Secure Java WebSocket endpoints'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07344103594883335708</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-33519738.post-6952968818676371543</id><published>2014-07-27T11:25:00.000+05:30</published><updated>2014-07-27T11:26:07.501+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2 AS"/><title type='text'>Support multiple versions of Axis2 in WSO2 AS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
Some users of WSO2 AS tend to think that they don&#39;t have freedom to use what ever the Axis2 version they want instead have to stick to the default version supported by WSO2 AS distribution, but recent versions of WSO2 AS specially after AS 5.1.0 there is no such limitation. In this post I discuss how you could support multiple versions of Axis2 within WSO2 AS together with possible deployment options. &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
I have described each and every options in detail below and here is the summery.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Axis2 services as standalone WAR applications.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Axis2 services&amp;nbsp;as standalone WAR applications&amp;nbsp;using AS default Axis2 runtime environment.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Axis2 services as WAR applications using custom Axis2 runtime environment.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Axis2 services as AAR applications &amp;nbsp;using AS default Axis2 runtime environment.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Axis2 services as AAR applications using custom Axis2 runtime environment.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;
&lt;b&gt;Use case&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
WSO2 AS 5.2.1 version is distributed with Axis2 1..6.1 plus some custom patches. Assume one wants to use Apache Axis2 1.7.0 on WSO2 AS 5.2.1.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;b&gt;Note&lt;/b&gt; - &lt;i&gt;Axis2 1.7.0 yet to be released hence I use Axis2 1.7.0-SNAPSHOT version &amp;nbsp;for this post but what ever the details I cover here are common for any Axis2 version.&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;b&gt;Note&lt;/b&gt; - &lt;i&gt;In case if you use WSO2 AS 5.2.1, 5.2.0 or 5.1.0 versions you need to do following additional steps.&lt;/i&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;a. Open AS-HOME/repository/conf/tomcat/webapp-classloading-environments.xml file.&amp;nbsp;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial;&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;b. Find &amp;lt;DelegatedEnvironment&amp;gt; with name &quot;Carbon&quot;, replace it with following configuration.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div style=&quot;font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;DelegatedEnvironment&amp;gt;  
       &amp;lt;Name&amp;gt;Carbon&amp;lt;/Name&amp;gt;  
       &amp;lt;DelegatedPackages&amp;gt;*,!org.springframework.*,   
        !org.apache.axis2.*, !antlr.*,!org.aopalliance.*,   
        !org.apache.james.*, !org.apache.axiom.*,   
        !org.apache.bcel.*, !org.apache.commons.*,   
        !com.google.gson.*, !org.apache.http.*,   
        !org.apache.neethi.*, !org.apache.woden.*  
 &amp;lt;/DelegatedPackages&amp;gt; &amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;
&lt;/code&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;
 &amp;lt;/DelegatedEnvironment&amp;gt;  
     &amp;lt;DelegatedEnvironment&amp;gt;  
       &amp;lt;Name&amp;gt;Axis2&amp;lt;/Name&amp;gt;  
       &amp;lt;DelegatedPackages&amp;gt;*&amp;lt;/DelegatedPackages&amp;gt;  
 &amp;lt;/DelegatedEnvironment&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;b&gt;1.&amp;nbsp;Axis2 services as standalone WAR applications.&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&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/AVvXsEhisjVRpuuuIWjz_2Ft9TbGPe618OV3DbjLV0HdnV_huGBbmbMMjZpvxtMOWhLLZ3-TM63AYZW2aSnPJut9sG2K-hVfiyy8OJzPjCPbC4FdUHbyHCv9lYxCG-8AU8yKBBE9Ti2N/s1600/Screen+Shot+2014-07-27+at+10.45.45+AM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhisjVRpuuuIWjz_2Ft9TbGPe618OV3DbjLV0HdnV_huGBbmbMMjZpvxtMOWhLLZ3-TM63AYZW2aSnPJut9sG2K-hVfiyy8OJzPjCPbC4FdUHbyHCv9lYxCG-8AU8yKBBE9Ti2N/s1600/Screen+Shot+2014-07-27+at+10.45.45+AM.png&quot; height=&quot;411&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
In fact here I don&#39;t need to mention any thing special you can think Axis2 as just another web framework and develop your service and deploy as a WAR file just like you develop any other web application such Spring, Apache Wicket, Apache Structs etc.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
If you are a novice to Axis2 you can easily start with Axis2 web application Maven archetype, I have covered details about this Maven archetype &lt;a href=&quot;http://ssagara.blogspot.com/2012/02/axis2-archetype-to-create-web.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;. Also you can find complete working sample from &lt;a href=&quot;https://github.com/sagaragu/multiple-axis2-on-wso2as/tree/master/axis2-war-standalone&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
Once you build this sample application you can deploy to WSO2 AS as a web application. Once you done that it is possible to access WSDL through following url.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; http://localhost:9763/axis2-war-standalone/HelloService?wsdl  
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;2.&amp;nbsp;Axis2 services&amp;nbsp;as standalone WAR applications&amp;nbsp;using AS default Axis2 runtime environment.&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&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/AVvXsEiSwMNgTULbfsQnFUSmqjvoVrlxjdvIgRoEqz-rKKZyS1E6zJY08c_wu4-Ch-fxs0GOnHq6yiG99PxWLDKUFwYkqCt89-TQctNmif835DjqBQW-Mi-A75qz9YG675-2c0Bjmpxt/s1600/Screen+Shot+2014-07-27+at+10.48.57+AM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSwMNgTULbfsQnFUSmqjvoVrlxjdvIgRoEqz-rKKZyS1E6zJY08c_wu4-Ch-fxs0GOnHq6yiG99PxWLDKUFwYkqCt89-TQctNmif835DjqBQW-Mi-A75qz9YG675-2c0Bjmpxt/s1600/Screen+Shot+2014-07-27+at+10.48.57+AM.png&quot; height=&quot;420&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
If you open and inspect WEB-INF/lib directory of above sample &amp;nbsp;you can find number of Axis2 jar files and their dependencies. Size of the WAR file can be vary from 8MB to 10 MB or so on. This is ok if you deploy one or two services but in case if you deploy large number of services then packaging dependencies with each and every WAR file may not convenient and can be a extra overhead too.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
The solution for this is to use default Axis2 runtime environment or add a new custom runtime environment (CRE) for Axis2. Under this point I cover first option and next point cover 2nd option by creating a custom CRE. In both approaches you don&#39;t need to duplicate any Axis2 or dependent Jar file inside WEB-INF/lib directory you have to include your application specific Jar files only.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
Further in both approaches we use webapp-classloading.xml file to define runtime environment for the service. webapp-classloading.xml file is WSO2 AS specific application descriptor and it is expected to present on META-INF directory in case of a runtime environment customisation like this. &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
You can find complete working example for this option from &lt;a href=&quot;https://github.com/sagaragu/multiple-axis2-on-wso2as/tree/master/axis2-war-dre&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;. Download, build and deploy this service then you can access to WSDL file in following URL.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;&quot;&gt;&lt;code style=&quot;word-wrap: normal;&quot;&gt; http://localhost:9763/axis2-war-dre/HelloService?wsdl  
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
If you open webapp-classloading.xml file you should able to see following entry.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;Classloading xmlns=&quot;http://wso2.org/projects/as/classloading&quot;&amp;gt;  
   &amp;lt;ParentFirst&amp;gt;false&amp;lt;/ParentFirst&amp;gt;  
   &amp;lt;Environments&amp;gt;Axis2&amp;lt;/Environments&amp;gt;  
 &amp;lt;/Classloading&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
Please note in this example we consumed default Axis2 version shipped with WSO2 AS.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;b&gt;3.&amp;nbsp;Axis2 services as WAR applications using custom Axis2 runtime environment.&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&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/AVvXsEh-WdZhWqBzMFvQtRVA84fkAXwh3E-woGd_hJtgjuBhemn2QdLWFiNbGaaqJS1TWsbxc6A98srYOPo-3sOZUjsg-6FZ_LVG1PuMbKkEjeaI-Fay54aHatt8ZbHzrAgVVa371V1E/s1600/Screen+Shot+2014-07-27+at+10.50.21+AM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-WdZhWqBzMFvQtRVA84fkAXwh3E-woGd_hJtgjuBhemn2QdLWFiNbGaaqJS1TWsbxc6A98srYOPo-3sOZUjsg-6FZ_LVG1PuMbKkEjeaI-Fay54aHatt8ZbHzrAgVVa371V1E/s1600/Screen+Shot+2014-07-27+at+10.50.21+AM.png&quot; height=&quot;406&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
As I explained earlier here also we don&#39;t package any Axis2 related Jar file inside the service. The main difference from previous one is here we create a new CRE, which means you can bring any Axis2 version you want and share with your service just like you share default Axis2 runtime. Following are the required steps.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
a. Download required Axis2 version from Apache Axis2 web site &lt;a href=&quot;http://axis.apache.org/axis2/java/core/download.cgi&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;. (Let&#39;s say Axis2-1.7.0-SNAPSHOT.zip )&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
b. Create a new directory called &quot;axis217&quot; under &quot;AS-HOME/lib/runtimes&quot; . We generally use &quot;AS-HOME/lib/runtimes&quot; directory to keep Jar files belong to custom runtimes.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
c. Extract downloaded &amp;nbsp;Axis2-1.7.0-SNAPSHOT.zip file and copy all jar files available on &quot;Axis2-1.7.0-SNAPSHOT/lib&quot; directory to above created AS-HOME/lib/runtimes/axis217&quot; directory.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
d. Open AS-HOME/repository/conf/tomcat/webapp-classloading-environments.xml file and add following entry which define a new CRE for Axis2 1.7.0-SNAPSHOT version.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;   &amp;lt;ExclusiveEnvironments&amp;gt;  
     &amp;lt;ExclusiveEnvironment&amp;gt;  
       &amp;lt;Name&amp;gt;Axis217&amp;lt;/Name&amp;gt;  
       &amp;lt;Classpath&amp;gt;  
         ${carbon.home}/lib/runtimes/axis217/*.jar;  
         ${carbon.home}/lib/runtimes/axis217/  
       &amp;lt;/Classpath&amp;gt;  
     &amp;lt;/ExclusiveEnvironment&amp;gt;  
   &amp;lt;/ExclusiveEnvironments&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
e. Download complete example code from &lt;a href=&quot;https://github.com/sagaragu/multiple-axis2-on-wso2as/tree/master/axis2-war-cre17&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
f. Build and deploy to WSO2 AS, you can access WSDL file through following url.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;&quot;&gt;&lt;code style=&quot;word-wrap: normal;&quot;&gt;
 http://localhost:9763/axis2-war-cre/HelloService?wsdl  
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
Like in previous example if you open the webapp-classloading.xml file under META-INF directory of the sample service you should able to see following entry. This is how we refer &quot;Axis217&quot; CRE we just created inside the web service ( this allows applications/services to load required Axis2 dependencies from &quot;Axis217&quot; CRE ).&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;Classloading xmlns=&quot;http://wso2.org/projects/as/classloading&quot;&amp;gt;  
     &amp;lt;ParentFirst&amp;gt;false&amp;lt;/ParentFirst&amp;gt;  
     &amp;lt;Environments&amp;gt;Axis217&amp;lt;/Environments&amp;gt;  
 &amp;lt;/Classloading&amp;gt;   &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;b&gt;4.&amp;nbsp;Axis2 services as AAR applications &amp;nbsp;using AS default Axis2 runtime environment.&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&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/AVvXsEiN25Ft3X56BS9-IQ1S_baAs-qr3RESwV0nStt9qV3WcVjL3H4of4kplSTpxqS3ZJH3HxBWn-FQUDfp9aAnHruxaXSSvKv4v-AxJXQ5HHyxPmqYFEZDixgHnhsNt_dk18_TIGIw/s1600/Screen+Shot+2014-07-27+at+10.59.41+AM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiN25Ft3X56BS9-IQ1S_baAs-qr3RESwV0nStt9qV3WcVjL3H4of4kplSTpxqS3ZJH3HxBWn-FQUDfp9aAnHruxaXSSvKv4v-AxJXQ5HHyxPmqYFEZDixgHnhsNt_dk18_TIGIw/s1600/Screen+Shot+2014-07-27+at+10.59.41+AM.png&quot; height=&quot;418&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
So far for above examples we used &amp;nbsp;WAR packaging but now let&#39;s look at how you could develop Axis2 service as a AAR archive and deploy.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
In this AAR option first we have to deploy axis2.war file then deploy .AAR file through the admin interface provided by &amp;nbsp;the Axis2. Here axis2.war application act as container within the WSO2 AS. &amp;nbsp;For this approach also we could use default Axis2 runtime, please refer following procedure.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
a. Download web archive version (WAR) of Axis2 from Apache &lt;a href=&quot;http://axis.apache.org/axis2/java/core/download.cgi&quot; target=&quot;_blank&quot;&gt;Axis2 web site&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
b. Extract axis2.war file and perform following modifications.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
c. As we will use default Axis2 version available with WSO2 AS remove &quot;lib&quot; directory from extracted axis2 directory.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
d. In order to use default Axis2 runtime, create a file called webapp-classloading.xml &amp;nbsp;with following content.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;Classloading xmlns=&quot;http://wso2.org/projects/as/classloading&quot;&amp;gt;  
    &amp;lt;ParentFirst&amp;gt;false&amp;lt;/ParentFirst&amp;gt;  
    &amp;lt;Environments&amp;gt;Axis2&amp;lt;/Environments&amp;gt;  
 &amp;lt;/Classloading&amp;gt;  &lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
e. re-archive Axis2 directory as axis2.war and deploy into WSO2 AS.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
Now you should able to see Axis2 admin console through following url which can be used to upload your AAR services.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;&quot;&gt;&lt;code style=&quot;word-wrap: normal;&quot;&gt;
 http://localhost:9763/axis2 
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
Here is WSDL url for default version sample.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;&quot;&gt;&lt;code style=&quot;word-wrap: normal;&quot;&gt;
 http://localhost:9763/axis2/services/Version?wsdl
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;b&gt;Note&lt;/b&gt; - &lt;i&gt;If you use WSO2 AS 5.2.1 or previous version it may possible to get few JSP rendering issues on above mentioned Axis2 admin console but those are not affect to any service invocations. &lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;b&gt;5. Deploy web service as AAR file using custom Axis2 runtime environment.&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&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/AVvXsEi4uZ_P1FAgUQWh9giQcEusOUnlVoqHwKULtmum_qpKlVIGBmZoSYiIGvYkNOSpee8H7F0n4e1LbWcg97xZT86ZkuQKmz2NzXwAdDv3XjCDiBTFx2xSLRA_vHa0apW-PqSQuyn4/s1600/Screen+Shot+2014-07-27+at+10.58.27+AM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4uZ_P1FAgUQWh9giQcEusOUnlVoqHwKULtmum_qpKlVIGBmZoSYiIGvYkNOSpee8H7F0n4e1LbWcg97xZT86ZkuQKmz2NzXwAdDv3XjCDiBTFx2xSLRA_vHa0apW-PqSQuyn4/s1600/Screen+Shot+2014-07-27+at+10.58.27+AM.png&quot; height=&quot;430&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
This approach is also similar to previous one but instead of default Axis2 runtime we use Axis2 dependencies available with axis2.war distribution. Please refer following procedure. &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;div&gt;
a. Download web archive version (WAR) of Axis2 from Apache Axis2 web site.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
b. Deploy axis2.war file into WSO2 AS.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now you should able to see Axis2 admin console through following url which can be used to upload your AAR services.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;&quot;&gt;&lt;code style=&quot;word-wrap: normal;&quot;&gt;

 http://localhost:9763/axis2 
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here is WSDL url for default version sample.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;&quot;&gt;&lt;code style=&quot;word-wrap: normal;&quot;&gt;
 http://localhost:9763/axis2/services/Version?wsdl
&lt;/code&gt;&lt;/pre&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;b&gt;Note&lt;/b&gt;&amp;nbsp;-&amp;nbsp;&lt;i&gt;If you use WSO2 AS 5.2.1 or previous version it may possible to get few JSP rendering issues on above mentioned Axis2 admin console but those are not affect to any service invocations.&amp;nbsp;&lt;/i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/6952968818676371543/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/6952968818676371543?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/6952968818676371543'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/6952968818676371543'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2014/07/support-multiple-versions-of-axis2-in.html' title='Support multiple versions of Axis2 in WSO2 AS'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07344103594883335708</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/AVvXsEhisjVRpuuuIWjz_2Ft9TbGPe618OV3DbjLV0HdnV_huGBbmbMMjZpvxtMOWhLLZ3-TM63AYZW2aSnPJut9sG2K-hVfiyy8OJzPjCPbC4FdUHbyHCv9lYxCG-8AU8yKBBE9Ti2N/s72-c/Screen+Shot+2014-07-27+at+10.45.45+AM.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-4913239250762320810</id><published>2014-07-24T23:21:00.005+05:30</published><updated>2014-07-24T23:32:36.466+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="WebSocket"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2 AS"/><title type='text'>WebSocket security patterns</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
WebSocket protocol introduced &quot;&lt;span style=&quot;color: #252525; font-family: sans-serif; font-size: 18px; line-height: 28px;&quot;&gt;wss&quot; prefix to define secure web socket connections that is for transport level security (TLS). &amp;nbsp;But i&lt;/span&gt;t does not define any authentication or&amp;nbsp;Authorization&amp;nbsp; mechanism, instead it is possible to reuse existing HTTP based&amp;nbsp;authentication/Authorization&amp;nbsp;mechanisms during the handshake phase. &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
Here I discuss two security patterns that can be used to connect secure WebSocket endpoint from a client. Assume WebSocket endpoint is secured with HTTP BasicAuth while HTTP/SSL used for transport level security. &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;b&gt;1. ) Browser based clients&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
For web browser based clients most popular choice is to use J&lt;a href=&quot;http://www.w3.org/TR/2011/WD-websockets-20110419/&quot; target=&quot;_blank&quot;&gt;avaScript API for WebSocket&lt;/a&gt; but this API does not provide any approach to send &quot;Authorization&quot; or any other headers along with the handshake request. Following pattern can be used &amp;nbsp;to overcome above issue.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
The technique we use here is secure the web page where we run JS WebSocket client through BasicAuth security. Please refer the message flow.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; color: #222222; font-family: arial; font-size: small; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBGiTWhpvR4jGF0AzQcdh-pOL1me7HHkiWOGSaEI0dKEbn7AcxdVlPpFdZ5A62cCh_mir7JxfWS4Q-jZeH8QSD1EbjXlYBx4XiHZE0c0SGIzXBc1Poffx9vIgieUiOFZ4Oly2d/s1600/Screen+Shot+2014-07-24+at+12.24.56+AM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBGiTWhpvR4jGF0AzQcdh-pOL1me7HHkiWOGSaEI0dKEbn7AcxdVlPpFdZ5A62cCh_mir7JxfWS4Q-jZeH8QSD1EbjXlYBx4XiHZE0c0SGIzXBc1Poffx9vIgieUiOFZ4Oly2d/s1600/Screen+Shot+2014-07-24+at+12.24.56+AM.png&quot; height=&quot;252&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
1. User access the secure page through a web browser through HTTPS.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
2. Since the page is secured web server return 401 status code.&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
3. Browser challenges user to enter valid user name and password then send them as a encoded value with &amp;nbsp;&quot;Authorization&quot; header.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
4. If credentials are correct server returns secure page.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
5. JS WebSocket client on secured page send handshake request to the secured remote WebSocket endpoint through WSS protocol. Due to previous interaction with the same page browser persist and send authorization details along with the handshake request.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
6. Since handshake request transmit through HTTPS it fulfil the both requirements, BasicAuth and TLS. Server returns handshake response back to the client. &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
7. Now it&#39;s possible to establish WebSocket connection among above two parties.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;b&gt;2.) Agent based client (Non browser based)&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
For agent based clients you could use a WebSocket framework which facilitate &amp;nbsp;to add authentication headers and also to configure SSL configuration such as key store. &amp;nbsp;Following diagram illustrate a pattern which we be can used with agents based clients.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; color: #222222; font-family: arial; font-size: small; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0HQdKSWMJVpTUfwgfn4whBUrd7J1PfH0LRU9s6U6RV1JL4L62UczJsheAOBmTItNeCNW8fcYvMKFb5FBd7i-5y2oZH2ws-KU6-3z7ZPnQMDUbzO9C8o6cv2eje0valknK5-D6/s1600/Screen+Shot+2014-07-24+at+12.27.27+AM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0HQdKSWMJVpTUfwgfn4whBUrd7J1PfH0LRU9s6U6RV1JL4L62UczJsheAOBmTItNeCNW8fcYvMKFb5FBd7i-5y2oZH2ws-KU6-3z7ZPnQMDUbzO9C8o6cv2eje0valknK5-D6/s1600/Screen+Shot+2014-07-24+at+12.27.27+AM.png&quot; height=&quot;172&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
1. Using the client side API of the WebScoket framework create a handshake request.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
2. Set Authorization header and other required key store information for TLS.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
3. Send &amp;nbsp;handshake request through WebSocket framework API.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
4. Server receive handshake and Authorization header &amp;nbsp;through HTTPS . Validate the header and if valid &amp;nbsp;send the handshake response back to the client.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
5. Now it&#39;s possible to establish WebSocket connection among above two parties.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
As an example &lt;a href=&quot;https://jcp.org/en/jsr/detail?id=356&quot; target=&quot;_blank&quot;&gt;Java API for WebSocket &lt;/a&gt;&amp;nbsp;allows to send&amp;nbsp;custom headers &amp;nbsp;along with handshake request by writing a custom Configurator which extend from &amp;nbsp;&lt;a href=&quot;http://docs.oracle.com/javaee/7/api/javax/websocket/ClientEndpointConfig.Configurator.html&quot; target=&quot;_blank&quot;&gt;ClientEndpointConfig.Configurator&lt;/a&gt;.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
Here is such example.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; public class ClientEndpointConfigurator extends  
           ClientEndpointConfig.Configurator {  
      @Override  
      public void beforeRequest(Map&amp;lt;String, List&amp;lt;String&amp;gt;&amp;gt; headers) {  
       String auth = &quot;Basic &quot; +   
          Base64Utils.encodeToString(&quot;user:pass&quot;.getBytes(Charset.forName(&quot;UTF-8&quot;)), false);  
       headers.put(&quot;Authorization&quot;, Arrays.asList(new String[]{auth }));  
       super.beforeRequest(headers);  
      }  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
Once you wrote this ClientEndpointConfigurator you can refer it from Client endpoint using &amp;nbsp;&#39;ClientEndpoint&#39; annotation as follows.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #f0f0f0; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; 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;    &amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #f0f0f0; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1px dashed rgb(204, 204, 204); height: auto; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; font-family: arial; font-size: 12px; line-height: 20px; word-wrap: normal;&quot;&gt;@ClientEndpoint(configurator=ClientEndpointConfigurator.class)  &lt;/code&gt;&lt;code style=&quot;font-size: 12px; line-height: 20px; word-wrap: normal;&quot;&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #f0f0f0; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1px dashed rgb(204, 204, 204); height: auto; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;font-size: 12px; line-height: 20px; word-wrap: normal;&quot;&gt;public class EchoClientEndpoint {&lt;/code&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #f0f0f0; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1px dashed rgb(204, 204, 204); height: auto; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;font-size: 12px; line-height: 20px; word-wrap: normal;&quot;&gt;        ........................&lt;/code&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #f0f0f0; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1px dashed rgb(204, 204, 204); height: auto; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;font-size: 12px; line-height: 20px; word-wrap: normal;&quot;&gt;    }&lt;/code&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #f0f0f0; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; 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;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial; font-size: small;&quot;&gt;
By the way there is no portable API to define SSL configurations required for TLS but some framework such as &amp;nbsp;&lt;a href=&quot;https://tyrus.java.net/&quot; target=&quot;_blank&quot;&gt;Tyrus&lt;/a&gt; provides proprietary APIs . As an example refer how this facilitated in Tyrus through&amp;nbsp;&lt;a href=&quot;https://tyrus.java.net/apidocs/1.7/org/glassfish/tyrus/client/ClientManager.html#SSL_ENGINE_CONFIGURATOR&quot; target=&quot;_blank&quot;&gt;ClientManager&lt;/a&gt; API.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/4913239250762320810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/4913239250762320810?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/4913239250762320810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/4913239250762320810'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2014/07/websocket-security-patterns.html' title='WebSocket security patterns'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07344103594883335708</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/AVvXsEgBGiTWhpvR4jGF0AzQcdh-pOL1me7HHkiWOGSaEI0dKEbn7AcxdVlPpFdZ5A62cCh_mir7JxfWS4Q-jZeH8QSD1EbjXlYBx4XiHZE0c0SGIzXBc1Poffx9vIgieUiOFZ4Oly2d/s72-c/Screen+Shot+2014-07-24+at+12.24.56+AM.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-3339403455470894404</id><published>2013-10-12T22:26:00.000+05:30</published><updated>2013-10-12T22:26:48.814+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="Synapse"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2 ESB"/><title type='text'>How to manage WSDL binding on ESB proxy services </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
In &lt;a href=&quot;http://wso2.com/products/enterprise-service-bus/&quot; target=&quot;_blank&quot;&gt;WSO2 ESB&lt;/a&gt; if you associate a backend WSDL file
 when creating a proxy service it will generate an identical WSDL for 
the proxy service except WSDL port address&#39;s location attribute. Value 
of the WSDL port address&#39;s location attribute is modified according to 
ESB host name. By default ESB generate WSDL for proxy services with 
following three bindings. &lt;/div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;SOAP 1.1 Binding &lt;/li&gt;
&lt;li&gt;SOAP 1.2&amp;nbsp; Binding &lt;/li&gt;
&lt;li&gt;HTTP Binding &lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
But
 there are some situations that backend service only support one or two 
of above bindings not all three, specially most of the JAX-WS 
implementations such as CXF only generate SOAP 1.1 binding.&amp;nbsp; In such 
case if you send a message to un-supported binding through the ESB you 
will&amp;nbsp; get an error. To avoid such situations you could use following ESB
 parameters to control WSDL generation.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;  &amp;lt;parameter name=&quot;disableSOAP11&quot;&amp;gt;true&amp;lt;/parameter&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
This will avoid generation of SOAP 1.1 binding&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;   &amp;lt;parameter name=&quot;disableSOAP12&quot;&amp;gt;true&amp;lt;/parameter&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
This will avoid generation of SOAP 1.2 binding&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;parameter name=&quot;disableREST&quot;&amp;gt;true&amp;lt;/parameter&amp;gt;   
&lt;/code&gt;&lt;/pre&gt;
This will avoid generation of SOAP 1.2 binding&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please note above setting can be used with &lt;a href=&quot;http://synapse.apache.org/&quot; target=&quot;_blank&quot;&gt;Apache Synapse&lt;/a&gt;&amp;nbsp; as well. &lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/3339403455470894404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/3339403455470894404?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/3339403455470894404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/3339403455470894404'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2013/10/how-to-manage-wsdl-binding-on-esb-proxy.html' title='How to manage WSDL binding on ESB proxy services '/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07344103594883335708</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-33519738.post-8334426780490465770</id><published>2013-08-04T20:32:00.003+05:30</published><updated>2013-08-05T07:41:44.220+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="JAX-WS"/><category scheme="http://www.blogger.com/atom/ns#" term="Synapse"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2 ESB"/><title type='text'> WSO2 ESB proxy services for JAX-WS backends </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Proxy service concept is one of the main useful component in WSO2 ESB.&amp;nbsp; 
There are&lt;a href=&quot;http://docs.wso2.org/wiki/display/ESB470/Proxy+Services&quot; target=&quot;_blank&quot;&gt; number of variant&lt;/a&gt; formats available to create proxy services 
such as pass-through proxy , WSDL based proxy, security proxy etc.&amp;nbsp; When
 creating a proxy service it is possible to assign a WSDL file to 
describe the service this simplify service invocation from client side, 
usually client side tools are capable of understanding WSDL file 
associate with the proxy service so that they can generate client codes 
or can generate expected sample messages . As an example once the WSDL 
given SoapUI can generate expected sample messages.&amp;nbsp; &lt;b&gt;When a message is 
reach to the ESB and if it dispatch to a WSDL based proxy service then 
it&#39;s required to dispatch the message to a operation within the service 
in order to redirect messages&amp;nbsp; to backend service, in this case 
dispatching to the service level only (without dispatching to a operation ) 
is not sufficient.&lt;/b&gt;&amp;nbsp; But if you don&#39;t associate WSDL file during the 
proxy service creation then to redirect message to the backend service-level dispatching is sufficient.&lt;br /&gt;
&lt;br /&gt;
In users point of view there are some use cases that operation level dispatching is useful. &lt;br /&gt;
&lt;br /&gt;
1.&amp;nbsp; Apply QoS features such as throttling, security per operation level instead of service level. &lt;br /&gt;
&lt;br /&gt;
2. Associate WS-Policy per operation instead of per service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Both service and operation dispatchers use information available 
with incoming messages to find correct service/operation, those 
information can be transport level properties or message level 
properties some of the given below. &lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Request URI&lt;/li&gt;
&lt;li&gt;SOAPAction HTTP header&amp;nbsp;&lt;/li&gt;
&lt;li&gt;WS-Addressing headers&lt;/li&gt;
&lt;li&gt;QName of the first child under SOAP Body element.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
Here first it try to dispatch messages based on transport level 
properties and if it fails it try to perform dispatching based on 
message properties such as QName of the root element. Please note if 
it&#39;s possible to complete dispatching only based on transport level 
details that improves&amp;nbsp; overall performance of the invocation because 
there is no need to build the message to find dispatching information. 
But in practical situations due to various reasons it is not possible to
 complete dispatching only using transport level details once such 
common use case is described below. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Use case -1 &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In 
JAX-WS specification it&#39;s not mandatory to generate unique SOAPAction 
property per each operation unless developer specifically annotate the 
SOAPAction with SEI, by default for JAX-WS services it generate &quot;&quot; as 
the expected value for all operation. Assume you create a WSDL 
associated proxy service for JAX-WS service and client send following 
data to the proxy service.&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Valid SOAP message&lt;/li&gt;
&lt;li&gt;Request URI up to service level ( e.h http://host/proxyServiceName )&lt;/li&gt;
&lt;li&gt;HTTP SOAPAction =&quot;&quot;&lt;/li&gt;
&lt;/ul&gt;
In above case using request URI it is possible to find the correct 
service but in order to find the correct operation&amp;nbsp; it&#39;s required to 
build the message and look the QName of the first child under SOAPBoday 
this can affect to overall performance but still successful service 
invocation is possible.&lt;br /&gt;
&lt;br /&gt;
Starting from 4.6.0 version WSO2&amp;nbsp; 
ESB uses new HTTP transport called pass-through which provides very high
 performance level, &lt;a href=&quot;http://techfeast-hiranya.blogspot.com/2013/02/how-worlds-fastest-esb-was-made.html&quot; target=&quot;_blank&quot;&gt;this blog post&lt;/a&gt; provides insights on pass-through 
transport but in simple terms it uses shared buffer and avoid message 
building at all. Now this new transport mechanism effect to above 
described use case -1 because now message building is not possible and 
hence operation dispatching is fail and messages will not process 
further.&amp;nbsp;&amp;nbsp; We have addressed this limitation in upcoming ESB 4.8.0 
version, before I describe the solution let me introduce some of the 
workarounds which can be used with 4.60 and 4.7.0 versions. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;For ESB 4.6.0/4.7.0&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
1.) &amp;nbsp; Append operation name at the end of the Request URI so that request URI can be used to dispatch both service and operation.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;  http://host/proxyServiceName/&lt;b&gt;OperationName&lt;/b&gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
2. If it&#39;s possible modify backend JAX-WS SEI so that each operation having unique SOAPAction value.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; @WebMethod(&lt;b&gt;action=&quot;XXXX&quot;&lt;/b&gt;)   
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Move back to NHTTP transport instead of Pass-through in NHTTP on-demand message building is possible .&lt;br /&gt;
&lt;br /&gt;
This is what you have on ESB 4.6.0&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;transportSender name=&quot;http&quot; class=&quot;org.apache.synapse.transport.passthru.PassThroughHttpSender&quot;&amp;gt;  
   &amp;lt;parameter name=&quot;non-blocking&quot; locked=&quot;false&quot;&amp;gt;true&amp;lt;/parameter&amp;gt;  
 &amp;lt;/transportSender&amp;gt;  
 &amp;lt;transportReceiver name=&quot;http&quot; class=&quot;org.apache.synapse.transport.passthru.PassThroughHttpListener&quot;&amp;gt;  
   &amp;lt;parameter name=&quot;port&quot; locked=&quot;false&quot;&amp;gt;8280&amp;lt;/parameter&amp;gt;  
   &amp;lt;parameter name=&quot;non-blocking&quot; locked=&quot;false&quot;&amp;gt;true&amp;lt;/parameter&amp;gt;      
   &amp;lt;parameter name=&quot;httpGetProcessor&quot; locked=&quot;false&quot;&amp;gt;org.wso2.carbon.transport.nhttp.api.PassThroughNHttpGetProcessor&amp;lt;/parameter&amp;gt;     
 &amp;lt;/transportReceiver&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace above code using following. &lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;transportReceiver name=&quot;http&quot; class=&quot;org.apache.synapse.transport.nhttp.HttpCoreNIOListener&quot;&amp;gt;  
   &amp;lt;parameter name=&quot;port&quot; locked=&quot;false&quot;&amp;gt;8280&amp;lt;/parameter&amp;gt;  
   &amp;lt;parameter name=&quot;non-blocking&quot; locked=&quot;false&quot;&amp;gt;true&amp;lt;/parameter&amp;gt;  
   &amp;lt;parameter name=&quot;httpGetProcessor&quot; locked=&quot;false&quot;&amp;gt;org.wso2.carbon.transport.nhttp.api.NHttpGetProcessor&amp;lt;/parameter&amp;gt;  
   &amp;lt;parameter name=&quot;disableRestServiceDispatching&quot; locked=&quot;false&quot;&amp;gt;true&amp;lt;/parameter&amp;gt;  
 &amp;lt;/transportReceiver&amp;gt;  
 &amp;lt;transportSender name=&quot;http&quot; class=&quot;org.apache.synapse.transport.nhttp.HttpCoreNIOSender&quot;&amp;gt;  
   &amp;lt;parameter name=&quot;non-blocking&quot; locked=&quot;false&quot;&amp;gt;true&amp;lt;/parameter&amp;gt;  
 &amp;lt;/transportSender&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Following two diagrams illustrate runtime processing when both service 
and operation dispatching are required and only service dispatching 
required scenarios.&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/AVvXsEh5WScf2-zRJtXhqOz-hy9-zWWhyphenhyphenbedJnqfsKv-kVZ94O1OqMZ4cunI0rdmestUrA3n6jRgKcnWd7R1SUXIIua4CJm6KCTBV2vBQEqKIwAP3VajrRzxAIRNWc0t52sWkqWYkIJp/s1600/Screenshot+from+2013-08-05+17:54:40.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;260&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5WScf2-zRJtXhqOz-hy9-zWWhyphenhyphenbedJnqfsKv-kVZ94O1OqMZ4cunI0rdmestUrA3n6jRgKcnWd7R1SUXIIua4CJm6KCTBV2vBQEqKIwAP3VajrRzxAIRNWc0t52sWkqWYkIJp/s400/Screenshot+from+2013-08-05+17:54:40.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&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/AVvXsEgmPrBaNHJdrkwSGFMFgAq9SA6YVph24xDt2GkeF6WAdUMlruBEAHAIdduEyteUp0bpstXXB4dQvxqlsX583I6Pur_o1vqN8Ppj3E_DZoZ8_4dWxkxVDTTD6h7mSM-CeR6gQmA2/s1600/Screenshot+from+2013-08-05+17:54:29.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;255&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmPrBaNHJdrkwSGFMFgAq9SA6YVph24xDt2GkeF6WAdUMlruBEAHAIdduEyteUp0bpstXXB4dQvxqlsX583I6Pur_o1vqN8Ppj3E_DZoZ8_4dWxkxVDTTD6h7mSM-CeR6gQmA2/s400/Screenshot+from+2013-08-05+17:54:29.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;For ESB 4.8.0 or any future versions &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Now let me discuss the improvements we have done in ESB 4.8.0.&amp;nbsp; 
Starting from this version users have the control&amp;nbsp; to specify whether 
the proxy service should expect operation dispatching or not, in 
situation like use case -1 now users can disable operation level 
dispatching and still possible to use high-speed pass-through 
transport.&amp;nbsp; There is a new parameter introduced called 
&quot;disableOperationValidation&quot;&amp;nbsp; to control operation dispatching on proxy 
service, please refer the following sample.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;proxy name=&quot;JAXWSServiceProxy&quot;&amp;gt;   
   &amp;lt;target&amp;gt;   
   &amp;lt;outSequence&amp;gt;   
    &amp;lt;send/&amp;gt;   
   &amp;lt;/outSequence&amp;gt;   
   &amp;lt;endpoint&amp;gt;   
    &amp;lt;address uri=&quot;XXXXX&quot;/&amp;gt;   
   &amp;lt;/endpoint&amp;gt;   
   &amp;lt;/target&amp;gt;   
   &amp;lt;publishWSDL uri=&quot;XXXX&quot;&amp;gt;   
&lt;b&gt;   &amp;lt;parameter name=&quot;disableOperationValidation&quot; locked=&quot;false&quot;&amp;gt;true&amp;lt;/parameter&amp;gt;   &lt;/b&gt;
  &amp;lt;/proxy&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Now let&#39;s discuss another use case,&amp;nbsp; this one is identical to use case 1
 but now we need to throttle only one operation in other words now we 
need to perform operation level dispatching .&amp;nbsp; It&#39;s clear in this case 
we need to build the message to find correct operation so the one 
solution would be to move back to NHTTP transport but with 4.8.0 release
 there is another solution introduced to build messages only if 
necessary, there is a new dispatcher introduced called 
SynapseSOAPMessageBodyBasedDispatcher which can build messages if it&#39;s 
required. Using following steps you can enable 
SynapseSOAPMessageBodyBasedDispatcher to the ESB configuration.&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
1. Open a axis2.xml file &lt;br /&gt;
&lt;br /&gt;
2. Locate the following entry.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;       &amp;lt;handler class=&quot;org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher&quot; name=&quot;SOAPMessageBodyBasedDispatcher&quot;/&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Replace it using&amp;nbsp; SynapseSOAPMessageBodyBasedDispatcher as follows. &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;       &amp;lt;handler class=&quot;&lt;b&gt;org.apache.synapse.core.axis2.SynapseSOAPMessageBodyBasedDispatcher&lt;/b&gt;&quot; name=&quot;SOAPMessageBodyBasedDispatcher&quot;/&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/8334426780490465770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/8334426780490465770?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/8334426780490465770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/8334426780490465770'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2013/08/wso2-esb-proxy-services-for-jax-ws.html' title=' WSO2 ESB proxy services for JAX-WS backends '/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07344103594883335708</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/AVvXsEh5WScf2-zRJtXhqOz-hy9-zWWhyphenhyphenbedJnqfsKv-kVZ94O1OqMZ4cunI0rdmestUrA3n6jRgKcnWd7R1SUXIIua4CJm6KCTBV2vBQEqKIwAP3VajrRzxAIRNWc0t52sWkqWYkIJp/s72-c/Screenshot+from+2013-08-05+17:54:40.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-38912680628248970</id><published>2013-08-02T15:05:00.004+05:30</published><updated>2013-08-02T15:16:24.120+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="OAuth 2.0"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2 APIM"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2 IS"/><title type='text'>Test all four OAuth2 grant types on WSO2 IS , WSO2 API Manager </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This topic is not something new as WSO2 IS supported for both OAuth 1.0 
and OAuth 2.0 specifications for sometime , instead I&#39;m writing this 
post to introduce one of&amp;nbsp; OAuth2 sample application. In fact I developed
 this sample to understand&amp;nbsp; OAuth 2.0 specification myself and thought&amp;nbsp; 
to share it publicly so that someone else can used it to understand 
OAuth2 support on WSO2 platform. You can use this sample to test 
following four grant types on WSO2 IS or WSO2 APIM. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Athorization Code&lt;/li&gt;
&lt;li&gt;Implicit&lt;/li&gt;
&lt;li&gt;Resource Owner&lt;/li&gt;
&lt;li&gt;Client Credentials&lt;/li&gt;
&lt;/ol&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/AVvXsEj9ZH_s5hXQ3DGHdPz1XZ8j_hVR8YqeJYBOIkmGNLMjZXNlI9zG7ejbwgRICZa4DsDjZ35KgRc9Sy7uTEnatkFSGm-3Anx45pL4m73Sxve8p993ato75tp6tpcHarkPGIsK3Tct/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;165&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9ZH_s5hXQ3DGHdPz1XZ8j_hVR8YqeJYBOIkmGNLMjZXNlI9zG7ejbwgRICZa4DsDjZ35KgRc9Sy7uTEnatkFSGm-3Anx45pL4m73Sxve8p993ato75tp6tpcHarkPGIsK3Tct/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
You can find all source codes for this sample from here &lt;a href=&quot;https://github.com/sagaragu/OAuthWebapp&quot;&gt;https://github.com/sagaragu/OAuthWebapp&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In
 first step you need to register a OAuth2 application either on WSO2 IS 
or WSO2 APIM, this step is very straightforward but if your not much 
clear you can follow this &lt;a href=&quot;http://blog.facilelogin.com/2012/08/wso2-oauth-20-playground-with-wso2.html&quot; target=&quot;_blank&quot;&gt;blog post&lt;/a&gt; by Prabath. Additionally &lt;a href=&quot;http://blog.facilelogin.com/2012/08/wso2-oauth-20-playground-with-wso2.html&quot; target=&quot;_blank&quot;&gt;same blog post&lt;/a&gt; introduce and explain another useful OAuth2 sample called &quot;OAuth2 
Playground2 &quot; which you also can try, in fact before develop my sample I
 also use Playground2 sample to understand OAuth2 basics. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once
 you register a OAuth2 application you can deploy the sample web app on 
any application server such as WSO2 AS or you could easily use embedded 
Maven Jetty plug in. Once you start the application server you can see 
following page and&amp;nbsp; it&#39;s straightforward to test each grant type by 
clicking URL on index page. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Steps required to test &quot;Athorization Code&quot; are given below. &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 class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6eDcM83A-z44GKwVi8r6DpfFY5ccidF5oQKGWA6CKmmqb-ukuPA0moMWPJ5jJsKvJrDZlw2dDt6Nv97wSXmhyKgsAoXmGF1lW-ggvG4FRjwbMKuzn_T-e5T0f2X7AFKlgShAa/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;221&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6eDcM83A-z44GKwVi8r6DpfFY5ccidF5oQKGWA6CKmmqb-ukuPA0moMWPJ5jJsKvJrDZlw2dDt6Nv97wSXmhyKgsAoXmGF1lW-ggvG4FRjwbMKuzn_T-e5T0f2X7AFKlgShAa/s400/2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&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;
&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/AVvXsEh9D8F-G2nPL6YmY0a7esGyrjrZ998pivAi3YJd0mroitQfUsT1foe4ikF2Iu0RNGQYHLeHMQ0qgbCWG6-h0rufKRn3cu_R0_sm_y9rGMH21NJbqgnfHzTQ_2Q9M8Xgkkw1XiY_/s1600/3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;245&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9D8F-G2nPL6YmY0a7esGyrjrZ998pivAi3YJd0mroitQfUsT1foe4ikF2Iu0RNGQYHLeHMQ0qgbCWG6-h0rufKRn3cu_R0_sm_y9rGMH21NJbqgnfHzTQ_2Q9M8Xgkkw1XiY_/s400/3.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&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;
&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/AVvXsEgnOe8X4fcOWc9yuGhanngBZgaeu5EqTgrAuRm8aM_XR4XVJWZIxduE_gNVkJWXrV7qFOGf0gZWEoHTjNwIlfqGMfEc78qDp1M75Ee3NOy1yJldMI6E_QS2EMguMsd3QyhZcy5O/s1600/4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;265&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnOe8X4fcOWc9yuGhanngBZgaeu5EqTgrAuRm8aM_XR4XVJWZIxduE_gNVkJWXrV7qFOGf0gZWEoHTjNwIlfqGMfEc78qDp1M75Ee3NOy1yJldMI6E_QS2EMguMsd3QyhZcy5O/s400/4.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&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/AVvXsEipS7qcndp_pEU_C5VHuSO_zHFBiExcWgbf_Ma_Y3RVN6_Vf78bJrHp1_838i8vySBd4XCrqDvYmvvnrpQzL621puoMOnM7pdw58ywzH0mPh1tWQ5hZdzoOOycbV6dAWM9VsygU/s1600/5.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;187&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipS7qcndp_pEU_C5VHuSO_zHFBiExcWgbf_Ma_Y3RVN6_Vf78bJrHp1_838i8vySBd4XCrqDvYmvvnrpQzL621puoMOnM7pdw58ywzH0mPh1tWQ5hZdzoOOycbV6dAWM9VsygU/s400/5.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&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&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/38912680628248970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/38912680628248970?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/38912680628248970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/38912680628248970'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2013/08/test-all-four-oauth2-grant-types-on.html' title='Test all four OAuth2 grant types on WSO2 IS , WSO2 API Manager '/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07344103594883335708</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/AVvXsEj9ZH_s5hXQ3DGHdPz1XZ8j_hVR8YqeJYBOIkmGNLMjZXNlI9zG7ejbwgRICZa4DsDjZ35KgRc9Sy7uTEnatkFSGm-3Anx45pL4m73Sxve8p993ato75tp6tpcHarkPGIsK3Tct/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-1515090667382118932</id><published>2013-07-31T20:13:00.000+05:30</published><updated>2013-07-31T23:27:36.613+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="Synapse"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2 APIM"/><category scheme="http://www.blogger.com/atom/ns#" term="WSO2 ESB"/><title type='text'>WSO2 ESB : Set  WS-Security UT user names dynamically </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;br /&gt;
Proxy services deployed on WSO2 ESB can be used to cater various 
security requirements, among them following two patterns are very 
common.&lt;br /&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/AVvXsEg-vagePw8s_YbL2soc8uFHpPw1rbBC0DEp0zbET8HQjonWe668e_27CITfidS9MNJRlRS4ZNNH4d9RUFX1VVLk2arNGRvXWVx4N_LQeUlsp9wecojxxoMRHvtyf2_b5Bt8eO_n/s1600/a.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;nbsp; (1) Expose an insecure&amp;nbsp; backend service as a secured service using proxy services.&amp;nbsp; &lt;/b&gt;&lt;/h3&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/AVvXsEg-vagePw8s_YbL2soc8uFHpPw1rbBC0DEp0zbET8HQjonWe668e_27CITfidS9MNJRlRS4ZNNH4d9RUFX1VVLk2arNGRvXWVx4N_LQeUlsp9wecojxxoMRHvtyf2_b5Bt8eO_n/s1600/a.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;183&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-vagePw8s_YbL2soc8uFHpPw1rbBC0DEp0zbET8HQjonWe668e_27CITfidS9MNJRlRS4ZNNH4d9RUFX1VVLk2arNGRvXWVx4N_LQeUlsp9wecojxxoMRHvtyf2_b5Bt8eO_n/s400/a.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
This can be done very easily by pointing to a WS - Security Policy file 
within the proxy configuration. In following example UTOverTransport.xml
 file specify the expected security configuration.&amp;nbsp; ESB admin console provides a guided wizard for this use case. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;proxy name=&quot;SampleProxy&quot;&amp;gt;  
   &amp;lt;target&amp;gt;  
    &amp;lt;outSequence&amp;gt;  
      &amp;lt;send/&amp;gt;  
    &amp;lt;/outSequence&amp;gt;  
    &amp;lt;endpoint&amp;gt;  
      &amp;lt;address uri=&quot;http://www.w3schools.com/webservices/tempconvert.asmx&quot;/&amp;gt;  
    &amp;lt;/endpoint&amp;gt;  
   &amp;lt;/target&amp;gt;  
   &amp;lt;enableSec/&amp;gt;  
   &amp;lt;policy key=&quot;conf:/repository/axis2/service-groups/SampleProxy/services/SampleProxy/policies/UTOverTransport&quot;/&amp;gt;  
 &amp;lt;/proxy&amp;gt;   
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;(2)&amp;nbsp; Expose secured backend service as a insecure service so that security tokens set by the ESB.&lt;/b&gt;&lt;/h3&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/AVvXsEjOunmjYyHUgiYhso-pwiGz4D9XeKO8CzDztKabep-NXtYQ8hruFbH00kkwvDzNKISH9MN4rcXfwKbz0Y4e0yrMMFNCQd7iZhsvhoU1qnRnlT2a11zDewF_sp49VhvBPhmZHxsL/s1600/d.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;177&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOunmjYyHUgiYhso-pwiGz4D9XeKO8CzDztKabep-NXtYQ8hruFbH00kkwvDzNKISH9MN4rcXfwKbz0Y4e0yrMMFNCQd7iZhsvhoU1qnRnlT2a11zDewF_sp49VhvBPhmZHxsL/s400/d.png&quot; width=&quot;400&quot; /&gt;&lt;/a&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/AVvXsEjwaAS9KMR0iTrn_zxChWbUSABSyYGDQex2YSzPk5CZIIOXMvq8ld3mNQ6cvYf_G_rUEVbd6sYM9H75NixX5MfaZncNQ8GElN7PZ4Ru05j13u0rla44vndpYeg-OdPRw4b6f6dN/s1600/b.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&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/AVvXsEi3kvSmAZWJz_hgGRa44HllU23wZ6eB6jRrgTPyKMTHTi0gVKvE4bTNi_Eds4L8wmtxygc8cxxORli6hkW9LhswxVk_urgns5Xdj2FuPtdd9txLnZ6rBi56KGYIJqv_SKg5MEt0/s1600/b.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
This also can be implemented easily by pointing to a WS - Security 
Policy file as a QoS option at the proxy Endpoint so that ESB add 
required security tokens to the out-going message. I have given such example
 with a policy file below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;proxy name=&quot;HelloProxy&quot;&amp;gt;  
   &amp;lt;target&amp;gt;  
    &amp;lt;outSequence&amp;gt;  
      &amp;lt;send/&amp;gt;      
    &amp;lt;/outSequence&amp;gt;  
    &amp;lt;endpoint&amp;gt;  
      &amp;lt;address uri=&quot;https://localhost:9445/services/HelloService&quot;&amp;gt;  
       &amp;lt;enableSec policy=&quot;gov:/policy/UT-Policy.xml&quot;/&amp;gt;  
      &amp;lt;/address&amp;gt;  
    &amp;lt;/endpoint&amp;gt;  
   &amp;lt;/target&amp;gt;  
 &amp;lt;/proxy&amp;gt;    
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
In above proxy configuration security polices is defined in the UT-Policy.xml which is stored in embedded&amp;nbsp; Registry.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;wsp:Policy xmlns:wsp=&quot;http://schemas.xmlsoap.org/ws/2004/09/policy&quot; xmlns:wsu=&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd&quot; wsu:Id=&quot;UTOverTransport&quot;&amp;gt;  
     &amp;lt;wsp:ExactlyOne&amp;gt;  
       &amp;lt;wsp:All&amp;gt;  
         &amp;lt;sp:TransportBinding xmlns:sp=&quot;http://schemas.xmlsoap.org/ws/2005/07/securitypolicy&quot;&amp;gt;  
           &amp;lt;wsp:Policy&amp;gt;  
             &amp;lt;sp:TransportToken&amp;gt;  
               &amp;lt;wsp:Policy&amp;gt;  
                 &amp;lt;sp:HttpsToken RequireClientCertificate=&quot;false&quot;/&amp;gt;  
               &amp;lt;/wsp:Policy&amp;gt;  
             &amp;lt;/sp:TransportToken&amp;gt;  
             &amp;lt;sp:AlgorithmSuite&amp;gt;  
               &amp;lt;wsp:Policy&amp;gt;  
                 &amp;lt;sp:Basic256/&amp;gt;  
               &amp;lt;/wsp:Policy&amp;gt;  
             &amp;lt;/sp:AlgorithmSuite&amp;gt;  
             &amp;lt;sp:Layout&amp;gt;  
               &amp;lt;wsp:Policy&amp;gt;  
                 &amp;lt;sp:Lax/&amp;gt;  
               &amp;lt;/wsp:Policy&amp;gt;  
             &amp;lt;/sp:Layout&amp;gt;  
             &amp;lt;sp:IncludeTimestamp/&amp;gt;  
           &amp;lt;/wsp:Policy&amp;gt;  
         &amp;lt;/sp:TransportBinding&amp;gt;  
         &amp;lt;sp:SignedSupportingTokens xmlns:sp=&quot;http://schemas.xmlsoap.org/ws/2005/07/securitypolicy&quot;&amp;gt;  
           &amp;lt;wsp:Policy&amp;gt;  
             &amp;lt;sp:UsernameToken sp:IncludeToken=&quot;http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient&quot;/&amp;gt;  
           &amp;lt;/wsp:Policy&amp;gt;  
         &amp;lt;/sp:SignedSupportingTokens&amp;gt;  
         &amp;lt;ramp:RampartConfig xmlns:ramp=&quot;http://ws.apache.org/rampart/policy&quot;&amp;gt;  
          &amp;lt;ramp:user&amp;gt;sagara&amp;lt;/ramp:user&amp;gt;  
          &amp;lt;ramp:passwordCallbackClass&amp;gt;org.wso2.security.sample.PWCBHandler&amp;lt;/ramp:passwordCallbackClass&amp;gt;  
         &amp;lt;/ramp:RampartConfig&amp;gt;  
       &amp;lt;/wsp:All&amp;gt;  
     &amp;lt;/wsp:ExactlyOne&amp;gt;  
   &amp;lt;/wsp:Policy&amp;gt;  
&lt;/code&gt;&lt;/pre&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/AVvXsEh0gApGFOSwmgqcUh6Ep2i-LRMnEt2T17FOVVu0tGnOZX9pnwDXmUKnAlKz1CIs3uBEXDj8w-eeRuZUE3SoRX52lZCp34XnDDJ87EdrWhGb2UgiWkp3uW1vJMtRvdsTEn-cnsaw/s1600/c.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&amp;nbsp;If you look at above policy file carefully you can observe the user 
name&amp;nbsp; is hard coded as &amp;lt;ramp:user&amp;gt; and we have defined another entry 
called&amp;nbsp;&amp;nbsp; &amp;lt;ramp:passwordCallbackClass&amp;gt;, during the runtime above 
user name set as the user name of UT token while PWCBHandler set the UT 
password related to given user name. Developers can access the user name
 within the PWCBHandler class and can look-up password from any 
convenient method such loading password from a encrypted property file or 
using database call etc. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One limitation of above approach is there is no way to set 
user name dynamically it has to be hard coded within&amp;nbsp; &amp;lt;ramp:user&amp;gt; 
element. But there are number of use cases where it&#39;s required to set&amp;nbsp; 
different user names dynamically with each message dispatching&amp;nbsp; to the 
proxy service. One such use case within the WSO2 platform is OAuth2 to WS-Secuty 
security switching using WSO2 API Manger and WSO2 ESB. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
AS an example assume we have a backend service which expect 
WS-Security UT with in-coming messages, now let&#39;s say we have created a API in WSO2 API
 Manger for above backend service. The challenge with this use case is 
API is secured with OAuth2 Access Token but we need to extract user name
 and have&amp;nbsp; to set it as UT tokens before forward messages to the backend.&amp;nbsp; One
 possible solution for this case is given 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/AVvXsEghecWnOvzjgih1u0PWBx3kA63qyUYrHc1SdFGDUzLiwhlP9hUcHKakv3xdmPGmSAmBFb2uHB7KENUewFBUSxgltSCjRIKCYzq7K-XdeuxNe1gJkYMrLSfuzWUkhK329dWLGLtP/s1600/c.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;250&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghecWnOvzjgih1u0PWBx3kA63qyUYrHc1SdFGDUzLiwhlP9hUcHKakv3xdmPGmSAmBFb2uHB7KENUewFBUSxgltSCjRIKCYzq7K-XdeuxNe1gJkYMrLSfuzWUkhK329dWLGLtP/s640/c.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;User invoke the API by providing a OAuth2 access tokens.&lt;/li&gt;
&lt;li&gt;After successful authentication forward messages to the ESB along with 
JWT token where JWT token contains authenticated user name.&lt;/li&gt;
&lt;li&gt;In ESB proxy service process the JWT token and add user name dynamically to UT token &lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
Here
 the real challenge is how we could dynamically specify user name ?&amp;nbsp; for
 this we could use another extension point called 
&quot;RampartConfigCallbackHandler&quot;&lt;wbr&gt;&lt;/wbr&gt;&amp;nbsp; together with a Axis2 Handler.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Step -1 &lt;/b&gt;&lt;/h3&gt;
&lt;br /&gt;
Process JWT token from incoming message and set it as a 
property on current MessageContext. For demonstration I created a sample 
Handler called ExtractUserNameHandler as follows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; public class ExtractUserNameHandler extends AbstractHandler {  
   public InvocationResponse invoke(MessageContext messageContext)  
       throws AxisFault {  
     String userName = null;  
     Map&amp;lt;String, String&amp;gt; headerMap = (Map&amp;lt;String, String&amp;gt;) messageContext  
         .getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);  
     if(headerMap != null){    
     if (headerMap.containsKey(&quot;X-JWT-Assertion&quot;)) {  
       userName = getUserNameFromJWT(headerMap.get(&quot;X-JWT-Assertion&quot;));  
     }  
     if(userName != null){  
       addToMessageContext(messageContext, userName);        
     }  
     }  
     return InvocationResponse.CONTINUE;  
   }&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;&amp;nbsp;protected void addToMessageContext(MessageContext messageContext, String userName) {  
     Map&amp;lt;String, String&amp;gt; rampConfigCBProperties = new Hashtable&amp;lt;String, String&amp;gt;();  
     rampConfigCBProperties.put(&quot;user_name&quot;, userName);  
     messageContext.setProperty(&quot;rampartConfigCallbackProperties&quot;,  
         rampConfigCBProperties);  
   }&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;&amp;nbsp;protected String getUserNameFromJWT(String jwtToken) {  
     String[] tokenParts = jwtToken.split(&quot;\\.&quot;);  
     String user = null;  
     if (tokenParts != null &amp;amp;&amp;amp; tokenParts.length == 3) {  
       byte[] jsonClaims = Base64.decode(tokenParts[1]);  
       JsonParser parser = new JsonParser();  
       JsonElement element = parser  
           .parse(new JsonReader(new InputStreamReader(  
               new ByteArrayInputStream(jsonClaims))));  
       user = element.getAsJsonObject()  
           .get(&quot;http://wso2.org/claims/enduser&quot;).getAsString();  
       System.out.println(&quot;user name : &quot; + user);  
       return user;  
     }  
     return null;  
   }  
 }    
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Step -2 &lt;/b&gt;&lt;/h3&gt;
&lt;br /&gt;
Now we can implement RampartConfigCallbackHandler 
interface and possible to read the value from MessageContext so that we 
can dynamically add the user name to the security configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; public class RampartConfigCallbackHandlerImpl implements  
     RampartConfigCallbackHandler {&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;public void update(RampartConfig config) {  
     Map&amp;lt;String, String&amp;gt; propertyMap = config.getPropertyMap();  
     if (propertyMap != null &amp;amp;&amp;amp; propertyMap.containsKey(&quot;user_name&quot;)) {  
       System.out.println(&quot; adding user name : &quot;+ propertyMap.get(&quot;user_name&quot;));  
       config.setUser(propertyMap.get(&quot;user_name&quot;));  
     }  
     config.setPwCbClass(&quot;sample.PWCBHandler&quot;);  
   }  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Step -3 &lt;/b&gt;&lt;/h3&gt;
&lt;br /&gt;
Still we need&amp;nbsp; to provide a WS-Policy file which specify the above created RampartConfigCallbackHandlerIm&lt;wbr&gt;&lt;/wbr&gt;pl class.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;wsp:Policy xmlns:wsp=&quot;http://schemas.xmlsoap.org/ws/2004/09/policy&quot;  
   xmlns:wsu=&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd&quot;  
   wsu:Id=&quot;UTOverTransport&quot;&amp;gt;  
   &amp;lt;wsp:ExactlyOne&amp;gt;  
     &amp;lt;wsp:All&amp;gt;  
       &amp;lt;sp:TransportBinding  
         xmlns:sp=&quot;http://schemas.xmlsoap.org/ws/2005/07/securitypolicy&quot;&amp;gt;  
         &amp;lt;wsp:Policy&amp;gt;  
           &amp;lt;sp:TransportToken&amp;gt;  
             &amp;lt;wsp:Policy&amp;gt;  
               &amp;lt;sp:HttpsToken RequireClientCertificate=&quot;false&quot; /&amp;gt;  
             &amp;lt;/wsp:Policy&amp;gt;  
           &amp;lt;/sp:TransportToken&amp;gt;  
           &amp;lt;sp:AlgorithmSuite&amp;gt;  
             &amp;lt;wsp:Policy&amp;gt;  
               &amp;lt;sp:Basic256 /&amp;gt;  
             &amp;lt;/wsp:Policy&amp;gt;  
           &amp;lt;/sp:AlgorithmSuite&amp;gt;  
           &amp;lt;sp:Layout&amp;gt;  
             &amp;lt;wsp:Policy&amp;gt;  
               &amp;lt;sp:Lax /&amp;gt;  
             &amp;lt;/wsp:Policy&amp;gt;  
           &amp;lt;/sp:Layout&amp;gt;  
           &amp;lt;sp:IncludeTimestamp /&amp;gt;  
         &amp;lt;/wsp:Policy&amp;gt;  
       &amp;lt;/sp:TransportBinding&amp;gt;  
       &amp;lt;sp:SignedSupportingTokens  
         xmlns:sp=&quot;http://schemas.xmlsoap.org/ws/2005/07/securitypolicy&quot;&amp;gt;  
         &amp;lt;wsp:Policy&amp;gt;  
           &amp;lt;sp:UsernameToken  
             sp:IncludeToken=&quot;http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient&quot;&amp;gt;              
           &amp;lt;/sp:UsernameToken&amp;gt;  
         &amp;lt;/wsp:Policy&amp;gt;  
       &amp;lt;/sp:SignedSupportingTokens&amp;gt;  
       &amp;lt;ramp:RampartConfig xmlns:ramp=&quot;http://ws.apache.org/rampart/policy&quot;&amp;gt;  
         &amp;lt;ramp:rampartConfigCallbackClass&amp;gt;sample.RampartConfigCallbackHandlerImpl  
         &amp;lt;/ramp:rampartConfigCallbackClass&amp;gt;  
       &amp;lt;/ramp:RampartConfig&amp;gt;  
     &amp;lt;/wsp:All&amp;gt;  
   &amp;lt;/wsp:ExactlyOne&amp;gt;  
 &amp;lt;/wsp:Policy&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/1515090667382118932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/1515090667382118932?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1515090667382118932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1515090667382118932'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2013/07/wso2-esb-set-ws-security-ut-user-names.html' title='WSO2 ESB : Set  WS-Security UT user names dynamically '/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07344103594883335708</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/AVvXsEg-vagePw8s_YbL2soc8uFHpPw1rbBC0DEp0zbET8HQjonWe668e_27CITfidS9MNJRlRS4ZNNH4d9RUFX1VVLk2arNGRvXWVx4N_LQeUlsp9wecojxxoMRHvtyf2_b5Bt8eO_n/s72-c/a.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-4430207979002060659</id><published>2013-01-25T21:56:00.000+05:30</published><updated>2013-01-25T21:56:07.907+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Jetty"/><category scheme="http://www.blogger.com/atom/ns#" term="Maven2"/><title type='text'>Setting HTTP basic security in Maven Jetty plug-in </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Recently I had to test HTTP basic security for one of my web application
 project, just to save my time I didn&#39;t want to use any standalone 
server during development instead I tried to configure Maven Jetty 
plug-in to support HTTP basic security. Here I have given the procedure 
which I followed.&lt;br /&gt;
&lt;br /&gt;
1.) &lt;b&gt;Configure Maven Jetty plugin in project pom.xml file.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
It&#39;s required to add a UserRealm under plug-in configuration section. 
Jetty provides number of in-built UserRealms, here I used &lt;a href=&quot;http://jetty.codehaus.org/jetty/jetty-6/apidocs/org/mortbay/jetty/security/HashUserRealm.html&quot; target=&quot;_blank&quot;&gt;HashUserRealm&lt;/a&gt; 
for simplicity which use in-memory HashMaps to store users and roles.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;plugin&amp;gt;  
                     &amp;lt;groupId&amp;gt;org.mortbay.jetty&amp;lt;/groupId&amp;gt;  
                     &amp;lt;artifactId&amp;gt;maven-jetty-plugin&amp;lt;/artifactId&amp;gt;  
                     &amp;lt;configuration&amp;gt;  
                          &amp;lt;scanIntervalSeconds&amp;gt;3&amp;lt;/scanIntervalSeconds&amp;gt;  
                          &amp;lt;webAppConfig&amp;gt;  
                               &amp;lt;contextPath&amp;gt;/&amp;lt;/contextPath&amp;gt;  
                          &amp;lt;/webAppConfig&amp;gt;  
                          &amp;lt;userRealms&amp;gt;  
                               &amp;lt;userRealm implementation=&quot;org.mortbay.jetty.security.HashUserRealm&quot;&amp;gt;  
                                    &amp;lt;name&amp;gt;basic security&amp;lt;/name&amp;gt;  
                                    &amp;lt;config&amp;gt;jetty-users.properties&amp;lt;/config&amp;gt;  
                               &amp;lt;/userRealm&amp;gt;  
                          &amp;lt;/userRealms&amp;gt;  
                     &amp;lt;/configuration&amp;gt;  
                &amp;lt;/plugin&amp;gt;  
           &amp;lt;/plugins&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then add a property file called jetty-users.properties which contains user names, passwords and user roles.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; sagara=sagara,ADMIN  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2.) &lt;b&gt;Configure web.xml file of the web application.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In this example we allow users with ADMIN role to access any URL within the application.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;security-constraint&amp;gt;  
           &amp;lt;display-name&amp;gt;authorizedUsers&amp;lt;/display-name&amp;gt;  
           &amp;lt;web-resource-collection&amp;gt;  
                &amp;lt;web-resource-name&amp;gt;ALL URLs&amp;lt;/web-resource-name&amp;gt;  
                &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;  
           &amp;lt;/web-resource-collection&amp;gt;  
           &amp;lt;auth-constraint&amp;gt;  
                &amp;lt;role-name&amp;gt;ADMIN&amp;lt;/role-name&amp;gt;  
           &amp;lt;/auth-constraint&amp;gt;  
      &amp;lt;/security-constraint&amp;gt;  
      &amp;lt;login-config&amp;gt;  
           &amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;  
           &amp;lt;realm-name&amp;gt;basic security&amp;lt;/realm-name&amp;gt;  
      &amp;lt;/login-config&amp;gt;  
      &amp;lt;security-role&amp;gt;  
           &amp;lt;description&amp;gt;administrator access&amp;lt;/description&amp;gt;  
           &amp;lt;role-name&amp;gt;ADMIN&amp;lt;/role-name&amp;gt;  
      &amp;lt;/security-role&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/4430207979002060659/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/4430207979002060659?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/4430207979002060659'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/4430207979002060659'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2013/01/setting-http-basic-security-in-maven.html' title='Setting HTTP basic security in Maven Jetty plug-in '/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07344103594883335708</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-33519738.post-5875379104905962723</id><published>2012-05-04T10:16:00.003+05:30</published><updated>2012-05-04T10:17:41.636+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="Rampart"/><category scheme="http://www.blogger.com/atom/ns#" term="Sandesh2"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><title type='text'>Release of Axis2 1.6.2 and  Sandesha2 1.6.2 , Rampart 1.6.2</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
The Apache Axis2 team is pleased to announce the general availability of the following releases:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Axis2 1.6.2&lt;/li&gt;
&lt;li&gt;Sandesha2 1.6.2&lt;/li&gt;
&lt;li&gt;Rampart 1.6.2&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
Apache
 Axis2 is a complete re-design and re-write of the widely used Apache 
Axis engine and is a more efficient, more scalable, more&lt;br /&gt;
modular and more XML-oriented Web services framework. It is carefully 
designed to support the easy addition of plug-in &quot;modules&quot; that extend&lt;br /&gt;
its functionality for features such as security and reliability.&lt;br /&gt;
&lt;br /&gt;
Apache Rampart is an Axis2 module that implements the specifications in the WS-Security stack.&lt;br /&gt;
&lt;br /&gt;
Apache Sandesha2 provides WS-ReliableMessaging support for Axis2.&lt;br /&gt;
&lt;br /&gt;
Axis2 1.6.2 is a maintenance release that contains more than 45 fixes.&lt;br /&gt;
&lt;br /&gt;
Rampart 1.6.2 is a maintenance release containing number of bug fixes and compatible with the Axis2 1.6.2 release.&lt;br /&gt;
&lt;br /&gt;
Sandesha2 1.6.2 is a maintenance release that is compatible with the Axis2 1.6.2 release.&lt;br /&gt;
&lt;br /&gt;
The new versions are available for download at the following locations:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://axis.apache.org/axis2/java/core/download.cgi&quot; target=&quot;_blank&quot;&gt;http://axis.apache.org/axis2/&lt;wbr&gt;&lt;/wbr&gt;java/core/download.cgi&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://axis.apache.org/axis2/java/rampart/download/1.6.2/download.cgi&quot; target=&quot;_blank&quot;&gt;http://axis.apache.org/axis2/&lt;wbr&gt;&lt;/wbr&gt;java/rampart/download/1.6.2/&lt;wbr&gt;&lt;/wbr&gt;download.cgi&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://axis.apache.org/axis2/java/sandesha/download.cgi&quot; target=&quot;_blank&quot;&gt;http://axis.apache.org/axis2/&lt;wbr&gt;&lt;/wbr&gt;java/sandesha/download.cgi&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
As always, we welcome any and all feedback at:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;mailto:java-dev@axis.apache.org&quot; target=&quot;_blank&quot;&gt;java-dev@axis.apache.org&lt;/a&gt; - for developer-related questions/concerns &lt;br /&gt;
&lt;a href=&quot;mailto:java-user@axis.apache.org&quot; target=&quot;_blank&quot;&gt;java-user@axis.apache.org&lt;/a&gt; - for general questions, usage, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOTE&amp;nbsp; - Axis2 1.6.2 compatible with Axis2 Transports 1.0.0 version&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/5875379104905962723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/5875379104905962723?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/5875379104905962723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/5875379104905962723'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2012/05/release-of-axis2-162-and-sandesha2-162.html' title='Release of Axis2 1.6.2 and  Sandesha2 1.6.2 , Rampart 1.6.2'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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-33519738.post-1863897368643783891</id><published>2012-05-03T18:50:00.000+05:30</published><updated>2012-05-03T18:51:11.258+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><title type='text'>Code generation and WSDL exposed over HTTPS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
In one of my&amp;nbsp;previous &lt;a href=&quot;http://ssagara.blogspot.com/2012/04/how-to-use-axis2-wsdl2java-with-proxy.html&quot; target=&quot;_blank&quot;&gt;post&lt;/a&gt;&amp;nbsp;I&amp;nbsp;explained how to use WSDL2JAVA tool &amp;nbsp;behind a proxy together with basic&amp;nbsp;authentication. Another such &amp;nbsp;useful&amp;nbsp;scenario&amp;nbsp;is code generation for a WSDL which exposed over HTTPS protocol. &amp;nbsp;In this case we have to provide key store details to the&amp;nbsp;WSDL2JAVA&amp;nbsp;tool.&amp;nbsp;Basically it&amp;nbsp;expect following two Java system&amp;nbsp;properties.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; javax.net.ssl.trustStore  
 javax.net.ssl.trustStorePassword&lt;/code&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;  &lt;/span&gt;&lt;/pre&gt;
Once you know those properties you can use WSDL2JAVA tool as follows.&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; wsdl2java.sh -uri https://localhost:8443/services/SimpleService?wsdl -Djavax.net.ssl.trustStore=path/keystorename.keystore -Djavax.net.ssl.trustStorePassword=keypassword  
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/1863897368643783891/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/1863897368643783891?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1863897368643783891'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1863897368643783891'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2012/05/code-generation-and-wsdl-exposed-over.html' title='Code generation and WSDL exposed over HTTPS'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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-33519738.post-1757613535387988652</id><published>2012-05-02T15:57:00.002+05:30</published><updated>2012-05-02T16:01:24.917+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="Maven2"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><title type='text'>How easy to test your web service over HTTPS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
I have seen many times people having issues with testing web services over HTTPS. This is not an unexpected behavior because number of improvements have been introduced from Axis2 1.5 release for HTTPS transport. With older versions it is possible to use HTTPS transport with Simple HTTPServer and some people already familiar with it too, but recent Axis2 releases no longer support for this option and it is compulsory to use Servlet transport &amp;nbsp;in order to enable HTTPS.&lt;br /&gt;
&lt;br /&gt;
Above modifications doesn&#39;t effect much on production systems because it&#39;s always recommend to use an Application server for production systems. When it come to development &amp;nbsp;stage this changes required to use a Servlet container to test HTTPS services, Apache Tomcat is one of the good choice for this.&lt;br /&gt;
&lt;br /&gt;
In this post I will discuss how to use Maven Jetty Plug-in to test Axis2 HTTPS&amp;nbsp;transport&amp;nbsp;very easily, all you need is to follow few steps that I have given below.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step -1 &amp;nbsp;Configure Axis2 for HTTPS transport.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
It is required to define AxisServletListener in your axis2.xml for HTTPS transport, in case &amp;nbsp;if you want to use both HTTP ad HTTPS it is possible to define AxisServletListener as two entries with two ports &lt;a href=&quot;http://axis.apache.org/axis2/java/core/docs/http-transport.html&quot; target=&quot;_blank&quot;&gt;this&lt;/a&gt; guide provide more details about this. If you don&#39;t have axis2.xml file copy it from binary distribution and replace existing &amp;nbsp;&quot; transportReceiver &quot; with following entries.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;  &amp;lt;transportReceiver name=&quot;http&quot;  
     class=&quot;org.apache.axis2.transport.http.AxisServletListener&quot;&amp;gt;  
     &amp;lt;parameter name=&quot;port&quot;&amp;gt;8080&amp;lt;/parameter&amp;gt;  
   &amp;lt;/transportReceiver&amp;gt;  
   &amp;lt;transportReceiver name=&quot;https&quot;  
     class=&quot;org.apache.axis2.transport.http.AxisServletListener&quot;&amp;gt;  
     &amp;lt;parameter name=&quot;port&quot;&amp;gt;8443&amp;lt;/parameter&amp;gt;  
   &amp;lt;/transportReceiver&amp;gt;   
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Step - 2 &amp;nbsp;Generate KeyStore.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Usually this is kind of a time wasting task but fortunately you can use keytool-maven-plugin to auto-generate keystore in each run. The only&amp;nbsp;required&amp;nbsp;step is add following entries into your POM file and it will save your time a lot.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;       &amp;lt;plugin&amp;gt;  
         &amp;lt;groupId&amp;gt;org.codehaus.mojo&amp;lt;/groupId&amp;gt;  
         &amp;lt;artifactId&amp;gt;keytool-maven-plugin&amp;lt;/artifactId&amp;gt;  
         &amp;lt;executions&amp;gt;  
           &amp;lt;execution&amp;gt;  
             &amp;lt;phase&amp;gt;generate-resources&amp;lt;/phase&amp;gt;  
             &amp;lt;id&amp;gt;clean&amp;lt;/id&amp;gt;  
             &amp;lt;goals&amp;gt;  
               &amp;lt;goal&amp;gt;clean&amp;lt;/goal&amp;gt;  
             &amp;lt;/goals&amp;gt;  
           &amp;lt;/execution&amp;gt;  
           &amp;lt;execution&amp;gt;  
             &amp;lt;phase&amp;gt;generate-resources&amp;lt;/phase&amp;gt;  
             &amp;lt;id&amp;gt;genkey&amp;lt;/id&amp;gt;  
             &amp;lt;goals&amp;gt;  
               &amp;lt;goal&amp;gt;genkey&amp;lt;/goal&amp;gt;  
             &amp;lt;/goals&amp;gt;  
           &amp;lt;/execution&amp;gt;  
         &amp;lt;/executions&amp;gt;  
         &amp;lt;configuration&amp;gt;  
           &amp;lt;keystore&amp;gt;${project.build.directory}/jetty-ssl.keystore&amp;lt;/keystore&amp;gt;  
           &amp;lt;dname&amp;gt;cn=localhost&amp;lt;/dname&amp;gt;  
           &amp;lt;keypass&amp;gt;axis2key&amp;lt;/keypass&amp;gt;  
           &amp;lt;storepass&amp;gt;axis2key&amp;lt;/storepass&amp;gt;  
           &amp;lt;alias&amp;gt;axis2key&amp;lt;/alias&amp;gt;  
           &amp;lt;keyalg&amp;gt;RSA&amp;lt;/keyalg&amp;gt;  
         &amp;lt;/configuration&amp;gt;  
       &amp;lt;/plugin&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Spacial Note&lt;/i&gt;&lt;/b&gt; - Above approach is not an replacement for production server configurations . It is highly recommend to follow standard procedures to configure production servers for HTTPS.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step - 3 &amp;nbsp;Configure and Run the service.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Now you need to add SSL Connectors for the Jetty configuration by adding following entries.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;  &amp;lt;plugin&amp;gt;  
         &amp;lt;groupId&amp;gt;org.mortbay.jetty&amp;lt;/groupId&amp;gt;  
         &amp;lt;artifactId&amp;gt;maven-jetty-plugin&amp;lt;/artifactId&amp;gt;  
         &amp;lt;configuration&amp;gt;  
           &amp;lt;webAppConfig&amp;gt;  
             &amp;lt;contextPath&amp;gt;/&amp;lt;/contextPath&amp;gt;  
           &amp;lt;/webAppConfig&amp;gt;  
           &amp;lt;connectors&amp;gt;  
             &amp;lt;connector  
               implementation=&quot;org.mortbay.jetty.security.SslSocketConnector&quot;&amp;gt;  
               &amp;lt;port&amp;gt;8443&amp;lt;/port&amp;gt;  
               &amp;lt;maxIdleTime&amp;gt;60000&amp;lt;/maxIdleTime&amp;gt;  
               &amp;lt;keystore&amp;gt;${project.build.directory}/jetty-ssl.keystore&amp;lt;/keystore&amp;gt;  
               &amp;lt;password&amp;gt;axis2key&amp;lt;/password&amp;gt;  
               &amp;lt;keyPassword&amp;gt;axis2key&amp;lt;/keyPassword&amp;gt;  
             &amp;lt;/connector&amp;gt;  
             &amp;lt;connector  
               implementation=&quot;org.mortbay.jetty.nio.SelectChannelConnector&quot;&amp;gt;  
               &amp;lt;port&amp;gt;8080&amp;lt;/port&amp;gt;  
               &amp;lt;maxIdleTime&amp;gt;60000&amp;lt;/maxIdleTime&amp;gt;  
             &amp;lt;/connector&amp;gt;  
           &amp;lt;/connectors&amp;gt;  
         &amp;lt;/configuration&amp;gt;  
       &amp;lt;/plugin&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Run &quot;mvn Jetty:run &quot; this will start jetty server with both HTTP and HTTPS connectors . Now you can access to the &amp;nbsp;WSDL content over HTTPS. According to above example you can fine WSDL file here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step- 04 - Configure &amp;nbsp;Client.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Since now you can access to the WSDL file you are free to use any of your client side preferences to create a WS client , you may generate stub or possible to write service/operation clients. Before you invoke your service you need to perform one more extra step, that is provide your key store details to Java run time . In simply we can use above&amp;nbsp;generated&amp;nbsp;keystore with our client too.&lt;br /&gt;
&lt;br /&gt;
Add following two lines before you invoke your client.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; System.setProperty(&quot;javax.net.ssl.trustStore&quot;,&quot;[location]/jetty-ssl.keystore&quot;);  
 System.setProperty(&quot;javax.net.ssl.trustStorePassword&quot;, &quot;axis2key&quot;);  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
You can download full source code for this sample from &lt;a href=&quot;http://svn.apache.org/viewvc/axis/axis2/java/transports/trunk/modules/samples/https-sample/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/1757613535387988652/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/1757613535387988652?isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1757613535387988652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1757613535387988652'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2012/05/how-easy-to-test-your-web-service-over.html' title='How easy to test your web service over HTTPS'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-1981144653718344478</id><published>2012-05-01T16:32:00.000+05:30</published><updated>2012-05-01T16:59:52.268+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><title type='text'>Axis2 clustering on Tomcat</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
In this post I will discuss how to setup a Axis2 cluster using two Tomcat servers. &amp;nbsp;It&#39;s not my intention to&amp;nbsp;describe Axis2 cluster&amp;nbsp;architecture or cluster configuration language, if you need such details refer provided references at the end of this post. Axis2 cluster&amp;nbsp;implementation is based on pure API which you can&amp;nbsp;implement using any Java multicast communication framework, by default Axis2 provide a cluster implemantation based on&amp;nbsp;Tomcat Cluster Communication Module also known as&lt;a href=&quot;http://tomcat.apache.org/tomcat-7.0-doc/tribes/introduction.html&quot; target=&quot;_blank&quot;&gt;&amp;nbsp;Apache Tribes&lt;/a&gt;.&amp;nbsp;Following diagram&amp;nbsp;illustrate the design we are going to discuss in this post but I skip load&amp;nbsp;balancer setup for simplicity but in real&amp;nbsp;world&amp;nbsp;scenario you could use load balancer such as Apache2 server or &lt;a href=&quot;http://wso2.org/projects/load-balancer&quot; target=&quot;_blank&quot;&gt;WSO2 Load Balancer&lt;/a&gt; that support for more advanced options. &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/AVvXsEi6S2MUDS_HRG0zR8Krsb-W1kv4kJ8A_Hs7iGxvGCgsNvF6hBetiLQB45HfTiRPWDCYIi8MqnCvz2gqH6nNcCqO0E8v7kX1BkGEySd-tTIT2Wm5IALdkSycO5uAkbYg2A8ZkX-X/s1600/cluster.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;313&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6S2MUDS_HRG0zR8Krsb-W1kv4kJ8A_Hs7iGxvGCgsNvF6hBetiLQB45HfTiRPWDCYIi8MqnCvz2gqH6nNcCqO0E8v7kX1BkGEySd-tTIT2Wm5IALdkSycO5uAkbYg2A8ZkX-X/s400/cluster.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Pre-requirements&amp;nbsp; &lt;/b&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
1. Apache Tomcat server. ( Version 7.x.x preferable. )&lt;/div&gt;
&lt;div&gt;
2. Apache Axis2 WAR distribution (Version 1.6.2 preferable.)&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;
Here I use same machine to setup two Tomcat server instances hence it&#39;s&amp;nbsp;required to change server configuration of one instance. Let&#39;s say Node-1 having default&amp;nbsp;configuration and Node-2 having custom&amp;nbsp;configuration. Open the server.xml file and change server port, port nubers of HTTP and AJP&amp;nbsp;Connectors&amp;nbsp;as follows.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Node-1 (default configuration)&lt;/div&gt;
&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;Server port=&quot;8005&quot; shutdown=&quot;SHUTDOWN&quot;&amp;gt;  
 &amp;lt;Connector port=&quot;8080&quot; protocol=&quot;HTTP/1.1&quot; connectionTimeout=&quot;20000&quot; redirectPort=&quot;8443&quot; /&amp;gt;  
 &amp;lt;Connector port=&quot;8009&quot; protocol=&quot;AJP/1.3&quot; redirectPort=&quot;8443&quot; /&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Node-2&amp;nbsp;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;Server port=&quot;9005&quot; shutdown=&quot;SHUTDOWN&quot;&amp;gt;  
 &amp;lt;Connector port=&quot;9090&quot; protocol=&quot;HTTP/1.1&quot; connectionTimeout=&quot;20000&quot; redirectPort=&quot;9443&quot; /&amp;gt;  
 &amp;lt;Connector port=&quot;9009&quot; protocol=&quot;AJP/1.3&quot; redirectPort=&quot;9443&quot; /&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now install Axis2 WAR distribution on both server instances and&amp;nbsp;stop both servers to edit axis2 configuration file. Open axis2.xml file and edit cluster settings as follows.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;Node -1&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;     &amp;lt;parameter name=&quot;AvoidInitiation&quot;&amp;gt;false&amp;lt;/parameter&amp;gt;   
     &amp;lt;parameter name=&quot;domain&quot;&amp;gt;sample.cluster.domain&amp;lt;/parameter&amp;gt;  
     &amp;lt;parameter name=&quot;mcastBindAddress&quot;&amp;gt;127.0.0.1&amp;lt;/parameter&amp;gt;  
     &amp;lt;parameter name=&quot;localMemberHost&quot;&amp;gt;127.0.0.1&amp;lt;/parameter&amp;gt;  
     &amp;lt;parameter name=&quot;localMemberPort&quot;&amp;gt;4000&amp;lt;/parameter&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp;Node -2&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;     &amp;lt;parameter name=&quot;AvoidInitiation&quot;&amp;gt;false&amp;lt;/parameter&amp;gt;   
     &amp;lt;parameter name=&quot;domain&quot;&amp;gt;sample.cluster.domain&amp;lt;/parameter&amp;gt;  
     &amp;lt;parameter name=&quot;mcastBindAddress&quot;&amp;gt;127.0.0.1&amp;lt;/parameter&amp;gt;  
     &amp;lt;parameter name=&quot;localMemberHost&quot;&amp;gt;127.0.0.1&amp;lt;/parameter&amp;gt;  
     &amp;lt;parameter name=&quot;localMemberPort&quot;&amp;gt;4001&amp;lt;/parameter&amp;gt;   
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Note that in a real network setup it&#39;s&amp;nbsp;required to edit&amp;nbsp;mcastBindAddress,&amp;nbsp;localMemberHost settings in&amp;nbsp;addition to&amp;nbsp;&amp;nbsp;localMemberPort value but in my local machine only&amp;nbsp;localMemberPort has changed. &amp;nbsp;After this has done start the Node -1, if there is no issue in your setup you could able to see log messages as follows on node-1 server console.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; [INFO] Initializing cluster...  
 [INFO] Cluster domain: sample.cluster.domain  
 [INFO] Using multicast based membership management scheme  
 Apr 30, 2012 6:37:13 PM org.apache.catalina.tribes.transport.ReceiverBase bind  
 INFO: Receiver Server Socket bound to:/127.0.0.1:4000  
 Apr 30, 2012 6:37:13 PM org.apache.catalina.tribes.membership.McastServiceImpl setupSocket  
 INFO: Setting cluster mcast soTimeout to 500  
 Apr 30, 2012 6:37:13 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers  
 INFO: Sleeping for 1000 milliseconds to establish cluster membership, start level:4  
 Apr 30, 2012 6:37:14 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers  
 INFO: Done sleeping, membership established, start level:4  
 Apr 30, 2012 6:37:14 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers  
 INFO: Sleeping for 1000 milliseconds to establish cluster membership, start level:8  
 Apr 30, 2012 6:37:15 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers  
 INFO: Done sleeping, membership established, start level:8  
 [WARN] Local member advertising its IP address as 127.0.0.1. Remote members will not be able to connect to this member.  
 [INFO] Local Member 127.0.0.1:4000(sample.cluster.domain)  
 [INFO] No members in current cluster  
 [INFO] Cluster initialization completed.  
 Apr 30, 2012 6:37:15 PM org.apache.catalina.startup.HostConfig deployDirectory  
 INFO: Deploying web application directory /home/sagara/dev/servers/axis2-clustering/tomcat/node1/webapps/ROOT  
 Apr 30, 2012 6:37:15 PM org.apache.coyote.AbstractProtocol start  
 INFO: Starting ProtocolHandler [&quot;http-bio-8080&quot;]  
 Apr 30, 2012 6:37:15 PM org.apache.coyote.AbstractProtocol start  
 INFO: Starting ProtocolHandler [&quot;ajp-bio-8009&quot;]  
 Apr 30, 2012 6:37:15 PM org.apache.catalina.startup.Catalina start  
 INFO: Server startup in 3068 ms  
&lt;/code&gt;&lt;/pre&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;
Now start the Node -2 and&amp;nbsp;monitor log messages on Node-2 console&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; [INFO] Initializing cluster...  
 [INFO] Cluster domain: sample.cluster.domain  
 [INFO] Using multicast based membership management scheme  
 Apr 30, 2012 6:37:50 PM org.apache.catalina.tribes.transport.ReceiverBase bind  
 INFO: Receiver Server Socket bound to:/127.0.0.1:4001  
 Apr 30, 2012 6:37:50 PM org.apache.catalina.tribes.membership.McastServiceImpl setupSocket  
 INFO: Setting cluster mcast soTimeout to 500  
 Apr 30, 2012 6:37:50 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers  
 INFO: Sleeping for 1000 milliseconds to establish cluster membership, start level:4  
 [INFO] New member 127.0.0.1:4000(sample.cluster.domain ) joined cluster.  
 Apr 30, 2012 6:37:51 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers  
 INFO: Done sleeping, membership established, start level:4  
 Apr 30, 2012 6:37:51 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers  
 INFO: Sleeping for 1000 milliseconds to establish cluster membership, start level:8  
 Apr 30, 2012 6:37:51 PM org.apache.catalina.tribes.io.BufferPool getBufferPool  
 INFO: Created a buffer pool with max size:104857600 bytes of type:org.apache.catalina.tribes.io.BufferPool15Impl  
 Apr 30, 2012 6:37:52 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers  
 INFO: Done sleeping, membership established, start level:8  
 [WARN] Local member advertising its IP address as 127.0.0.1. Remote members will not be able to connect to this member.  
 [INFO] Local Member 127.0.0.1:4001(sample.cluster.domain )  
 [INFO] Members of current cluster  
 [INFO] Member1 127.0.0.1:4000(sample.cluster.domain )  
 [INFO] Trying to send initialization request to 127.0.0.1:4000(sample.cluster.domain )  
 [INFO] Received configuration initialization message  
 [INFO] Trying to send initialization request to 127.0.0.1:4000(sample.cluster.domain )  
 [INFO] Received state initialization message  
 [INFO] Cluster initialization completed.  
 Apr 30, 2012 6:37:52 PM org.apache.catalina.startup.HostConfig deployDirectory  
 INFO: Deploying web application directory /home/sagara/dev/servers/axis2-clustering/tomcat/node2/webapps/ROOT  
 Apr 30, 2012 6:37:52 PM org.apache.coyote.AbstractProtocol start  
 INFO: Starting ProtocolHandler [&quot;http-bio-9090&quot;]  
 Apr 30, 2012 6:37:52 PM org.apache.coyote.AbstractProtocol start  
 INFO: Starting ProtocolHandler [&quot;ajp-bio-9009&quot;]  
 Apr 30, 2012 6:37:52 PM org.apache.catalina.startup.Catalina start  
 INFO: Server startup in 13334 ms   
&lt;/code&gt;&lt;/pre&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;
Additionally now you should able to see following log messages on Node-1 server console.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; Apr 30, 2012 6:37:50 PM org.apache.catalina.tribes.io.BufferPool getBufferPool  
 INFO: Created a buffer pool with max size:104857600 bytes of type:org.apache.catalina.tribes.io.BufferPool15Impl  
 [INFO] New member 127.0.0.1:4001(sample.cluster.domain) joined cluster.  
 [INFO] Received GetConfigurationCommand initialization request message from 127.0.0.1:4001(sample.cluster.domain)  
 [INFO] Received GetStateCommand initialization request message from 127.0.0.1:4001(sample.cluster.domain&lt;/code&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;)&lt;/code&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt; &lt;/span&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you have followed me up to this point you have&amp;nbsp;successfully setup a Axis2 cluster with two nodes. Now you can deploy any cluster&amp;nbsp;aware web service on this cluster. For testing&amp;nbsp;purposes&amp;nbsp;let&#39;s write following POJO service and will deploy on both servers. I have given service code and service.xml &amp;nbsp;below.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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 sample;  
 import org.apache.axis2.context.MessageContext;  
 public class Count {  
   public int count() {  
     int count;  
     MessageContext mc = MessageContext.getCurrentMessageContext();  
     Object ob = mc.getConfigurationContext().getProperty(&quot;count&quot;);  
     if (ob == null) {  
       count = 1;  
     } else {  
       count = (Integer) ob;  
       count++;  
     }  
     mc.getConfigurationContext().setProperty(&quot;count&quot;, count);  
     return count;  
   }  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;
Note that we use &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; font-size: 12px; line-height: 20px; white-space: pre;&quot;&gt;ConfigurationContext &lt;/span&gt;to store our count values,&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; font-size: 12px; line-height: 20px; white-space: pre;&quot;&gt;ConfigurationContext is &lt;/span&gt;replicate among cluster members.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;service name=&quot;count&quot;&amp;gt;   
   &amp;lt;parameter name=&quot;ServiceClass&quot;&amp;gt;sample.Count&amp;lt;/parameter&amp;gt;  
   &amp;lt;operation name=&quot;count&quot;&amp;gt;  
   &amp;lt;messageReceiver class=&quot;org.apache.axis2.rpc.receivers.RPCMessageReceiver&quot; /&amp;gt;  
   &amp;lt;/operation&amp;gt;  
 &amp;lt;/service&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;
In order to test our cluster&amp;nbsp;aware service we need a Web service client, for the simplicity I will use a browser and Axis2 REST support. &amp;nbsp;Since we skip the load balancer setup&amp;nbsp;following two&amp;nbsp;different URLs&amp;nbsp;can be use to&amp;nbsp;invoke&amp;nbsp;services&amp;nbsp;. Once you&amp;nbsp;invokes services on both servers&amp;nbsp;you can notice that the count value is&amp;nbsp;shared among two Axis2 instances clearly.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; http://localhost:8080/axis2/services/count/count  
 http://localhost:9090/axis2/services/count/count   
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;References&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://wso2.org/library/articles/introduction-wso2-carbon-clustering&quot; target=&quot;_blank&quot;&gt;Introduction to WSO2 Carbon Clustering.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://wso2.org/library/articles/wso2-carbon-cluster-configuration-language&quot; target=&quot;_blank&quot;&gt;WSO2 Carbon Cluster Configuration Language.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.packtpub.com/article/enabling-apache-axis2-clustering&quot; target=&quot;_blank&quot;&gt;Enabling Apache Axis2 Clustering.&lt;/a&gt;&lt;/li&gt;
&lt;/ol&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;</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/1981144653718344478/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/1981144653718344478?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1981144653718344478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1981144653718344478'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2012/05/axis2-clustering-on-tomcat.html' title='Axis2 clustering on Tomcat'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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/AVvXsEi6S2MUDS_HRG0zR8Krsb-W1kv4kJ8A_Hs7iGxvGCgsNvF6hBetiLQB45HfTiRPWDCYIi8MqnCvz2gqH6nNcCqO0E8v7kX1BkGEySd-tTIT2Wm5IALdkSycO5uAkbYg2A8ZkX-X/s72-c/cluster.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-4111628168179409931</id><published>2012-04-21T19:14:00.001+05:30</published><updated>2012-04-21T21:05:30.919+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ActiveMQ"/><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="JMS"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><title type='text'>Axis2 JMS transport and ActiveMQ</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In this post I will describe how to configure &lt;a href=&quot;http://axis.apache.org/axis2/java/core/&quot; target=&quot;_blank&quot;&gt;Axis2&lt;/a&gt; JMS &lt;a href=&quot;http://axis.apache.org/axis2/java/transports/&quot; target=&quot;_blank&quot;&gt;transport&lt;/a&gt; 
properly and test web services through JMS transport. For the simplicity
 I will use Apache &lt;a href=&quot;http://activemq.apache.org/&quot; target=&quot;_blank&quot;&gt;ActiveMQ&lt;/a&gt; as the JMS server and will use &lt;a href=&quot;http://activemq.apache.org/&quot; target=&quot;_blank&quot;&gt;ActiveMQ&lt;/a&gt; 
admin console as a JMS client to send and receive messages. In my future
 posts I will describe how to use &lt;a href=&quot;http://activemq.apache.org/&quot; target=&quot;_blank&quot;&gt;ActiveMQ&lt;/a&gt; Maven plug-in with Axis2 and 
also how to test Axis2 &lt;a href=&quot;http://axis.apache.org/axis2/java/transports/&quot; target=&quot;_blank&quot;&gt;JMS transports &lt;/a&gt;with few other implementations 
such as &lt;a href=&quot;http://qpid.apache.org/&quot; target=&quot;_blank&quot;&gt;Apache QPID&lt;/a&gt; and &lt;a href=&quot;http://wso2.com/products/message-broker/&quot; target=&quot;_blank&quot;&gt;WSO2 Message Broker&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
First, If you don&#39;t
 have a ActiveMQ installation already, download the binary distribution 
from &lt;a href=&quot;http://activemq.apache.org/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; and start the ActiveMQ server. If it&#39;s started properly make 
sure you can access to admin console through the following URL, we will 
use this admin console as a JMS client.&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; http://0.0.0.0:8161/admin  
&lt;/code&gt;&lt;/pre&gt;
The next step is add requited dependencies and configure JMS transport 
in Axis2. Here I use &lt;a href=&quot;http://axis.apache.org/axis2/java/core/&quot; target=&quot;_blank&quot;&gt;Axis2&lt;/a&gt; Simple HTTP server but same steps can be used
 with any other application server too.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;(1) Add following dependencies to the &quot;lib&quot; directory of Axis2.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
1. &amp;nbsp;axis2-transport-jms-1.x.x&amp;nbsp; (axis2-transport-jms-1.7.0-SNAPSHOT.jar or axis2-transport-jms-1.7.0 )&lt;br /&gt;
2. &amp;nbsp;axis2-transport-base-1.x.x (axis2-transport-base-1.7.0-&lt;wbr&gt;&lt;/wbr&gt;SNAPSHOT.jar or axis2-transport-base- 1.7.0)&amp;nbsp;&amp;nbsp; &lt;br /&gt;
3. geronimo-j2ee-management_1.1_spec-1.0.x&amp;nbsp; (geronimo-j2ee-management_1.1_spec-1.0.1.jar)&lt;br /&gt;
4. geronimo-jms_1.1_spec-1.1.x&amp;nbsp; (geronimo-jms_1.1_spec-1.1.1.jar)&lt;br /&gt;
5. activemq-core-5.1.x (activemq-core-5.1.0.jar)&lt;br /&gt;
6. coomons-io-2.1 (coomons-io-2.1.jar)&lt;br /&gt;
&lt;br /&gt;
You can find above dependencies on Axis2 transport project &lt;a href=&quot;http://axis.apache.org/axis2/java/transports/download_index.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; or you 
can find latest development snapshots from Apache build server &lt;a href=&quot;https://builds.apache.org/view/A-F/view/Axis2/job/axis2-transports-trunk/ws/.repository/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;(2) Like in any other Axis2 transport your next task is to configure 
particular transport through the axis2.xml file by adding underline 
&lt;a href=&quot;http://axis.apache.org/axis2/java/core/api/org/apache/axis2/transport/TransportListener.html&quot; target=&quot;_blank&quot;&gt;TransportListener&lt;/a&gt;&amp;nbsp; and&amp;nbsp; &lt;a href=&quot;http://axis.apache.org/axis2/java/core/api/org/apache/axis2/transport/TransportSender.html&quot; target=&quot;_blank&quot;&gt;TransportSender&lt;/a&gt;. For the JMS transport you can 
add following settings&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;transportReceiver name=&quot;jms&quot; class=&quot;org.apache.axis2.transport.jms.JMSListener&quot;&amp;gt;  
   &amp;lt;parameter name=&quot;default&quot; locked=&quot;false&quot;&amp;gt;             
     &amp;lt;parameter name=&quot;java.naming.factory.initial&quot; locked=&quot;false&quot;&amp;gt;org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;lt;/parameter&amp;gt;  
     &amp;lt;parameter name=&quot;java.naming.provider.url&quot; locked=&quot;false&quot;&amp;gt;tcp://localhost:61616&amp;lt;/parameter&amp;gt;      
     &amp;lt;parameter name=&quot;transport.jms.ConnectionFactoryJNDIName&quot; locked=&quot;false&quot;&amp;gt;QueueConnectionFactory&amp;lt;/parameter&amp;gt;  
   &amp;lt;/parameter&amp;gt;  
 &amp;lt;/transportReceiver&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;transportSender name=&quot;jms&quot; class=&quot;org.apache.axis2.transport.jms.JMSSender&quot;&amp;gt;  
   &amp;lt;parameter name=&quot;default&quot; locked=&quot;false&quot;&amp;gt;             
     &amp;lt;parameter name=&quot;java.naming.factory.initial&quot; locked=&quot;false&quot;&amp;gt;org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;lt;/parameter&amp;gt;  
     &amp;lt;parameter name=&quot;java.naming.provider.url&quot; locked=&quot;false&quot;&amp;gt;tcp://localhost:61616&amp;lt;/parameter&amp;gt;      
     &amp;lt;parameter name=&quot;transport.jms.ConnectionFactoryJNDIName&quot; locked=&quot;false&quot;&amp;gt;QueueConnectionFactory&amp;lt;/parameter&amp;gt;  
   &amp;lt;/parameter&amp;gt;  
 &amp;lt;/transportSender&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;
Axis2 Transport &lt;a href=&quot;http://axis.apache.org/axis2/java/transports/jms.html&quot; target=&quot;_blank&quot;&gt;user guide&lt;/a&gt; provide advanced configuration details such as separate configuration for JMS Queue and Topic etc.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;(3) Start Axis2 server, If JMS transport is configured properly it is possible to see log message about JMS transport as follows.&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; [INFO] JMS Sender started  
 [INFO] JMS ConnectionFactory : default initialized  
 [INFO] JMS Transport Sender initialized...  
 ..................  
 [INFO] JMS ConnectionFactory : default initialized  
 [INFO] JMS Transport Receiver/Listener initialized...  
 [INFO] Listening on port 8080  
 [INFO] JMS listener started  
 [INFO] Task manager for service : Version [re-]initialized  
 [INFO] Started to listen on destination : Version of type Queue for service Version  
 [INFO] Task manager for service : CalculatorService [re-]initialized  
 [INFO] Started to listen on destination : CalculatorService of type Queue for service CalculatorService  
 [INFO] Task manager for service : mtomService1Axis [re-]initialized  
 [INFO] Started to listen on destination : mtomService1Axis of type Queue for service mtomService1Axis  
 [INFO] [SimpleAxisServer] Started  
 [SimpleAxisServer] Started  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Now you have configured Axis2 JMS transport properly and it&#39;s possible 
to use any JMS client to invoke web services deployed on Axis2.&amp;nbsp; Let&#39;s 
try to invoke getVersion operation on Version web service through 
ActiveMQ admin console. Again in a browser go to the ActiveMQ admin 
console through the http://0.0.0.0:8161/admin URL, now&amp;nbsp; you have to 
select &quot;Send&quot; tab to reach the send wizard.&amp;nbsp; This wizard expect 3 basic 
inputs from you as input message, JMS destination ( in this case 
destination queue) and reply-to location. By looking at Axis2 server 
startup logs you can find hint about JMS destination bind to each web 
service, you can ensure availability of this JMS destination in ActiveMQ
 console too.&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;  [INFO] Started to listen on destination : Version of type Queue for service Version  
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
For our test scenario let&#39;s use following properties.&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&amp;nbsp;Destination - Version&lt;/li&gt;
&lt;li&gt;&amp;nbsp;Reply-To &amp;nbsp;&amp;nbsp; - VersionResponse ( This destination is not available on 
ActiveMQ at this point, it will be created when the repose messages arrive to 
the JMS server)&lt;/li&gt;
&lt;li&gt;In put message - Use following message&lt;/li&gt;
&lt;li&gt;&lt;label for=&quot;JMSCorrelationID&quot;&gt;Correlation ID&lt;/label&gt;&amp;nbsp;
 - Add a random number&lt;/li&gt;
&lt;/ul&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;soap:Envelope xmlns:soap=&quot;http://www.w3.org/2003/05/soap-envelope&quot; xmlns:axis=&quot;http://axisversion.sample&quot;&amp;gt;  
   &amp;lt;soap:Header/&amp;gt;  
   &amp;lt;soap:Body&amp;gt;  
    &amp;lt;axis:getVersion/&amp;gt;  
   &amp;lt;/soap:Body&amp;gt;  
 &amp;lt;/soap:Envelope&amp;gt;  
&lt;/code&gt;&lt;/pre&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/AVvXsEgRGn1F96KAB5_J-3v8XeMX44uhT_ys6Q2bgAZNwbUWEQDw4JbNK0SmYpwXJi6Cgk-GR9lZLv7vOEypaxiVLyMcYXbjzMGPysbVjSTQNQagOinf4QljqtyetC_pUlZ23GyFzeWg/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;325&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRGn1F96KAB5_J-3v8XeMX44uhT_ys6Q2bgAZNwbUWEQDw4JbNK0SmYpwXJi6Cgk-GR9lZLv7vOEypaxiVLyMcYXbjzMGPysbVjSTQNQagOinf4QljqtyetC_pUlZ23GyFzeWg/s400/1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can see the response message by browsing &quot;VersionResponse&quot; Queue as follows.&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/AVvXsEjIWNdCDuh4OVPUye6y04MFIb2vzR7hEgdOFZ60CqxYPWGhlXk3aFrfgRiycLc-Ry3zxT89mtulyjan12S3qkQrDjuNtooyas5EFcaaYnhLRjEhi3doHxHYLDTEn0RCqxoAJZkY/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;215&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIWNdCDuh4OVPUye6y04MFIb2vzR7hEgdOFZ60CqxYPWGhlXk3aFrfgRiycLc-Ry3zxT89mtulyjan12S3qkQrDjuNtooyas5EFcaaYnhLRjEhi3doHxHYLDTEn0RCqxoAJZkY/s400/2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/4111628168179409931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/4111628168179409931?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/4111628168179409931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/4111628168179409931'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2012/04/axis2-jms-transport-and-activemq.html' title='Axis2 JMS transport and ActiveMQ'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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/AVvXsEgRGn1F96KAB5_J-3v8XeMX44uhT_ys6Q2bgAZNwbUWEQDw4JbNK0SmYpwXJi6Cgk-GR9lZLv7vOEypaxiVLyMcYXbjzMGPysbVjSTQNQagOinf4QljqtyetC_pUlZ23GyFzeWg/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-5511793584879296354</id><published>2012-04-13T18:56:00.001+05:30</published><updated>2012-04-13T19:07:05.853+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="Maven2"/><title type='text'>How to use Axis2 WSDL2JAVA with proxy authentication</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Securing WSDL using basic authentication is a common practice for number  of enterprise web service providers. Also in some business domains it&#39;s  required to secure various WSDL URLs among business partners so that  partners can access service contracts according to their business  agreements by providing a user name and a password.&amp;nbsp; As the most popular  Java web service stack lot of people keep asking to enable basic&amp;nbsp;  authentication to WSDL2JAVA tool so that they can access WSDL files  secured through basic authentication.&lt;br /&gt;
&lt;br /&gt;
Now you can use following two options to specify proxy user name and password.&lt;/div&gt;&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; -http-proxy-user [user name]      - Proxy user name for basic authentication.  
 -http-proxy-password [password]   - Proxy password for basic authentication.  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
The following examples show how to use above option in command line.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; wsdl2java.sh -http-proxy-user user-name -http-proxy-password password -uri http://localhost/axis2/services/Version?wsdl  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; wsdl2java.sh -http-proxy-user user-name -http-proxy-password password -wv 2.0 -uri http://localhost/axis2/services/Version?wsdl2   
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Also these two options supported in Wsdl2Java Maven plug-in too.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; axis2.wsdl2code.http-proxy-user  - User name for proxy server.  
 axis2.wsdl2code.http-proxy-password - Password for proxy server.   
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/5511793584879296354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/5511793584879296354?isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/5511793584879296354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/5511793584879296354'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2012/04/how-to-use-axis2-wsdl2java-with-proxy.html' title='How to use Axis2 WSDL2JAVA with proxy authentication'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-1466811699553614136</id><published>2012-03-24T21:37:00.006+05:30</published><updated>2012-03-24T21:46:31.900+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><category scheme="http://www.blogger.com/atom/ns#" term="XML"/><title type='text'>Test Axis2 JAX-WS MTOM service using SoapUI</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;In this post I have described how to write a MTOM aware JAX-WS service and how to use SoapUI to invoke this service. Consider a service called PictureService that uploads images through a web service, it uses a bean called PictureInfo that contains two fields as textual name of the image and image binary data. &lt;/div&gt;&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; @XmlRootElement  
 public class PictureInfo {  
   private String name;  
   protected DataHandler imageData;  
   public String getName() {  
     return name;  
   }  
   public void setName(String name) {  
     this.name = name;  
   }  
   @XmlMimeType(&quot;application/octet-stream&quot;)  
   public DataHandler getImageData() {  
     return imageData;  
   }  
   public void setImageData(DataHandler imageData) {  
     this.imageData = imageData;  
   }  
 }   
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
As you can see in the above code snippet getImageData() method annotated using XmlMimeType that instructs JAXB runtime to consider this particular filed as a MIME content. You can find web service interface and implementation in the following code snippet.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; @WebService(name = &quot;pictureService&quot;)  
 public interface PictureService {  
   boolean uploadPicture(PictureInfo pictureInfo);  
 }  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; @WebService(endpointInterface = &quot;org.apache.axis2.sample.pictureservice.PictureService&quot;, serviceName = &quot;pictureService&quot;)  
 public class PictureServiceImpl implements PictureService {  
   @Override  
   public boolean uploadPicture(PictureInfo pictureInfo) {  
     DataHandler dh = pictureInfo.getImageData();  
     try {  
       File F = new File(&quot;../data/&quot;+ pictureInfo.getName() + &quot;.jpg&quot;);  
       FileOutputStream fs = new FileOutputStream(F);  
       dh.writeTo(fs);  
       fs.flush();  
       fs.close();  
       return true;  
     } catch (Exception e) {  
       e.printStackTrace();  
     }  
     return false;  
   }  
 }  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After compiling above classes it&#39;s required to package them as a jar file. Usually this is a straight forward task with a build tool like Maven. For the simplicity I used Axis2 simple HTTP server that shipped with binary distribution to deploy this sample application but it is possible to use any application server together with Axis2 WAR distribution. &amp;nbsp;In case of Simple HTTP server use following steps to deploy the service properly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Create a directory called &quot;servicejars&quot; under the Axis2 repository and place above created service jar file there. Axis2 deployment engine scan this directory in order to deploy JAX-WS services.&lt;/li&gt;
&lt;li&gt;Create a directory called &quot;data&quot; as same level as &quot;bin&quot; directory, this directory used to store images uploaded by users.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Start Axis2 simple HTTP server.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;It should be possible to access generated WSDL file through &amp;nbsp;http://localhost:8080/axis2/services/pictureService?wsdl address.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Now create a SoapUI project by providing the above URL in the usual way as you create SoapUI project for any other web service. In the left side project explore window, find the automatically created &amp;nbsp;&quot;Request 1&quot; message that should be under &amp;nbsp;uploadPicture operation then open the request editor for this message. At this point you have need to perform following two tasks.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;1. &amp;nbsp;Set &quot;Enable MTOM&quot; property value to true because default value of this property is false. ( you can see message properties in a window located in left bottom side of your screen)&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/AVvXsEh7AeJrTMnC_xj9KQj6OPzbM5eWKqP5QVg-EuaMNfOwnAgAZUwBgBLL2YWhHkGNCpdBRoOD0A_peDI3A8Bik4NBMisNhCUBf3rwNscvExRWKFdoKHYuD5XYrspdqUI78IIcgUCB/s1600/Screenshot1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7AeJrTMnC_xj9KQj6OPzbM5eWKqP5QVg-EuaMNfOwnAgAZUwBgBLL2YWhHkGNCpdBRoOD0A_peDI3A8Bik4NBMisNhCUBf3rwNscvExRWKFdoKHYuD5XYrspdqUI78IIcgUCB/s400/Screenshot1.png&quot; width=&quot;277&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;2. Fill sample values and attach a image using &quot;Add an attachment&quot; menu option. Before you send this message make sure value of &quot;cid:&quot; field is match with ContentID of the attachment. I have given a screen shot of such example here. After executing above method you can see uploaded image stored within &amp;nbsp;&quot;data&quot; directory of the server.&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/AVvXsEg6_FmoQUOQGS7kdbjty2mi7qfwe8tXtEOHVOG1yWz3KuOeDPyzMO0ZBvyF34jh6oFwQ5iXVaqdcM77-BJTWFBdcP3BWchyxfjwONdV-9e7uebDx3GZ_I7aUIonAJwBvyqMzbqi/s1600/Screenshot.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;232&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6_FmoQUOQGS7kdbjty2mi7qfwe8tXtEOHVOG1yWz3KuOeDPyzMO0ZBvyF34jh6oFwQ5iXVaqdcM77-BJTWFBdcP3BWchyxfjwONdV-9e7uebDx3GZ_I7aUIonAJwBvyqMzbqi/s400/Screenshot.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/1466811699553614136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/1466811699553614136?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1466811699553614136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1466811699553614136'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2012/03/test-axis2-jax-ws-mtom-service-using.html' title='Test Axis2 JAX-WS MTOM service using SoapUI'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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/AVvXsEh7AeJrTMnC_xj9KQj6OPzbM5eWKqP5QVg-EuaMNfOwnAgAZUwBgBLL2YWhHkGNCpdBRoOD0A_peDI3A8Bik4NBMisNhCUBf3rwNscvExRWKFdoKHYuD5XYrspdqUI78IIcgUCB/s72-c/Screenshot1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-2187013247653368434</id><published>2012-02-15T07:35:00.002+05:30</published><updated>2012-02-15T07:43:30.762+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Community"/><title type='text'>Apache BarCamp Colombo 2012</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://barcamp.org/w/page/50716721/apache-lk-12&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqxWkAQG0EWoaO7_XjIfinQIwcEd0uMvB8HpiMveTdxBgWqnaZTxLRbMDgswm7WpdeMAOx_2gqyEEOt8nbrm05R1not4b_DF939juxgJ_vZQlOX244bL0DqFTvMRlEuxh_tglk/s640/Screenshot.png&quot; width=&quot;405&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/2187013247653368434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/2187013247653368434?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/2187013247653368434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/2187013247653368434'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2012/02/apache-barcamp-colombo.html' title='Apache BarCamp Colombo 2012'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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/AVvXsEjqxWkAQG0EWoaO7_XjIfinQIwcEd0uMvB8HpiMveTdxBgWqnaZTxLRbMDgswm7WpdeMAOx_2gqyEEOt8nbrm05R1not4b_DF939juxgJ_vZQlOX244bL0DqFTvMRlEuxh_tglk/s72-c/Screenshot.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-5372750300665387393</id><published>2012-02-02T13:34:00.002+05:30</published><updated>2012-02-02T13:43:32.172+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="Maven2"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><title type='text'>Axis2 archetype to create web application and Maven Jetty/Tomcat plug-ins.</title><content type='html'>Axis2 provides number of web service deployment options. Unlike some  other frameworks Axis2 can be integrate as a framework in a web  application or can be used as a container to hold number of web  services. Sometimes back Deepal wrote a nice tutorial to explain how to  use Axis2 in a web application you can read his post &lt;a href=&quot;http://www.developer.com/java/ent/article.php/10933_3777111_1&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
From Axis2&amp;nbsp; version 1.7.0 onwards we have introduced a new Maven  archetype to create Axis2 embedded web applications. Following are the  necessary step to use this archetype.&lt;br /&gt;
&lt;br /&gt;
1.) It&#39;s possible to get list of available archetypes by invoking archetype:generate goal as follows. [ refer&amp;nbsp; NOTE -1 ]&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; mvn archetype:generate  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
2.)&amp;nbsp; Select the&amp;nbsp; number corresponds&amp;nbsp; to &quot;org.apache.axis2.archetype:&lt;wbr&gt;&lt;/wbr&gt;quickstart-webapp  (Maven archetype for creating a&amp;nbsp; Axis2 web Service as a webapp)&quot; . Then  provide other input parameters such as group name, artifact name etc.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; 541: local -&amp;gt; org.apache.axis2.archetype:quickstart (Maven archetype for creating a Axis2 web Service)  
 542: local -&amp;gt; org.apache.axis2.archetype:quickstart-webapp (Maven archetype for creating a Axis2 web Service as a webapp)  
 Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 171: 542  
 [INFO] snapshot org.apache.axis2.archetype:quickstart-webapp:1.7.0-SNAPSHOT: checking for updates from quickstart-webapp-repo  
 Downloading: http://repository.apache.org/snapshots//org/apache/axis2/archetype/quickstart-webapp/1.7.0-SNAPSHOT/quickstart-webapp-1.7.0-20120131.070321-34.jar  
 10K downloaded (quickstart-webapp-1.7.0-20120131.070321-34.jar)  
 Downloading: http://repository.apache.org/snapshots//org/apache/axis2/archetype/quickstart-webapp/1.7.0-SNAPSHOT/quickstart-webapp-1.7.0-20120131.070321-34.pom  
 1K downloaded (quickstart-webapp-1.7.0-20120131.070321-34.pom)  
 Define value for property &#39;groupId&#39;: : sample  
 Define value for property &#39;artifactId&#39;: : sampleWebApp  
 Define value for property &#39;version&#39;: 1.0-SNAPSHOT: 1.0  
 Define value for property &#39;package&#39;: sample:  
 Confirm properties configuration:  
 groupId: sample  
 artifactId: sampleWebApp  
 version: 1.0  
 package: sample  
 Y:  
 [INFO] ----------------------------------------------------------------------------  
 [INFO] Using following parameters for creating project from Archetype: quickstart-webapp:1.7.0-SNAPSHOT  
 [INFO] ----------------------------------------------------------------------------  
 [INFO] Parameter: groupId, Value: sample  
 [INFO] Parameter: artifactId, Value: sampleWebApp  
 [INFO] Parameter: version, Value: 1.0  
 [INFO] Parameter: package, Value: sample  
 [INFO] Parameter: packageInPathFormat, Value: sample  
 [INFO] Parameter: package, Value: sample  
 [INFO] Parameter: version, Value: 1.0  
 [INFO] Parameter: groupId, Value: sample  
 [INFO] Parameter: artifactId, Value: sampleWebApp  
 [INFO] project created from Archetype in dir: /home/apps/sampleWebApp  
 [INFO] ------------------------------------------------------------------------  
 [INFO] BUILD SUCCESSFUL  
 [INFO] ------------------------------------------------------------------------  
 [INFO] Total time: 57 seconds  
 [INFO] Finished at: Tue Jan 31 13:28:46 IST 2012  
 [INFO] Final Memory: 30M/238M  
 [INFO] ------------------------------------------------------------------------  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Now you can import generated Maven project to any of your favorite IDE but console is sufficient to run default service. &lt;br /&gt;
&lt;br /&gt;
Generated project&#39;s POM file is already configured for Maven &lt;a href=&quot;http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin&quot; target=&quot;_blank&quot;&gt;Jetty plug-in&lt;/a&gt; and It&#39;s possible to see following entries.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;     &amp;lt;plugin&amp;gt;  
         &amp;lt;groupId&amp;gt;org.mortbay.jetty&amp;lt;/groupId&amp;gt;  
         &amp;lt;artifactId&amp;gt;maven-jetty-plugin&amp;lt;/artifactId&amp;gt;  
         &amp;lt;configuration&amp;gt;  
           &amp;lt;webAppConfig&amp;gt;  
             &amp;lt;contextPath&amp;gt;/&amp;lt;/contextPath&amp;gt;  
           &amp;lt;/webAppConfig&amp;gt;  
         &amp;lt;/configuration&amp;gt;  
       &amp;lt;/plugin&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
3.) Run Jetty server using following command. [ NOTE -2 ]&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; mvn clean jetty:run  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
4.) Above command will start Jetty server and deploy current Maven  project as a web application in this case it deploy available web  services too. You can access WSDL file for deployed web service using  following URL.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; http://localhost:8080/services/SimpleService?wsdl  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
5.) You can use Axis2&#39;s WSDL2JAVA or tool like a SoapUi to generate  web service client for above service alternatively you can test above  service using your browser in a RESTfull manner.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; http://localhost:8080/services/SimpleService/helloService?msg=sagara  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
You should able to see following response in your browser.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;ns:helloServiceResponse&amp;gt;&amp;lt;ns:return&amp;gt;Hello sagara&amp;lt;/ns:return&amp;gt;&amp;lt;/ns:helloServiceResponse&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
6.) If you are happy with your service you can create a WAR archive  using mvn package command and possible to deploy in real app server  instance.&lt;br /&gt;
&lt;br /&gt;
Axis2 &amp;nbsp;Webapp archetype&amp;nbsp;use Jetty as the default &amp;nbsp;server but it&#39;s possible to use Tomcat as follows. &lt;br /&gt;
&lt;br /&gt;
7.) Add &lt;a href=&quot;http://tomcat.apache.org/maven-plugin.html&quot; target=&quot;_blank&quot;&gt;tomcat-maven-plugin&lt;/a&gt; to the POM file and configure it properly.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;plugin&amp;gt;  
      &amp;lt;groupId&amp;gt;org.codehaus.mojo&amp;lt;/groupId&amp;gt;  
      &amp;lt;artifactId&amp;gt;tomcat-maven-plugin&amp;lt;/artifactId&amp;gt;  
       &amp;lt;configuration&amp;gt;  
              &amp;lt;useSeparateTomcatClassLoader&amp;gt;  
               true  
             &amp;lt;/useSeparateTomcatClassLoader&amp;gt;                       
        &amp;lt;/configuration&amp;gt;  
   &amp;lt;/plugin&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&amp;nbsp;8.) Now all you need is to execute run goal as follows.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; mvn clean tomcat:run  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
9.) Also if you plan to deploy your service in a Tomcat instance you can you use deploy goal to deploy your service.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; mvn tomcat:deploy   
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Following are two sample configurations to use with deploy goal.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;      &amp;lt;plugin&amp;gt;  
           &amp;lt;groupId&amp;gt;org.codehaus.mojo&amp;lt;/groupId&amp;gt;  
            &amp;lt;artifactId&amp;gt;tomcat-maven-plugin&amp;lt;/artifactId&amp;gt;  
            &amp;lt;configuration&amp;gt;  
                &amp;lt;useSeparateTomcatClassLoader&amp;gt;  
                  true  
                &amp;lt;/useSeparateTomcatClassLoader&amp;gt;               
                &amp;lt;path&amp;gt;/ws&amp;lt;/path&amp;gt;  
               &amp;lt;warFile&amp;gt;target/wepAppSample-1.0.war&amp;lt;/warFile&amp;gt;  
               &amp;lt;username&amp;gt;tomcat&amp;lt;/username&amp;gt;  
               &amp;lt;password&amp;gt;tomcat&amp;lt;/password&amp;gt;  
             &amp;lt;/configuration&amp;gt;  
       &amp;lt;/plugin&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;         &amp;lt;plugin&amp;gt;  
               &amp;lt;groupId&amp;gt;org.codehaus.mojo&amp;lt;/groupId&amp;gt;  
               &amp;lt;artifactId&amp;gt;tomcat-maven-plugin&amp;lt;/artifactId&amp;gt;  
               &amp;lt;configuration&amp;gt;  
                &amp;lt;useSeparateTomcatClassLoader&amp;gt;  
                 true  
                &amp;lt;/useSeparateTomcatClassLoader&amp;gt;  
               &amp;lt;server&amp;gt;TomcatServer&amp;lt;/server&amp;gt;  
                &amp;lt;path&amp;gt;/ws&amp;lt;/path&amp;gt;  
               &amp;lt;warFile&amp;gt;target/wepAppSample-1.0.war&amp;lt;/warFile&amp;gt;                
              &amp;lt;/configuration&amp;gt;  
          &amp;lt;/plugin&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;NOTE -1 &lt;/b&gt;&lt;br /&gt;
Until Axis2 1.7.0 version get released this archetype is  not available on public Maven repos but you can point to Apache  snapshot repository as follows.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; mvn archetype:generate -DarchetypeRepository=http://repository.apache.org/snapshots/   
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;NOTE -2 &lt;/b&gt;&lt;br /&gt;
Until Axis2 1.7.0 version get released it&#39;s required to  add following snapshot repository to the project&#39;s POM file in order to  grab snapshot artifacts.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;         &amp;lt;repositories&amp;gt;  
           &amp;lt;repository&amp;gt;     
            &amp;lt;id&amp;gt;snapshots&amp;lt;/id&amp;gt;  
            &amp;lt;url&amp;gt;http://repository.apache.org/snapshots&amp;lt;/url&amp;gt;  
           &amp;lt;/repository&amp;gt;    
         &amp;lt;/repositories&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/5372750300665387393/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/5372750300665387393?isPopup=true' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/5372750300665387393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/5372750300665387393'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2012/02/axis2-archetype-to-create-web.html' title='Axis2 archetype to create web application and Maven Jetty/Tomcat plug-ins.'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-3269916675380334186</id><published>2012-01-22T21:41:00.001+05:30</published><updated>2012-01-22T21:55:56.138+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="JAX-WS"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><title type='text'>JAX-WS processing using Axis2 tools</title><content type='html'>JAX-WS &lt;a href=&quot;http://docs.oracle.com/javase/6/docs/technotes/tools/share/wsgen.html&quot; target=&quot;_blank&quot;&gt;wsgen&lt;/a&gt; and &lt;a href=&quot;http://docs.oracle.com/javase/6/docs/technotes/tools/share/wsimport.html&quot; target=&quot;_blank&quot;&gt;wsimport&lt;/a&gt; tools were designed to generate portable  artifacts so that those artifacts can be use with any JAX-WS vendor  runtime also these tools distribute as a part of JDK. Traditionally  Axis2 does not provide any JAX-WS tools, instead it&#39;s possible to  execute artifacts generated by wsgen and wsimport tools within Axis2.  Recently number of users are requested to enable JAX-WS processing  through Axis2 tools such as &lt;a href=&quot;http://axis.apache.org/axis2/java/core/docs/reference.html&quot; target=&quot;_blank&quot;&gt;WSDL2JAVA&lt;/a&gt; and &lt;a href=&quot;http://axis.apache.org/axis2/java/core/docs/reference.html&quot; target=&quot;_blank&quot;&gt;JAVA2WSDL&lt;/a&gt;. Starting from 1.7.0  version Axis2 provides first class JAX-WS processing support for both  WSDL2JAVA and JAVA2WSDL tools. Also it&#39;s possible use&amp;nbsp; wsgen and  wsimport tools with Axis2 in the usual manner. &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is a new command line option introduced as &lt;b&gt;&quot;jws&quot; &lt;/b&gt;that  enables switching between Axis2 native processing and JAX-WS processing.  Once the &lt;b&gt;&quot;jws&quot;&lt;/b&gt; option available the tool will switch to JAX-WS  processing from default Axis2 native processing .&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
To provide other input options it is possible to use some of the  existing WSDL2JAVA/JAVA2WSDL options or possible to use&amp;nbsp; wsgen/wsimport options if those option names are not conflict with Axis2 tools  option names. If such option name conflict occurs Axis2 option will get  the priority.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;WSDL2JAVA options&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;nobrtable&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;2&quot; bordercolor=&quot;#3366cc&quot; cellpadding=&quot;3&quot; cellspacing=&quot;3&quot; style=&quot;background-color: white;&quot;&gt;&lt;tbody&gt;
&lt;tr style=&quot;background-color: #3366cc; color: white; padding-bottom: 4px; padding-top: 5px;&quot;&gt;&lt;th&gt;Option (Axis2)&lt;/th&gt;  &lt;th&gt;Option (wsimport)&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;-uri [url or path]&lt;/td&gt;  &lt;td&gt;-uri [url or path]&lt;/td&gt;  &lt;td&gt;A url or path to a WSDL&lt;/td&gt;   &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;-o [path]&lt;/td&gt;  &lt;td&gt;-d [path]&lt;/td&gt;  &lt;td&gt;Specify a directory path for the generated code&lt;/td&gt;   &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;-p [pkg name]&lt;/td&gt;  &lt;td&gt;-p [pkg name]&lt;/td&gt;  &lt;td&gt;Specify a custom package name for the generated code&lt;/td&gt;   &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;-http-proxy-host [host name]&lt;/td&gt;  &lt;td rowspan=&quot;2&quot;&gt;-httpproxy [host:port]&lt;/td&gt;  &lt;td rowspan=&quot;2&quot;&gt;specify a HTTP proxy server&lt;/td&gt;   &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;-http-proxy-port [port]&lt;/td&gt;   &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
Examples :&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; wsdl2java.sh -jws -uri SimpleService.wsdl   
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; wsdl2java.sh -jws -uri SimpleService.wsdl -o out  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; wsdl2java.sh -jws -uri SimpleService.wsdl -d out  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;JAVA2WSDL options&lt;/b&gt;&lt;br /&gt;
&lt;style type=&quot;text/css&quot;&gt;
.nobrtable br { display: none }
&lt;/style&gt;&lt;br /&gt;
&lt;div class=&quot;nobrtable&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;2&quot; bordercolor=&quot;#3366cc&quot; cellpadding=&quot;3&quot; cellspacing=&quot;3&quot; style=&quot;background-color: white;&quot;&gt;&lt;tbody&gt;
&lt;tr style=&quot;background-color: #3366cc; color: white; padding-bottom: 4px; padding-top: 5px;&quot;&gt;  &lt;th&gt;Option (Axis2)&lt;/th&gt;   &lt;th&gt;Option (wsimport)&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;   &lt;td&gt;-cn [fully qualified class name]&lt;/td&gt;   &lt;td&gt;-cn [fully qualified class name]&lt;/td&gt;   &lt;td&gt;fully qualified class name&lt;/td&gt;    &lt;/tr&gt;
&lt;tr&gt;   &lt;td&gt;-o [path]&lt;/td&gt;   &lt;td&gt;-d [path]&lt;/td&gt;   &lt;td&gt;Output directory&lt;/td&gt;    &lt;/tr&gt;
&lt;tr&gt;   &lt;td&gt;-cp [class path uri]&lt;/td&gt;   &lt;td&gt;-cp [class path uri]&lt;/td&gt;   &lt;td&gt;list of classpath entries&lt;/td&gt;    &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&amp;nbsp;Examples :&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; java2wsdl.sh -jws -cn sample.UserService 
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; java2wsdl.sh -jws -cn sample.UserService -d out  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; java2wsdl.sh -jws -cn sample.UserService -o out  
&lt;/code&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/3269916675380334186/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/3269916675380334186?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/3269916675380334186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/3269916675380334186'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2012/01/jax-ws-processing-using-axis2-tools.html' title='JAX-WS processing using Axis2 tools'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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-33519738.post-1556082657610395105</id><published>2012-01-20T00:23:00.002+05:30</published><updated>2012-01-20T22:42:09.351+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="Maven2"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><title type='text'>Axis2 Simple HTTP server Maven plugin</title><content type='html'>As I mentioned in my last blog post this post covers one of the new feature of upcoming Axis2 1.7.0 version. Recently we have done number of improvements for Axis2 Maven support. There are three new Maven related modules introduced as follows.&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&amp;nbsp;simple-server-maven-plugin - A Maven plug-in that allows to run Axis2&#39;s simple HTTP server as a maven plug-in.&lt;/li&gt;
&lt;li&gt; quickstart archetype - Maven archetype to develop and package Axis2 native (AAR) web services.&lt;/li&gt;
&lt;li&gt;quickstart-webapp - Maven archetype to develop and package Axis2 web services as a web application(WAR). &amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;In this post I discuss how to use&amp;nbsp; simple-server-maven-plugin and it&#39;s  configuration options. At the moment simple-server-maven-plugin provides &amp;nbsp;single goal as &quot;axis2:run&quot;. &lt;br /&gt;
&lt;br /&gt;
You can add  simple-server-maven-plugin into your Maven POM file as follows.&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;     &amp;lt;plugin&amp;gt;  
         &amp;lt;groupId&amp;gt;org.apache.axis2&amp;lt;/groupId&amp;gt;  
         &amp;lt;artifactId&amp;gt;simple-server-maven-plugin&amp;lt;/artifactId&amp;gt;  
         &amp;lt;version&amp;gt;${axis2.version}&amp;lt;/version&amp;gt;  
     &amp;lt;/plugin&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Note&lt;/b&gt; : &lt;i&gt;At the moment this plug-in available only with 1.7.0-SNAPSHOT  version and until this get released with official Apache releases you  have to do one extra step as mentioned here[1].&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
As you may know  Axis2 services expect single meta data file called services.xml under a  directory named META-INF. By default it expect to place this meta data  files under the  &quot;src/main/resources/services&quot; directory. In order to  deploy multiple service META-INF should place inside a another  directory. As an example  /src/main/resources/services/SimpleService/META-INF/services.xml. Also  by default it facilitates to place Axis2 modules (.mar) under  src/main/resources/modules directory. Following picture shows one such a  example directory&amp;nbsp;structure.&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/AVvXsEgBeQSqRFs7yJYloFLcTE81kFbuYLT-DCECS1ZTuQro7ERUkhfjXGZIs1aPeWf4QD_tB24yDHoKK3Z3K3gnu2cDmknYh7BY_ODBwlfw6pRswT1ItXv3yX2XfXb3uhyq7X1SWwJB/s1600/Screenshot-1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBeQSqRFs7yJYloFLcTE81kFbuYLT-DCECS1ZTuQro7ERUkhfjXGZIs1aPeWf4QD_tB24yDHoKK3Z3K3gnu2cDmknYh7BY_ODBwlfw6pRswT1ItXv3yX2XfXb3uhyq7X1SWwJB/s1600/Screenshot-1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Once you have&amp;nbsp;completed&amp;nbsp;above steps you can run Axis2 Simple HTTP server using run goal.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; mvn clean axis2:run  &lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Now It&#39;s possible to access available service listing&amp;nbsp; page by http://localhost:8080 URL.&lt;/div&gt;&lt;br /&gt;
simple-server-maven-plugin support for following configuration options.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;style type=&quot;text/css&quot;&gt;
.nobrtable br { display: none }
&lt;/style&gt;&lt;br /&gt;
&lt;div class=&quot;nobrtable&quot;&gt;&lt;table border=&quot;2&quot; bordercolor=&quot;#3366cc&quot; cellpadding=&quot;3&quot; cellspacing=&quot;3&quot; style=&quot;background-color: white;&quot;&gt;&lt;tbody&gt;
&lt;tr style=&quot;background-color: #3366cc; color: white; padding-bottom: 4px; padding-top: 5px;&quot;&gt; &lt;th&gt;Option&lt;/th&gt; &lt;th&gt;&lt;/th&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;repoPath&lt;/td&gt; &lt;td&gt;Path to Axis2 repository by default run goal creates Axis2 repository inside the project&#39;s target directory. &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;confPath&lt;/td&gt; &lt;td&gt;Path to Axis2.xml configuration file. &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;stdServiceSrcDir&lt;/td&gt; &lt;td&gt;Directory to  place service meta (META-INF/services.xml) information. This directory supports multiple service deployment. Default value is &quot;src/main/resources/services&quot;. &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;moduleSrcDir&lt;/td&gt; &lt;td&gt;moduleSrcDir - Directory to place Axis2 modules (.mar) default value is &quot;src/main/resources/modules&quot; &lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Hope this plug-in save web service development time greatly and also this can be used to automate unit test easily.&amp;nbsp; &lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;[1]&lt;/b&gt;  - &lt;i&gt;Since above plug-in still not available on official Maven  repositories&amp;nbsp; it is required to add following SNAPSHOT repository to  your POM file. But this is not&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;&lt;i&gt;required&lt;/i&gt;&lt;/span&gt;&amp;nbsp;after Axis2 1.7.0 release.&lt;/i&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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;    &amp;lt;pluginRepositories&amp;gt;  
           &amp;lt;pluginRepository&amp;gt;     
            &amp;lt;id&amp;gt;apache-snapshots&amp;lt;/id&amp;gt;     
            &amp;lt;url&amp;gt;http://repository.apache.org/snapshots&amp;lt;/url&amp;gt;  
           &amp;lt;/pluginRepository&amp;gt;    
      &amp;lt;/pluginRepositories&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/1556082657610395105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/1556082657610395105?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1556082657610395105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1556082657610395105'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2012/01/axis2-simple-http-server-maven-plug-in.html' title='Axis2 Simple HTTP server Maven plugin'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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/AVvXsEgBeQSqRFs7yJYloFLcTE81kFbuYLT-DCECS1ZTuQro7ERUkhfjXGZIs1aPeWf4QD_tB24yDHoKK3Z3K3gnu2cDmknYh7BY_ODBwlfw6pRswT1ItXv3yX2XfXb3uhyq7X1SWwJB/s72-c/Screenshot-1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-1188971404340335251</id><published>2011-11-16T04:16:00.001+05:30</published><updated>2011-11-16T04:22:07.245+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><title type='text'>What is new in Axis2 1.7.0 - 1</title><content type='html'>I conducted a Fast Feather talk during the ApacheCon NA 2011 to give a overview about new features of upcoming Axis2 1.7.0 release. I started to write series of blog post mentioning new&amp;nbsp;features of new release I will explain each of these features in detail and try to provide samples too.&lt;br /&gt;
&lt;br /&gt;
As the starting post I attached a slide that shows overview of most of the new features. &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;width:425px&quot; id=&quot;__ss_10176298&quot;&gt;&lt;strong style=&quot;display:block;margin:12px 0 4px&quot;&gt;&lt;a href=&quot;http://www.slideshare.net/sagara10/what-is-new-in-axis2-170-rlease-1&quot; title=&quot;What is new in Axis2 1.7.0 rlease - 1&quot;&gt;What is new in Axis2 1.7.0 rlease - 1&lt;/a&gt;&lt;/strong&gt;&lt;object id=&quot;__sse10176298&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=fastfeatheraxis2170-111115163555-phpapp02&amp;stripped_title=what-is-new-in-axis2-170-rlease-1&amp;userName=sagara10&quot; /&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;/&gt;&lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot;/&gt;&lt;embed name=&quot;__sse10176298&quot; src=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=fastfeatheraxis2170-111115163555-phpapp02&amp;stripped_title=what-is-new-in-axis2-170-rlease-1&amp;userName=sagara10&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style=&quot;padding:5px 0 12px&quot;&gt;View more &lt;a href=&quot;http://www.slideshare.net/&quot;&gt;presentations&lt;/a&gt; from &lt;a href=&quot;http://www.slideshare.net/sagara10&quot;&gt;sagara10&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/1188971404340335251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/1188971404340335251?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1188971404340335251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1188971404340335251'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2011/11/what-is-new-in-axis2-170-1.html' title='What is new in Axis2 1.7.0 - 1'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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-33519738.post-7462629491716316721</id><published>2011-10-20T12:55:00.007+05:30</published><updated>2011-10-20T13:10:00.416+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><category scheme="http://www.blogger.com/atom/ns#" term="XML"/><title type='text'>SOAP encoding and Axis2</title><content type='html'>As of today SOAP encoding only exists due to some historical reasons non of the standard web service  framework supports for SAOP encoding that includes Axis2, Metro and CXF.  Some people still tend to use SAOP encoding without knowing why WS frameworks discourage to use it or some have to use it when they implement web service clients. Usually I can see number of such queries on axis2-user list time to time. Here I discuss few workarounds useful when you dealing with SAOP encoding. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What is SOAP encoding &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
When authors of SOAP specification write it for first time they wanted to define a common way to describe messages but at that time XMLSchema was not completed and not in main stream too. Hence they came up with idea of SOAP Encoding as an extension of the SOAP specification that defines how a data value should be encoded in an XML. &lt;br /&gt;
&lt;br /&gt;
SOAP encoding define it&#39;s own namespace as http://schemas.xmlsoap.org/soap/encoding/ and set of rules to follow. SOAP encoding introduced number of interoperability and validation issues. Tim Ewald described some of those issues in his article &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms995710.aspx&quot;&gt;here&lt;/a&gt;.WS-I also highly discourage to use encoding systems in their basic profile. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;SAOP encoding  in server side &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If you use code first approach there is nothing to worry &lt;a href=&quot;http://axis.apache.org/axis2/java/core/&quot;&gt;Axis2&lt;/a&gt; runtime generate WSDL that does not use SOAP encoding at all. But if you use contract first approach you need to make sure that you don&#39;t use SOAP encoding in your service contract instead XMLSchema provides very powerful type system for your messages. &lt;br /&gt;
&lt;br /&gt;
SOAP encoding array concept is still used by many people, if you have such legacy WSDL file you could easily redesign your types using XMLSchema. Following example describes one such scenario. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First let&#39;s see SAOP encoding sample.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;complexType name=&quot;ArrayOfStrings&quot;&amp;gt;  
  &amp;lt;complexContent&amp;gt;  
   &amp;lt;restriction base=&quot;SOAP-ENC:Array&quot;&amp;gt;  
    &amp;lt;attribute ref=&quot;SOAP-ENC:arrayType&quot;  
          wsdl:arrayType=&quot;xsd:string[]&quot;/&amp;gt;  
   &amp;lt;/restriction&amp;gt;  
  &amp;lt;/complexContent&amp;gt;  
 &amp;lt;/complexType&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Now same thing can be easily rewritten using XMLSchema as follows.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;complexType name=&quot;ArrayOfStrings&quot;  
  &amp;lt;element name=&quot;item&quot; type=&quot;xsd:string&quot; maxOccurs=&quot;20&quot;/&amp;gt;  
 &amp;lt;/complexType&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;SOAP encoding in client side &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Sometimes it is required to access services that has service description with SOAP encoding constructs. By default Axis2 code generation tool called &lt;a href=&quot;http://axis.apache.org/axis2/java/core/tools/CodegenToolReference.html&quot;&gt;WSDL2JAVA&lt;/a&gt; fail on generating codes for such WSDL files. But as a workaround you could use &lt;a href=&quot;http://xmlbeans.apache.org/&quot;&gt;XMLBeans&lt;/a&gt; data binding to generate clients codes for above WSDLs.  XMLBeans simply generate Java beans for all the types available on schema . In this case it generate beans for all the types available on SOAP encoding schema &lt;a href=&quot;http://schemas.xmlsoap.org/soap/encoding&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
You can invoke code generation tool with XMLbeans data binding as follows. &lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; wsdl2java.sh -uri service.wsdl -d xmlbeans   
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Conclusion &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
As we discussed the best practice is avoid use of SOAP encoding when you design web services.In case if you are a consumer of service that use SAOP encoding in their WSDL, Axis2 XMLBeans data binding provide a great solution for you.</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/7462629491716316721/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/7462629491716316721?isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/7462629491716316721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/7462629491716316721'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2011/10/soap-encoding-and-axis2.html' title='SOAP encoding and Axis2'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33519738.post-1578468313793629702</id><published>2011-09-11T23:02:00.004+05:30</published><updated>2012-02-15T07:44:51.211+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Community"/><title type='text'>Apache Community building event within WSO2Con 2011</title><content type='html'>We are planning to have a free Apache Community building event within&lt;br /&gt;
the WSO2Con conference next week (13th September to 15th September) in&lt;br /&gt;
Colombo, Sri Lanka. We would like to invite contributors /committers&lt;br /&gt;
on Apache Axis2, Apache WS, Apache ODE, Apache Synapse to take a part&lt;br /&gt;
of this event. Number of committers from above projects will be there&lt;br /&gt;
and it&#39;s a good chance to communicate with them and get your first&lt;br /&gt;
step on those mentioned projects.&amp;nbsp; Also you can join with us using any&lt;br /&gt;
Freenode&amp;nbsp; IRC client on #axis2 channel or use #Axis2 on Twitter. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This Community event sponsored by &lt;a href=&quot;http://wso2.com/&quot;&gt;WSO2 &lt;/a&gt;and will be held on same conference venue. &lt;a href=&quot;http://wso2.com/&quot;&gt;WSO2&lt;/a&gt; is a leading and long-standing contributor of number of world class Apache projects that includes Axis2 , Synapse, WS, Woden etc.&amp;nbsp; Most of WSO2 committers will participate to this event and it&#39;s a rear chance to meet them face to face and discuss your issues , suggestions&amp;nbsp; etc. Also those who want to contribute&amp;nbsp; also can get their hands dirty with those project&#39;s first step. No one can tell, isn&#39;t it your first step to be a Apache committer ? you better give a try and see .&lt;br /&gt;
&lt;br /&gt;
you can find location and other details from here &lt;a href=&quot;http://wso2.com/events/wso2con-2011-colombo/&quot;&gt;http://wso2.com/events/wso2con-2011-colombo/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
One last thing , within WSO2 we not only develop and release products under Apache licence instead we use Apache like open development model, WSO2 engineering lists are completely open for anyone and we are encouraging community contribution.</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/1578468313793629702/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/1578468313793629702?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1578468313793629702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/1578468313793629702'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2011/09/apache-community-building-event-within.html' title='Apache Community building event within WSO2Con 2011'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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-33519738.post-5379228402554471904</id><published>2011-07-31T18:14:00.001+05:30</published><updated>2011-07-31T18:15:33.210+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Axis2"/><category scheme="http://www.blogger.com/atom/ns#" term="POJO"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><category scheme="http://www.blogger.com/atom/ns#" term="XML"/><title type='text'>How to get best use of AXIS2 Object support.</title><content type='html'>&lt;style type=&quot;text/css&quot;&gt;
 &lt;!--
  @page { margin: 0.79in }
  P { margin-bottom: 0.08in }
  A:link { so-language: zxx }
 --&gt;
 
&lt;/style&gt;  &lt;br /&gt;
&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;Axis2 web service framework offers number of development approaches to match various user requirements  instead of limiting to support one or two specifications. This is a one distinct feature that Axis2 go beyond from some other web service frameworks.  If someone want to deploy a web service very quickly using POJOs without touching XML or SOAP, AXIS2 ADB is the ideal solution for him. ADB Object support is a one of the great  feature and we have done some nice set of  recent improvements too. I will discuss few tips within this post that users should know in order to get best use of Axis2 ADB Object support.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; Public Object objectService(Object obj){  
 System.out.println(obj)  
 return obj;  
 }  
&lt;/code&gt;&lt;/pre&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;Since above method takes Object type as an argument and return type it should possible  to send any java primitive or POJO as a parameter value. As an example for a sample String massage it is possible to have following payload.  &lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;ns2:obj   xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;   
           xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;   
           xsi:type=&quot;xs:string&quot;&amp;gt;  
        Hello World  
 &amp;lt;/ns2:obj&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;In case of POJO  message it is possible to have following payload.&lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;ns2:obj xmlns:ns1=&quot;http://sample/xsd&quot;   
                 xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;   
                 xsi:type=&quot;ns1:Student&quot;&amp;gt;  
             &amp;lt;ns1:age&amp;gt;20&amp;lt;/ns1:age&amp;gt;  
             &amp;lt;ns1:id&amp;gt;200&amp;lt;/ns1:id&amp;gt;  
             &amp;lt;ns1:name&amp;gt;saman&amp;lt;/ns1:name&amp;gt;  
            &amp;lt;/ns2:obj&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;In above messages “xsi:type” attribute carries type system information that is required in marshalling and unmarshalling. When you send a POJO value server need to aware with the schema information associate with that particular POJO type otherwise marshalling/unmarshalling process will not possible. Typically Axis2 run-time only aware  with the types associate with a particular service method, if you send above second message you will get an exception something similar to below because server can’t identify type system associate with incoming message.  &lt;/div&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; Exception in thread &quot;main&quot; org.apache.axis2.AxisFault: Unknow type {http://sample/xsd}Student  
&lt;/code&gt;&lt;/pre&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;the solution here is use a parameter called “extraClass” within your services.xml file.  &lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;e.g -  &lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; &amp;lt;parameter name=&quot;extraClass&quot;&amp;gt;sample.Item,sample.Student&amp;lt;/parameter&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;border: none; line-height: 115%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;The above parameter will instruct run-time to register type details of give classes and generate schema as well . Without schema generation it is not possible to write WS clients that capable  of send and receive messages with above POJOs. That is what you all need in server side now you can test your service using a tool like SoapUI.  &lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;In client side easiest and quickest way to write a client is generate code using WSDL2JAVA tool , again by default WSDL2JAVA tool also ignore extra sachem type available on WSDL file when generating codes. But it is possible to change this behaviour by adding option &lt;br /&gt;
“-g” that instruct to generate codes for all the schema types available . You can use following command to generate client side codes for sample application .  &lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; axis2-1.7.0-SNAPSHOT/bin/wsdl2java.sh -uri http://localhost:8080/services/SimpleObjectService?wsdl -g   
&lt;/code&gt;&lt;/pre&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;Now you have generated POJOs in your client side you can use them with your Object service as follows.  &lt;/div&gt;&lt;div style=&quot;border: none; line-height: 100%; margin-bottom: 0in; padding: 0in; page-break-after: auto; page-break-before: auto;&quot;&gt;&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0oOQWHWSdAgvcDCteDjYe5u0Ciru2aMPQzfsRqXd78QOxB6NEM_l8eaLeszggUhKJvFO3NEB-RR033URQiwI1S3M0CoPfF0Ab75nZdMuA5Alw_ydIUusuap7yn4nroD-MjOymyg/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; 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; Student student = new Student();  
 student.setName(&quot;saman&quot;);  
 student.setId(200);  
 student.setAge(20);  
 req.setObj(student);  
 ObjectServiceResponse res = stub.objectService(req );  
 System.out.println(res.get_return());  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ssagara.blogspot.com/feeds/5379228402554471904/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/33519738/5379228402554471904?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/5379228402554471904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33519738/posts/default/5379228402554471904'/><link rel='alternate' type='text/html' href='http://ssagara.blogspot.com/2011/07/how-to-get-best-use-of-axis2-object.html' title='How to get best use of AXIS2 Object support.'/><author><name>Sagara Gunathunga</name><uri>http://www.blogger.com/profile/00728327638746992048</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>