Search in sources :

Example 1 with DoubleItPortType2

use of org.example.contract.doubleit.DoubleItPortType2 in project cxf by apache.

the class X509TokenTest method testKeyIdentifier2.

@org.junit.Test
public void testKeyIdentifier2() throws Exception {
    if (test.isStreaming()) {
        return;
    }
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = X509TokenTest.class.getResource("client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL wsdl = X509TokenTest.class.getResource("DoubleItOperations.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItKeyIdentifierPort2");
    DoubleItPortType2 x509Port = service.getPort(portQName, DoubleItPortType2.class);
    updateAddressPort(x509Port, PORT);
    List<Header> headers = new ArrayList<>();
    Header dummyHeader = new Header(new QName("uri:org.apache.cxf", "dummy"), "dummy-header", new JAXBDataBinding(String.class));
    headers.add(dummyHeader);
    ((BindingProvider) x509Port).getRequestContext().put(Header.HEADER_LIST, headers);
    int response = x509Port.doubleIt(25);
    assertEquals(50, response);
    int response2 = x509Port.doubleIt2(15);
    assertEquals(30, response2);
    ((java.io.Closeable) x509Port).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) DoubleItPortType2(org.example.contract.doubleit.DoubleItPortType2) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) Service(javax.xml.ws.Service) URL(java.net.URL) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) Header(org.apache.cxf.headers.Header) JAXBDataBinding(org.apache.cxf.jaxb.JAXBDataBinding)

Aggregations

URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 QName (javax.xml.namespace.QName)1 Service (javax.xml.ws.Service)1 Bus (org.apache.cxf.Bus)1 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)1 Header (org.apache.cxf.headers.Header)1 JAXBDataBinding (org.apache.cxf.jaxb.JAXBDataBinding)1 DoubleItPortType2 (org.example.contract.doubleit.DoubleItPortType2)1