Search in sources :

Example 6 with MessageReplayObserver

use of org.apache.cxf.jaxws.MessageReplayObserver in project cxf by apache.

the class DispatchOpTest method testResolveOperationWithSource.

@Test
public void testResolveOperationWithSource() throws Exception {
    ServiceImpl service = new ServiceImpl(getBus(), getClass().getResource(WSDL_RESOURCE), SERVICE_NAME, null);
    Dispatch<Source> disp = service.createDispatch(PORT_NAME, Source.class, Service.Mode.PAYLOAD);
    disp.getRequestContext().put(MessageContext.WSDL_OPERATION, OP_NAME);
    disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS);
    d.setMessageObserver(new MessageReplayObserver(RESP_RESOURCE));
    BindingOperationVerifier bov = new BindingOperationVerifier();
    ((DispatchImpl<?>) disp).getClient().getOutInterceptors().add(bov);
    Document doc = StaxUtils.read(getResourceAsStream(REQ_RESOURCE));
    DOMSource source = new DOMSource(doc);
    Source res = disp.invoke(source);
    assertNotNull(res);
    BindingOperationInfo boi = bov.getBindingOperationInfo();
    assertNotNull(boi);
    assertEquals(OP_NAME, boi.getName());
}
Also used : DOMSource(javax.xml.transform.dom.DOMSource) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) ServiceImpl(org.apache.cxf.jaxws.ServiceImpl) DispatchImpl(org.apache.cxf.jaxws.DispatchImpl) Document(org.w3c.dom.Document) DOMSource(javax.xml.transform.dom.DOMSource) Source(javax.xml.transform.Source) MessageReplayObserver(org.apache.cxf.jaxws.MessageReplayObserver) Test(org.junit.Test) AbstractJaxWsTest(org.apache.cxf.jaxws.AbstractJaxWsTest)

Example 7 with MessageReplayObserver

use of org.apache.cxf.jaxws.MessageReplayObserver in project cxf by apache.

the class DispatchOpTest method testResolveOperationWithSourceAndWSA.

@Test
public void testResolveOperationWithSourceAndWSA() throws Exception {
    ServiceImpl service = new ServiceImpl(getBus(), getClass().getResource(WSDL_RESOURCE), SERVICE_NAME, null, new AddressingFeature());
    Dispatch<Source> disp = service.createDispatch(PORT_NAME, Source.class, Service.Mode.PAYLOAD);
    disp.getRequestContext().put(MessageContext.WSDL_OPERATION, OP_NAME);
    disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS);
    d.setMessageObserver(new MessageReplayObserver(RESP_RESOURCE));
    BindingOperationVerifier bov = new BindingOperationVerifier();
    ((DispatchImpl<?>) disp).getClient().getOutInterceptors().add(bov);
    Document doc = StaxUtils.read(getResourceAsStream(REQ_RESOURCE));
    DOMSource source = new DOMSource(doc);
    Source res = disp.invoke(source);
    assertNotNull(res);
    BindingOperationInfo boi = bov.getBindingOperationInfo();
    assertNotNull(boi);
    assertEquals(OP_NAME, boi.getName());
}
Also used : DOMSource(javax.xml.transform.dom.DOMSource) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) AddressingFeature(javax.xml.ws.soap.AddressingFeature) ServiceImpl(org.apache.cxf.jaxws.ServiceImpl) DispatchImpl(org.apache.cxf.jaxws.DispatchImpl) Document(org.w3c.dom.Document) DOMSource(javax.xml.transform.dom.DOMSource) Source(javax.xml.transform.Source) MessageReplayObserver(org.apache.cxf.jaxws.MessageReplayObserver) Test(org.junit.Test) AbstractJaxWsTest(org.apache.cxf.jaxws.AbstractJaxWsTest)

Aggregations

AbstractJaxWsTest (org.apache.cxf.jaxws.AbstractJaxWsTest)7 MessageReplayObserver (org.apache.cxf.jaxws.MessageReplayObserver)7 Test (org.junit.Test)7 Source (javax.xml.transform.Source)4 DOMSource (javax.xml.transform.dom.DOMSource)4 ServiceImpl (org.apache.cxf.jaxws.ServiceImpl)4 Document (org.w3c.dom.Document)4 DispatchImpl (org.apache.cxf.jaxws.DispatchImpl)3 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)3 URL (java.net.URL)2 JAXBContext (javax.xml.bind.JAXBContext)2 SOAPService (org.apache.hello_world_soap_http.SOAPService)2 QName (javax.xml.namespace.QName)1 Holder (javax.xml.ws.Holder)1 AddressingFeature (javax.xml.ws.soap.AddressingFeature)1 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)1 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)1 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)1 Destination (org.apache.cxf.transport.Destination)1 SayHi (org.apache.hello_world_soap_http.types.SayHi)1