ObjectFactory factory = new ObjectFactory();
Invoke invokeObj = factory.createInvoke();
invokeObj.setInvokeStr("Some Request");
JAXBContext ctx = JAXBContext.newInstance("org.test.dispatch.jaxbsource");
JAXBSource jbSrc = new JAXBSource(ctx.createMarshaller(), invokeObj);
// Invoke the Dispatch
TestLogger.logger.debug(">> Invoking sync Dispatch");
//Invoke Server endpoint and read response
Source response = dispatch.invoke(jbSrc);
assertNotNull("dispatch invoke returned null", response);
//Print the response as string.
StringWriter writer = new StringWriter();
Transformer t = TransformerFactory.newInstance().newTransformer();
Result result = new StreamResult(writer);
t.transform(response, result);
TestLogger.logger.debug("Response On Client: \n" + writer.getBuffer().toString());
// Invoke a second time
jbSrc = new JAXBSource(ctx.createMarshaller(), invokeObj);
// Invoke the Dispatch
TestLogger.logger.debug(">> Invoking sync Dispatch");
//Invoke Server endpoint and read response
response = dispatch.invoke(jbSrc);