Package org.jboss.jbossts.xts.servicetests.generated

Examples of org.jboss.jbossts.xts.servicetests.generated.CommandsType


    {

        Map<String, Object> requestProperties = ((BindingProvider)port).getRequestContext();
        requestProperties.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serverURL);

        CommandsType commandsType = new CommandsType();
        return port.serve(commands);
    }
View Full Code Here


                url = bindCommand(url, bindings, true);

                bindCommands(commandList, bindings, false);

                CommandsType newCommands = new CommandsType();
                List<String> newCommandList = newCommands.getCommandList();
                for (int i = 0; i < size; i++) {
                    newCommandList.add(commandList.get(i));
                }
                ResultsType subResults = serveSubordinate(url, newCommands);
                List<String> subResultsList = subResults.getResultList();
                size = subResultsList.size();
                for (idx = 0; idx < size; idx++) {
                    resultsList.add(subResultsList.get(idx));
                }
            } else if (command.equals("subtransaction")) {
// create subordinate AT transaction
// this is surplus to requirements since we should really be running against a service which uses
// the subordinate interposition JaxWS handler to install a subordinate transaction before
// entering the service method. we ought to test that handler rather than hand crank the
// interposition in the service
                TxContext currentTx;
                TxContext newTx;
                try {
                    currentTx = TransactionManager.getTransactionManager().currentTransaction();
                } catch (SystemException e) {
                    throw new WebServiceException("subtransaction currentTransaction() failed with exception " + e);
                }

                try {
                    UserTransaction userTransaction = UserTransactionFactory.userSubordinateTransaction();
                    userTransaction.begin();
                    newTx = TransactionManager.getTransactionManager().currentTransaction();
                } catch (Exception e) {
                    throw new WebServiceException("subtransaction begin() failed with exception " + e);
                }
                String id = transactionId("at");
                subordinateTransactionMap.put(id, newTx);
                resultsList.add(id);
            } else if (command.equals("subactivity")) {
// create subordinate BA transaction
// this is surplus ot requirements since we should really be running against a service which uses
// the subordinate interposition JaxWS handler to install a subordinate activity before
// entering the service method. we ought to test that handler rather than hand crank the
// interposition in the service
                TxContext currentTx;
                TxContext newTx;
                try {
                    currentTx = BusinessActivityManagerFactory.businessActivityManager().currentTransaction();
                } catch (SystemException e) {
                    throw new WebServiceException("subtransaction currentTransaction() failed with exception " + e);
                }

                try {
                    UserBusinessActivity userBusinessActivity = UserBusinessActivityFactory.userBusinessActivity();
                    // this is nto implemented yet!!!
                    // userBusinessActivity.beginSubordinate();
                    // and this will fail with a WrongStateException
                    userBusinessActivity.begin();
                    newTx = BusinessActivityManager.getBusinessActivityManager().currentTransaction();
                } catch (Exception e) {
                    throw new WebServiceException("subtransaction begin() failed with exception " + e);
                }
                String id = transactionId("ba");
                subordinateActivityMap.put(id, newTx);
                resultsList.add(id);
            } else if (command.equals("subtransactionserve")) {
// dispatch commands in a subordinate transaction or activity
                // we should find the id of a subordinate transaction, a web service URL
                // and a list of commands to dispatch to that transaction
                // the txid and url must be resolved if supplied as bindings
                String txId = bindCommand(commandList.remove(idx), bindings, true);
                size--;
                String url = bindCommand(commandList.remove(idx), bindings,  true);
                size--;

                TxContext newTx = subordinateTransactionMap.get(txId);
                if (newTx != null) {
                    try {
                        TransactionManager.getTransactionManager().resume(newTx);
                    } catch (Exception e) {
                        throw new WebServiceException("subtransactioncommands resume() failed with exception " + e);
                    }
                } else {
                    throw new WebServiceException("subtransactioncommands unknown subordinate transaction id " + txId);
                }
                // ok, now we install the relevant transaction and then just pass the commands on to
                // the web service

                // we allow unresolved variable references in the rest of the command list as
                // they may be satisfied by embedded bind commands

                bindCommands(commandList,  bindings,  false);

                CommandsType newCommands = new CommandsType();
                List<String> newCommandList = newCommands.getCommandList();
                for (int i = 0; i < size; i++) {
                    newCommandList.add(commandList.get(i));
                }
                ResultsType subResults = serveSubordinate(url, newCommands);
                List<String> subResultsList = subResults.getResultList();
                size = subResultsList.size();
                for (idx = 0; idx < size; idx++) {
                    resultsList.add(subResultsList.get(idx));
                }
            } else if (command.equals("subactivityserve")) {
// dispatch commands in a subordinate transaction or activity
                // we should find the id of a subordinate transaction, a web service URL
                // and a list of commands to dispatch to that transaction
                // the txid and url must be resolved if supplied as bindings
                String txId = bindCommand(commandList.remove(idx), bindings, true);
                size--;
                String url = bindCommand(commandList.remove(idx), bindings,  true);
                size--;

                TxContext newTx = subordinateActivityMap.get(txId);
                if (newTx != null) {
                    try {
                        TransactionManager.getTransactionManager().resume(newTx);
                    } catch (Exception e) {
                        throw new WebServiceException("subactivitycommands resume() failed with exception " + e);
                    }
                } else {
                    throw new WebServiceException("subactivitycommands unknown subordinate transaction id " + txId);
                }
                // ok, now we install the relevant transaction and then just pass the commands on to
                // the web service

                // we allow unresolved variable references in the rest of the command list as
                // they may be satisfied by embedded bind commands

                bindCommands(commandList, bindings,  false);

                CommandsType newCommands = new CommandsType();
                List<String> newCommandList = newCommands.getCommandList();
                for (int i = 0; i < size; i++) {
                    newCommandList.add(commandList.get(i));
                }
                ResultsType subResults = serveSubordinate(url, newCommands);
                List<String> subResultsList = subResults.getResultList();
View Full Code Here

TOP

Related Classes of org.jboss.jbossts.xts.servicetests.generated.CommandsType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.