Skip to content

Instantly share code, notes, and snippets.

@paulrobinson
Created May 16, 2012 08:29
Show Gist options
  • Save paulrobinson/2708704 to your computer and use it in GitHub Desktop.
Save paulrobinson/2708704 to your computer and use it in GitHub Desktop.
Bridging without TXFramework
@Stateless @Remote(Bistro.class)
@WebService()
@HandlerChain(file = "jaxws-handlers-server.xml")
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public class BistroImpl implements Bistro
{
@PersistenceContext protected EntityManager em;
@WebMethod
@ServiceRequest
public void bookSeats(int howMany) {
//Use em to increase booking count in DB
}
}
Restaurant restaurant = //get Web service port
List<Handler> handlers = new ArrayList<Handler>(1);
handlers.add(new JaxWSTxOutboundBridgeHandler());
handlers.add(new JaxWSHeaderContextProcessor());
BindingProvider bindingProvider = (BindingProvider) restaurant;
bindingProvider.getBinding().setHandlerChain(handlers);
<handler-chains
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd"
...>
<handler-chain>
<protocol-bindings>##SOAP11_HTTP</protocol-bindings>
<handler>
<handler-name>TransactionBridgeHandler</handler-name>
<handler-class>
org.jboss.jbossts.txbridge.inbound.JaxWSTxInboundBridgeHandler
</handler-class>
</handler>
<handler>
<handler-name>WebServicesTxContextHandler</handler-name>
<handler-class>
com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor
</handler-class>
</handler>
</handler-chain>
</handler-chains>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment