@Test
public void testDOMSourcePAYLOAD() throws Exception {
URL wsdl = getClass().getResource("/wsdl/hello_world_xml_wrapped.wsdl");
assertNotNull(wsdl);
XMLService service = new XMLService(wsdl, serviceName);
assertNotNull(service);
InputStream is = getClass().getResourceAsStream(
"/messages/XML_GreetMeDocLiteralReq.xml");
Document doc = XMLUtils.parse(is);
DOMSource reqMsg = new DOMSource(doc);
assertNotNull(reqMsg);
Dispatch<DOMSource> disp = service.createDispatch(portName,
DOMSource.class, Service.Mode.PAYLOAD);
setAddress(disp, ADDRESS);
DOMSource result = disp.invoke(reqMsg);
assertNotNull(result);
Node respDoc = result.getNode();
assertEquals("greetMeResponse", respDoc.getFirstChild().getLocalName());
assertEquals("TestXMLBindingProviderMessage", respDoc.getFirstChild()
.getTextContent());
is = getClass().getResourceAsStream(
"/messages/XML_GreetMeDocLiteralReq_invalid.xml");
doc = XMLUtils.parse(is);
reqMsg = new DOMSource(doc);
assertNotNull(reqMsg);
disp = service.createDispatch(portName,
DOMSource.class, Service.Mode.PAYLOAD);
try {
result = disp.invoke(reqMsg);
fail("should have a schema validation exception of some sort");