Search in sources :

Example 11 with XMLService

use of org.apache.hello_world_xml_http.wrapped.XMLService in project cxf by apache.

the class DispatchHandlerInvocationTest method testInvokeWithDOMSourcPayloadModeXMLBinding.

@Test
public void testInvokeWithDOMSourcPayloadModeXMLBinding() throws Exception {
    URL wsdl = getClass().getResource("/wsdl/addNumbers.wsdl");
    assertNotNull(wsdl);
    XMLService service = new XMLService();
    assertNotNull(service);
    Dispatch<DOMSource> disp = service.createDispatch(portNameXML, DOMSource.class, Mode.PAYLOAD);
    setAddress(disp, addNumbersAddress);
    TestHandlerXMLBinding handler = new TestHandlerXMLBinding();
    addHandlersProgrammatically(disp, handler);
    InputStream is = getClass().getResourceAsStream("/messages/XML_GreetMeDocLiteralReq.xml");
    MessageFactory factory = MessageFactory.newInstance();
    SOAPMessage soapReq = factory.createMessage(null, is);
    DOMSource domReqMessage = new DOMSource(soapReq.getSOAPPart());
    DOMSource response = disp.invoke(domReqMessage);
    assertNotNull(response);
}
Also used : DOMSource(javax.xml.transform.dom.DOMSource) MessageFactory(javax.xml.soap.MessageFactory) InputStream(java.io.InputStream) XMLService(org.apache.hello_world_xml_http.wrapped.XMLService) SOAPMessage(javax.xml.soap.SOAPMessage) URL(java.net.URL) Test(org.junit.Test)

Aggregations

XMLService (org.apache.hello_world_xml_http.wrapped.XMLService)11 Test (org.junit.Test)10 URL (java.net.URL)9 InputStream (java.io.InputStream)5 DOMSource (javax.xml.transform.dom.DOMSource)5 JAXBContext (javax.xml.bind.JAXBContext)3 Document (org.w3c.dom.Document)3 DataSource (javax.activation.DataSource)2 URLDataSource (javax.activation.URLDataSource)2 MessageFactory (javax.xml.soap.MessageFactory)2 SOAPMessage (javax.xml.soap.SOAPMessage)2 Service (javax.xml.ws.Service)2 Node (org.w3c.dom.Node)2 File (java.io.File)1 StringReader (java.io.StringReader)1 Source (javax.xml.transform.Source)1 StreamSource (javax.xml.transform.stream.StreamSource)1 WebServiceException (javax.xml.ws.WebServiceException)1 Greeter (org.apache.hello_world_xml_http.wrapped.Greeter)1 PingMeFault (org.apache.hello_world_xml_http.wrapped.PingMeFault)1