SOAPService service = new SOAPService(wsdl, serviceName);
assertNotNull(service);
InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
SOAPMessage soapReqMsg = MessageFactory.newInstance().createMessage(null, is);
DOMSource domReqMsg = new DOMSource(soapReqMsg.getSOAPBody().extractContentAsDocument());
assertNotNull(domReqMsg);
InputStream is1 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq1.xml");
SOAPMessage soapReqMsg1 = MessageFactory.newInstance().createMessage(null, is1);
DOMSource domReqMsg1 = new DOMSource(soapReqMsg1.getSOAPBody().extractContentAsDocument());
assertNotNull(domReqMsg1);
InputStream is2 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq2.xml");
SOAPMessage soapReqMsg2 = MessageFactory.newInstance().createMessage(null, is2);
DOMSource domReqMsg2 = new DOMSource(soapReqMsg2.getSOAPBody().extractContentAsDocument());
assertNotNull(domReqMsg2);
InputStream is3 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq3.xml");
SOAPMessage soapReqMsg3 = MessageFactory.newInstance().createMessage(null, is3);
DOMSource domReqMsg3 = new DOMSource(soapReqMsg3.getSOAPBody().extractContentAsDocument());
assertNotNull(domReqMsg3);
Dispatch<DOMSource> disp = service.createDispatch(portName,
DOMSource.class, Service.Mode.PAYLOAD);
//invoke
DOMSource domResMsg = disp.invoke(domReqMsg);
assertNotNull(domResMsg);
String expected = "Hello TestSOAPInputMessage";
assertEquals("Response should be : Hello TestSOAPInputMessage",
expected, domResMsg.getNode().getFirstChild().getTextContent());
//invokeOneWay
disp.invokeOneWay(domReqMsg1);
//invokeAsync
Response response = disp.invokeAsync(domReqMsg2);
DOMSource domRespMsg2 = (DOMSource)response.get();
assertNotNull(domRespMsg2);
String expected2 = "Hello TestSOAPInputMessage2";
assertEquals("Response should be : Hello TestSOAPInputMessage2",
expected2, domRespMsg2.getNode().getFirstChild().getTextContent());
//invokeAsync with AsyncHandler
TestDOMSourceHandler tdsh = new TestDOMSourceHandler();
Future fd = disp.invokeAsync(domReqMsg3, tdsh);