Search in sources :

Example 6 with SoapActionCallback

use of org.springframework.ws.soap.client.core.SoapActionCallback in project webservices-axiom by apache.

the class SecureEchoTest method runTest.

@Override
protected void runTest() throws Throwable {
    DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    Document requestDocument = documentBuilder.newDocument();
    Element request = requestDocument.createElementNS("urn:test", "p:Echo");
    request.setTextContent("Hello");
    Document responseDocument = documentBuilder.newDocument();
    context.getBean(WebServiceTemplate.class).sendSourceAndReceiveToResult(new DOMSource(request), new SoapActionCallback("http://www.example.com/echo"), new DOMResult(responseDocument));
    Element response = responseDocument.getDocumentElement();
    assertEquals("urn:test", response.getNamespaceURI());
    assertEquals("Echo", response.getLocalName());
    assertEquals("Hello", response.getTextContent());
}
Also used : DOMSource(javax.xml.transform.dom.DOMSource) SoapActionCallback(org.springframework.ws.soap.client.core.SoapActionCallback) DOMResult(javax.xml.transform.dom.DOMResult) DocumentBuilder(javax.xml.parsers.DocumentBuilder) Element(org.w3c.dom.Element) Document(org.w3c.dom.Document) WebServiceTemplate(org.springframework.ws.client.core.WebServiceTemplate)

Aggregations

SoapActionCallback (org.springframework.ws.soap.client.core.SoapActionCallback)6 Test (org.junit.Test)4 DocumentBuilder (javax.xml.parsers.DocumentBuilder)2 DOMResult (javax.xml.transform.dom.DOMResult)2 DOMSource (javax.xml.transform.dom.DOMSource)2 WebServiceTemplate (org.springframework.ws.client.core.WebServiceTemplate)2 Document (org.w3c.dom.Document)2 Element (org.w3c.dom.Element)2 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1 StreamResult (javax.xml.transform.stream.StreamResult)1 StreamSource (javax.xml.transform.stream.StreamSource)1