m.setStyle(Style.RPC);
QName opQName = new QName("urn://sample", "op", "m");
m.setOperationElement(opQName);
// Get the BlockFactory
JAXBBlockFactory bf = (JAXBBlockFactory)
FactoryRegistry.getFactory(JAXBBlockFactory.class);
// Create the JAXBContext
JAXBBlockContext context = new JAXBBlockContext(StockPrice.class.getPackage().getName());
// Create the JAX-B object
ObjectFactory of = new ObjectFactory();
StockPrice obj = of.createStockPrice();
obj.setPrice("100");
// Create the JAX-B Element
QName paramQName = new QName("urn://sample", "param", "m");
JAXBElement e = new JAXBElement(paramQName, StockPrice.class, obj);
// Create a JAXBBlock using the param object as the content. This simulates
// what occurs on the outbound JAX-WS Proxy client
Block block = bf.createFrom(e, context, null);
// Add the block to the message as normal body content.
m.setBodyBlock(block);
// Check to see if the message is a fault. The client/server will always call this method.