views:

26

answers:

0

I am using a dispatch client to access a web service. All my params are correct, there are no errors and, examining the response with Wireshark, I can definitely see that the correct response is received at the network layer. But at the java application layer, my response Source is empty.

public void testDispatch(QName serviceName, QName portName, String endpointAddress, String action) throws Exception {

    Service service = Service.create(serviceName);
    service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);

    String requestXml = buildRequestXml();

    Dispatch<Source> dispatch = service.createDispatch(portName, Source.class, Service.Mode.MESSAGE);
    dispatch.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, action);

    Source request = new StreamSource(new StringReader(requestXml));
    Source response = dispatch.invoke(request);

    Transformer copier = TransformerFactory.newInstance().newTransformer();
    copier.transform(response, new StreamResult(System.out)); 

}

I tried to transform to a DOMResult, same thing, an empty root node. Any ideas?