use of javax.jws.WebMethod in project quickstarts by jboss-switchyard.
the class AirportService method getFLTID.
/**
* Get flight identifier for the parameters.
* @param from place (city)
* @param to place (city)
* @param date of flight
* @return format [from/to/month/day]
*/
@WebMethod
@WebResult(name = "fltid")
public String getFLTID(@WebParam(name = "from") String from, @WebParam(name = "to") String to, @WebParam(name = "date") Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return from + "/" + to + "/" + String.valueOf(c.get(Calendar.MONTH) + 1) + "/" + String.valueOf(c.get(Calendar.DAY_OF_MONTH));
}
use of javax.jws.WebMethod in project quickstarts by jboss-switchyard.
the class AirportService method order.
/**
* Order flight ticket defined by fltid for a user identified by name.
* @param name username
* @param fltid flight identifier
*/
@WebMethod
public void order(@WebParam(name = "name") String name, @WebParam(name = "fltid") String fltid) {
log.info("AirportService:order");
UserTransaction transactionId = UserTransactionFactory.userTransaction();
if (transactionId != null) {
log.info("Transaction ID = " + transactionId.toString());
if (transactionId.toString().compareTo("Unknown") == 0) {
log.info("JBoss AS is badly configured. (Enable XTS)");
return;
}
// Create order participant (fly ticket)
OrderParticipant op = new OrderParticipant(transactionId.toString(), fltid);
try {
// Enlist order participant to the transaction
TransactionManagerFactory.transactionManager().enlistForDurableTwoPhase(op, "org.switchyard.quickstarts.bpel.xts.wsat.ws:AirportService:" + name + ":" + fltid);
} catch (Exception e) {
log.log(Level.SEVERE, e.getMessage());
e.printStackTrace();
}
}
}
use of javax.jws.WebMethod in project scout.rt by eclipse.
the class InvocationContextTest method testInvokeNotWebMethod.
@Test
public void testInvokeNotWebMethod() {
final BooleanHolder intercepted = new BooleanHolder(false);
ServerRunContexts.copyCurrent().withCorrelationId(TESTING_CORRELATION_ID).run(new IRunnable() {
@Override
public void run() throws Exception {
InvocationContext<TestPort> invocationContext = new InvocationContext<>(m_port, "name");
invocationContext.withEndpointUrl("http://localhost");
invocationContext.whenInvoke(new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
intercepted.setValue(true);
return method.invoke(proxy, args);
}
});
// invoke method which is not annotated with @WebMethod
invocationContext.getPort().notWebMethod();
}
});
// only methods annotated with @WebMethod are intercepted
assertFalse(intercepted.getValue());
// correlationId is not propagated other than web methods
assertNull(m_port.getRequestContext().get(MessageContexts.PROP_CORRELATION_ID));
verify(m_port).notWebMethod();
}
use of javax.jws.WebMethod in project jbossws-cxf by jbossws.
the class EndpointOneImpl method echo.
@WebMethod
public String echo(String input) {
// this is just a verification, so going the dirty way...
Bus bus = EndpointAssociation.getEndpoint().getService().getDeployment().getAttachment(BusHolder.class).getBus();
AutomaticWorkQueue queue = bus.getExtension(WorkQueueManager.class).getAutomaticWorkQueue();
Long qs = null;
Integer it = null;
try {
qs = (Long) queue.getClass().getMethod("getMaxSize").invoke(queue);
it = (Integer) queue.getClass().getMethod("getHighWaterMark").invoke(queue);
} catch (Exception e) {
throw new RuntimeException(e);
}
if (qs != 10) {
throw new RuntimeException("Expected max queue size '10' but got '" + qs + "'!");
}
if (it != 8) {
throw new RuntimeException("Expected highWaterMark '8' but got '" + it + "'!");
}
Logger.getLogger(this.getClass()).info("echo: " + input);
count.incrementAndGet();
return input;
}
use of javax.jws.WebMethod in project jbossws-cxf by jbossws.
the class EndpointOneImpl method echoOneWay.
@WebMethod
@Oneway
public void echoOneWay(String input) {
count1.incrementAndGet();
MessageContext msgContext = context.getMessageContext();
HttpServletRequest request = (HttpServletRequest) msgContext.get(MessageContext.SERVLET_REQUEST);
final String scheme = request.getScheme();
Logger.getLogger(this.getClass()).info("echoOneWay: " + input + ", scheme: " + scheme);
if (scheme != null) {
count2.incrementAndGet();
}
}
Aggregations