Search in sources :

Example 1 with TestHeaderImpl

use of org.apache.header_test.TestHeaderImpl in project cxf by apache.

the class HeaderTest method testInvocation.

@Test
public void testInvocation() throws Exception {
    JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean();
    Bus bus = getBus();
    bean.setBus(bus);
    bean.setServiceClass(TestHeaderImpl.class);
    Service service = bean.create();
    OperationInfo op = service.getServiceInfos().get(0).getInterface().getOperation(new QName(service.getName().getNamespaceURI(), "testHeader5"));
    assertNotNull(op);
    List<MessagePartInfo> parts = op.getInput().getMessageParts();
    assertEquals(1, parts.size());
    MessagePartInfo part = parts.get(0);
    assertNotNull(part.getTypeClass());
    assertEquals(TestHeader5.class, part.getTypeClass());
    parts = op.getOutput().getMessageParts();
    assertEquals(2, parts.size());
    part = parts.get(1);
    assertNotNull(part.getTypeClass());
    assertEquals(TestHeader5ResponseBody.class, part.getTypeClass());
    part = parts.get(0);
    assertNotNull(part.getTypeClass());
    assertEquals(TestHeader5.class, part.getTypeClass());
    // part = parts.get(1);
    // assertNotNull(part.getTypeClass());
    ServerFactoryBean svr = new ServerFactoryBean();
    svr.setBus(bus);
    svr.setServiceFactory(bean);
    svr.setServiceBean(new TestHeaderImpl());
    svr.setAddress("http://localhost:9104/SoapHeaderContext/SoapHeaderPort");
    svr.setBindingConfig(new JaxWsSoapBindingConfiguration(bean));
    svr.create();
    Node response = invoke("http://localhost:9104/SoapHeaderContext/SoapHeaderPort", LocalTransportFactory.TRANSPORT_ID, "testHeader5.xml");
    assertNotNull(response);
    assertNoFault(response);
    addNamespace("t", "http://apache.org/header_test/types");
    assertValid("//s:Header/t:testHeader5", response);
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) Bus(org.apache.cxf.Bus) JaxWsServiceFactoryBean(org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean) QName(javax.xml.namespace.QName) Node(org.w3c.dom.Node) Service(org.apache.cxf.service.Service) ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) JaxWsSoapBindingConfiguration(org.apache.cxf.jaxws.binding.soap.JaxWsSoapBindingConfiguration) MessagePartInfo(org.apache.cxf.service.model.MessagePartInfo) TestHeaderImpl(org.apache.header_test.TestHeaderImpl) Test(org.junit.Test)

Example 2 with TestHeaderImpl

use of org.apache.header_test.TestHeaderImpl in project cxf by apache.

the class HeaderClientServerTest method setUp.

@Before
public void setUp() throws Exception {
    BusFactory.setDefaultBus(getBus());
    Object implementor = new TestHeaderImpl();
    String address = "http://localhost:9104/SoapHeaderContext/SoapHeaderPort";
    endpoint = (EndpointImpl) Endpoint.publish(address, implementor);
    implementor = new TestRPCHeaderImpl();
    address = "http://localhost:9104/SoapHeaderRPCContext/SoapHeaderRPCPort";
    rpcEndpoint = (EndpointImpl) Endpoint.publish(address, implementor);
}
Also used : TestRPCHeaderImpl(org.apache.header_test.rpc.TestRPCHeaderImpl) TestHeaderImpl(org.apache.header_test.TestHeaderImpl) Before(org.junit.Before)

Aggregations

TestHeaderImpl (org.apache.header_test.TestHeaderImpl)2 QName (javax.xml.namespace.QName)1 Bus (org.apache.cxf.Bus)1 ServerFactoryBean (org.apache.cxf.frontend.ServerFactoryBean)1 JaxWsSoapBindingConfiguration (org.apache.cxf.jaxws.binding.soap.JaxWsSoapBindingConfiguration)1 JaxWsServiceFactoryBean (org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean)1 Service (org.apache.cxf.service.Service)1 MessagePartInfo (org.apache.cxf.service.model.MessagePartInfo)1 OperationInfo (org.apache.cxf.service.model.OperationInfo)1 TestRPCHeaderImpl (org.apache.header_test.rpc.TestRPCHeaderImpl)1 Before (org.junit.Before)1 Test (org.junit.Test)1 Node (org.w3c.dom.Node)1