wsdlURL = wsdlFile.toURL();
} else {
wsdlURL = new URL(args[0]);
}
MessageFactory factory = MessageFactory.newInstance();
System.out.println(wsdlURL + "\n\n");
QName serviceName1 = new QName("http://objectweb.org/hello_world_soap_http", "SOAPService1");
QName portName1 = new QName("http://objectweb.org/hello_world_soap_http", "SoapPort1");
SOAPService1 service1 = new SOAPService1(wsdlURL, serviceName1);
InputStream is1 = Client.class.getResourceAsStream("GreetMeDocLiteralReq1.xml");
SOAPMessage soapReq1 = factory.createMessage(null, is1);
Dispatch<SOAPMessage> dispSOAPMsg = service1.createDispatch(portName1,
SOAPMessage.class, Mode.MESSAGE);
System.out.println("Invoking server through Dispatch interface using SOAPMessage");
SOAPMessage soapResp = dispSOAPMsg.invoke(soapReq1);
System.out.println("Response from server: " + soapResp.getSOAPBody().getTextContent());
QName serviceName2 = new QName("http://objectweb.org/hello_world_soap_http", "SOAPService2");
QName portName2 = new QName("http://objectweb.org/hello_world_soap_http", "SoapPort2");
SOAPService2 service2 = new SOAPService2(wsdlURL, serviceName2);
InputStream is2 = Client.class.getResourceAsStream("GreetMeDocLiteralReq2.xml");
SOAPMessage soapReq2 = factory.createMessage(null, is2);
DOMSource domReqMessage = new DOMSource(soapReq2.getSOAPPart());
Dispatch<DOMSource> dispDOMSrcMessage = service2.createDispatch(portName2,
DOMSource.class, Mode.MESSAGE);
System.out.println("Invoking server through Dispatch interface using DOMSource in MESSAGE Mode");