Search in sources :

Example 81 with Conduit

use of org.apache.cxf.transport.Conduit in project cxf by apache.

the class ProxyTest method testRMClientConstruction.

@Test
public void testRMClientConstruction() {
    Proxy proxy = new Proxy(rme);
    Bus bus = control.createMock(Bus.class);
    EasyMock.expect(bus.getExtension(WSAddressingFeatureApplier.class)).andReturn(new WSAddressingFeatureApplier() {

        @Override
        public void initializeProvider(WSAddressingFeature feature, InterceptorProvider provider, Bus bus) {
        }
    }).anyTimes();
    Endpoint endpoint = control.createMock(Endpoint.class);
    Conduit conduit = control.createMock(Conduit.class);
    org.apache.cxf.ws.addressing.EndpointReferenceType address = control.createMock(org.apache.cxf.ws.addressing.EndpointReferenceType.class);
    control.replay();
    assertNotNull(proxy.createClient(bus, endpoint, ProtocolVariation.RM10WSA200408, conduit, address));
}
Also used : Bus(org.apache.cxf.Bus) WSAddressingFeature(org.apache.cxf.ws.addressing.WSAddressingFeature) Endpoint(org.apache.cxf.endpoint.Endpoint) EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) WSAddressingFeatureApplier(org.apache.cxf.ws.addressing.WSAddressingFeature.WSAddressingFeatureApplier) Conduit(org.apache.cxf.transport.Conduit) InterceptorProvider(org.apache.cxf.interceptor.InterceptorProvider) Test(org.junit.Test)

Example 82 with Conduit

use of org.apache.cxf.transport.Conduit in project cxf by apache.

the class RMManagerTest method testRecoverReliableEndpoint.

@Test
public void testRecoverReliableEndpoint() {
    manager = new RMManager();
    Endpoint endpoint = control.createMock(Endpoint.class);
    Conduit conduit = control.createMock(Conduit.class);
    control.replay();
    manager.recoverReliableEndpoint(endpoint, conduit);
    control.verify();
    control.reset();
    RMStore store = control.createMock(RMStore.class);
    manager.setStore(store);
    control.replay();
    manager.recoverReliableEndpoint(endpoint, conduit);
    control.verify();
}
Also used : Endpoint(org.apache.cxf.endpoint.Endpoint) Conduit(org.apache.cxf.transport.Conduit) RMStore(org.apache.cxf.ws.rm.persistence.RMStore) Test(org.junit.Test)

Example 83 with Conduit

use of org.apache.cxf.transport.Conduit in project jbossws-cxf by jbossws.

the class SOAPConnectionImpl method call.

@Override
public SOAPMessage call(SOAPMessage msgOut, Object addressObject) throws SOAPException {
    checkClosed();
    String address = getAddress(addressObject);
    ConduitInitiator ci = getConduitInitiator(address);
    // create a new Message and Exchange
    EndpointInfo info = new EndpointInfo();
    info.setAddress(address);
    Message outMessage = new MessageImpl();
    Exchange exch = new ExchangeImpl();
    outMessage.setExchange(exch);
    // JBWS-3945
    exch.put("org.apache.cxf.transport.process_fault_on_http_400", true);
    // sent SOAPMessage
    try {
        // TODO verify bus
        final Conduit c = ci.getConduit(info, BusFactory.getThreadDefaultBus(false));
        if (msgOut.saveRequired()) {
            msgOut.saveChanges();
        }
        Map<String, List<String>> outHeaders = new HashMap<String, List<String>>();
        for (Iterator<?> it = msgOut.getMimeHeaders().getAllHeaders(); it.hasNext(); ) {
            MimeHeader mimeHeader = (MimeHeader) it.next();
            if ("Content-Type".equals(mimeHeader.getName())) {
                outMessage.put(Message.CONTENT_TYPE, mimeHeader.getValue());
            }
            // disable the chunked encoding if requested
            if ("Transfer-Encoding".equals(mimeHeader.getName()) && "disabled".equals(mimeHeader.getValue()) && c instanceof HTTPConduit) {
                ((HTTPConduit) c).getClient().setAllowChunking(false);
                continue;
            }
            List<String> values = outHeaders.get(mimeHeader.getName());
            if (values == null) {
                values = new ArrayList<String>();
                outHeaders.put(mimeHeader.getName(), values);
            }
            values.add(mimeHeader.getValue());
        }
        outMessage.put(Message.HTTP_REQUEST_METHOD, "POST");
        outMessage.put(Message.PROTOCOL_HEADERS, outHeaders);
        c.prepare(outMessage);
        OutputStream outs = outMessage.getContent(OutputStream.class);
        msgOut.writeTo(outs);
        c.setMessageObserver(createMessageObserver(c));
        c.close(outMessage);
    } catch (Exception ex) {
        throw MESSAGES.soapMessageCouldNotBeSent(ex);
    }
    // read SOAPMessage
    return readSoapMessage(exch);
}
Also used : Message(org.apache.cxf.message.Message) SOAPMessage(javax.xml.soap.SOAPMessage) HashMap(java.util.HashMap) OutputStream(java.io.OutputStream) LoadingByteArrayOutputStream(org.apache.cxf.helpers.LoadingByteArrayOutputStream) SOAPException(javax.xml.soap.SOAPException) IOException(java.io.IOException) Exchange(org.apache.cxf.message.Exchange) HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Conduit(org.apache.cxf.transport.Conduit) HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) MimeHeader(javax.xml.soap.MimeHeader) ConduitInitiator(org.apache.cxf.transport.ConduitInitiator) ArrayList(java.util.ArrayList) List(java.util.List) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl)

Aggregations

Conduit (org.apache.cxf.transport.Conduit)83 Test (org.junit.Test)36 Message (org.apache.cxf.message.Message)35 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)30 Exchange (org.apache.cxf.message.Exchange)28 IOException (java.io.IOException)18 MessageImpl (org.apache.cxf.message.MessageImpl)17 Endpoint (org.apache.cxf.endpoint.Endpoint)16 ExchangeImpl (org.apache.cxf.message.ExchangeImpl)13 MessageObserver (org.apache.cxf.transport.MessageObserver)12 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)12 OutputStream (java.io.OutputStream)11 Bus (org.apache.cxf.Bus)11 Destination (org.apache.cxf.transport.Destination)11 ConduitInitiator (org.apache.cxf.transport.ConduitInitiator)10 InputStream (java.io.InputStream)9 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)9 ConduitInitiatorManager (org.apache.cxf.transport.ConduitInitiatorManager)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7 ByteArrayInputStream (java.io.ByteArrayInputStream)6