JBoss Web Services
Alessio [email protected]
Principal Software Eng.JBoss - Red Hat
April 28th, 2010
Who is Alessio?
● JBoss WS[1] committer since early 2007
● JBoss / Red Hat employee since end of 2007
● JBoss Web Service Lead, 2008
● JBoss AS[2], JBoss Wise[3] contributor
● Current Red Hat representative at JSR-224 EG and W3C WS-ResourceAccess WG
● Apache CXF[4] committer since 2009
[1] http://www.jboss.org/jbossws [2] http://www.jboss.org/jbossas
[3] http://www.jboss.org/wise [4] http://cxf.apache.org
What is JBoss WS?
● “Just” a feature-rich JAX-WS compatible ws stack till early 2008...
● a web services framework providing integration layers for 3rd party ws stacks on top of multiple JBoss AS versions
– CXF, Native and Metro stack
– AS 5.x, AS 6.x target containers
The benefits of standards / specs
● WS-Security
● WS-Policy
● WS-Addressing
● ...
W3C standards allow for interoperability
<s:Envelope...>
<s:Header>
<o:Security...>
<u:Timestamp u:Id="..">...</u:Timestamp>
<o:BinarySecurityToken...>...</o:BinarySecurityToken>
<e:EncryptedKey...>...</e:EncryptedKey>
<e:ReferenceList...>...</e:ReferenceList>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
...
</Signature>
</o:Security>
</s:Header>
<s:Body>...</s:Body>
</s:Envelope>
Defined way to:
● format messages
● advertise services
● ...
The benefits of standards / specs
● JSR-224 / JSR-181 (JAX-WS)
● JSR-109 (WS for JavaEE)
● JSR-101 (JAX-RPC)
● JSR-261* (JAX-WSA)
● ...
EndpointService service = new EndpointService(
wsdlURL, serviceQName);
Endpoint port = service.getEndpointPort();
String retObj = port.echo(“Hello World”);
@WebService(name = "Endpoint", serviceName = "EndpointService", targetNamespace = "http://org.jboss.ws/wsref")
@SOAPBinding(style = Style.DOCUMENT, use = Use.LITERAL)
public class EndpointImpl {
@WebMethod(action = “echo”)
public String echo(String input) {
return input;
}
}
JCP specs give us common dev API
Reasons for integrating
● really good open source implementations already available - NIH syndrome
● focus on added value
● open choice (features, performance, ...)
● ... a lot of Web Services specifications!
Reasons for integrating
Who benefits from this move?
● The JBoss community:
– different choices depending on needs
– greater joint community support
– core devs can work on added value● The integrated ws projects and their community:
– additional tests
– bugs detection and fix
– ...
JBoss WSF: high level overview
Web Service Framework
● Management– console
– endpoint registry
– records system
● Configuration– address rewrite
● Features– JAXBIntroductions
– Common JAX-WSA JSR-261 API
● Tooling– common JAXWS tools
– project generator
– Eclipse integration
● AS integration– authentication
– authorization
● Common deploy
● Common testsuite
Do I really need your integration layer?
● Home-brew solutions for running CXF / Metro on JBossAS might work for specific usecases, but you...
– need to embed the stack in your apps
– will suffer from classloading issues
– can just use pojo endpoints
– have no webserviceref injection in ejb3
– loose additional WSF features ;-)
– ...
How it works - deployment
● POJO endpoint<web-app ...> <servlet> <servlet-name>TestService</servlet-name> <servlet-class>org.jboss.test.ws.jaxws.samples.MyEndpoint</servlet-class> </servlet> <servlet-mapping> <servlet-name>TestService</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping></web-app>
● EJB3 endpoint
@WebService(...)public class MyEndpoint { public String sayHello() { return "Hello World!"; }}
@WebService(...)@Statelesspublic class MyEndpoint { public String sayHello() { return "Hello World!"; }}
Create metadata todeploy jboss-web app
How it works - deployment
● Parse or generate proprietary descriptor
– jboss-cxf.xml for CXF stack (Spring conf)– sun-jaxws.xml for Metro stack
● Setup different endpoint servlets for each stack
– extending CXFServlet for CXF stack
How it works - runtime
● Request handlers: called by enpdoint servlet to serve GET / POST requests; delegate to
– CXF ServletController – Metro ServletAdapter
● Invokers: route invocation to JBossAS (JBoss EJB3 layer for ejb3 endpoints)
– configured during proprietary descriptor processing / creation
How it works - runtime
Req
uestH
and
ler
Invok
er
En
dp
oint servlet
CXFor
Metro
Request
Response
JBossAS
...
WS-*
JAX-WShandlers
...
More on deployers...
JBoss AS 5 deployers gives high flexibility● multiple webservice deployers generated
– stack agnostic deployment aspects
– stack specific deployment aspects
– extensibility, separation of concerns, ...
● two webservice stacks at the same time
– JAX-RPC support with CXF / Metro
CXF: additional integration hooks
● Bus configuration: CXF runtime behaviour is controlled by the current Bus; we can set:
– custom resource resolvers– custom transport factories– custom CXF Configurer bean– ...
● Spring Namespace Handlers: we can change configuration namespace to default bean mapping
– override / extend core CXF beans
Some links...
● http://www.jboss.org/jbossws
● http://community.jboss.org/wiki/JBossWS● http://jbossws.blogspot.com/
Q & A