The following appears to work using JAX-WS from the JDK package dispatchClient;
import java.io.ByteArrayOutputStream; import java.io.File; import java.net.URL; import javax.xml.namespace.QName; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import javax.xml.ws.Dispatch; import javax.xml.ws.Service; public class DispatchXMLClient { public static void main(String[] args) { try { URL wsdlURL = new URL("myService.wsdl"); Service service = Service.create(wsdlURL, new QName("http://mySite.com/ws/service1", "ServiceName")); Dispatch<Source> disp = service.createDispatch(new QName("http://mySite.com/ws/service1", "ServicePort"), Source.class, Service.Mode.PAYLOAD); Source request = new StreamSource(new File("Project1/resources/WSEtestData/Service1Body.txt")); Source response = disp.invoke(request); // Process the response. StreamResult result = new StreamResult(new ByteArrayOutputStream()); Transformer trans = TransformerFactory.newInstance().newTransformer(); trans.transform(response, result); ByteArrayOutputStream baos = (ByteArrayOutputStream) result.getOutputStream(); // Write out the response content. String responseContent = new String(baos.toByteArray()); System.out.println(responseContent); } catch (Throwable t) { System.err.println("Unexpected exception: " + t); t.printStackTrace(); } } } The message to stream in will be the body of the SOAP message, it is best to put it in its own namespace; <hisl-service1:Service1Request xmlns:hisl-service1="http://mySite.com/ws/service1" > <hisl-service1:Arg1>Stuff</hisl-service1:Arg1> </hisl-service1:Service1Request> Ofcourse it could be implemented using pure sockets, or an HttpURLConnection or commons HttpClient, but then you'd need to make sure you get all the headers right and the SOAP envelope. Not sure what the overhead is... ---------------------------------------------------------------------------- -------------- This message is private and confidential. If you have received this message in error, please notify postmas...@his.co.uk and remove it from your system. Please carry out your own virus check before opening attachments. HISL Limited is a limited company registered in England and Wales. Registered Number: 3202995. VAT number: 729-6256-05. Registered Office: Chestnut Farm, Jill Lane, Sambourne, Redditch B96 6ES ---------------------------------------------------------------------------- --------------