Created
May 16, 2012 07:31
-
-
Save paulrobinson/2708340 to your computer and use it in GitHub Desktop.
WS-AT without TXFramework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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>WebServicesTxContextHandler</handler-name> | |
<handler-class> | |
com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor | |
</handler-class> | |
</handler> | |
</handler-chain> | |
</handler-chains> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RestaurantParticipant implements Durable2PCParticipant { | |
Vote prepare() throws WrongStateException, SystemException; | |
void commit() throws WrongStateException, SystemException; | |
void rollback() throws WrongStateException, SystemException; | |
void unknown() throws SystemException; | |
void error() throws SystemException; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@WebService | |
@HandlerChain(file="/context-handlers.xml", name="Context Handlers") | |
public class RestaurantServiceATImpl implements RestaurantServiceAT { | |
@WebMethod | |
public void makeBooking() throws RestaurantException { | |
String transactionId; | |
try { | |
transactionId = UserTransactionFactory.userTransaction().toString(); | |
RestaurantParticipant restaurantParticipant = | |
new RestaurantParticipant(transactionId); | |
TransactionManager transactionManager = | |
TransactionManagerFactory.transactionManager(); | |
transactionManager.enlistForDurableTwoPhase(restaurantParticipant, | |
"restaurantServiceAT:" + UUID.randomUUID()); | |
} catch (Exception e) { | |
throw new RestaurantException("Error when enlisting participant", e); | |
} | |
MockRestaurantManager.makeBooking(transactionId); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment