Search in sources :

Example 1 with ClientTubeAssemblerContext

use of com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext in project metro-jax-ws by eclipse-ee4j.

the class TubelineAssemblerFactoryImplTest method testAlternateConfigFileName.

public void testAlternateConfigFileName() throws Exception {
    final BindingID bindingId = BindingID.SOAP11_HTTP;
    final String ALTERNATE_FILE_NAME = "tubes-config/jaxws-tubes-alternate.xml";
    final Container container = new Container() {

        public <S> S getSPI(Class<S> spiType) {
            if (spiType.isAssignableFrom(MetroConfigName.class)) {
                return spiType.cast(new MetroConfigName() {

                    @Override
                    public String getDefaultFileName() {
                        return ALTERNATE_FILE_NAME;
                    }

                    @Override
                    public String getAppFileName() {
                        return ALTERNATE_FILE_NAME;
                    }
                });
            } else if (spiType.isAssignableFrom(ResourceLoader.class)) {
                return spiType.cast(new TestResourceLoader());
            }
            return null;
        }
    };
    final ClientTubeAssemblerContext jaxwsContext = getClientContext(bindingId, container);
    MetroTubelineAssembler assembler = (MetroTubelineAssembler) getAssembler(bindingId);
    TubelineAssemblyController tubelineAssemblyController = assembler.getTubelineAssemblyController();
    DefaultClientTubelineAssemblyContext context = new DefaultClientTubelineAssemblyContext(jaxwsContext);
    Collection<TubeCreator> tubeCreators = tubelineAssemblyController.getTubeCreators(context);
    assertEquals(2, tubeCreators.size());
}
Also used : ResourceLoader(com.sun.xml.ws.api.ResourceLoader) BindingID(com.sun.xml.ws.api.BindingID) Container(com.sun.xml.ws.api.server.Container) ClientTubeAssemblerContext(com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext)

Example 2 with ClientTubeAssemblerContext

use of com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext in project metro-jax-ws by eclipse-ee4j.

the class TubelineAssemblerFactoryImplTest method testCreateDispatchClientNoConfig.

/**
 * Test client creation with parameters that correspond to a dispatch client
 * with no wsit-client.xml and with no WSDL.
 */
public void testCreateDispatchClientNoConfig() throws Exception {
    final BindingID bindingId = BindingID.SOAP11_HTTP;
    final Container container = MockupMetroConfigLoader.createMockupContainer("tubes-config/jaxws-tubes-default.xml");
    final ClientTubeAssemblerContext context = getClientContext(bindingId, container);
    final Tube tubeline = getAssembler(bindingId).createClient(context);
    assertNotNull(tubeline);
}
Also used : Container(com.sun.xml.ws.api.server.Container) Tube(com.sun.xml.ws.api.pipe.Tube) BindingID(com.sun.xml.ws.api.BindingID) ClientTubeAssemblerContext(com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext)

Example 3 with ClientTubeAssemblerContext

use of com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext in project metro-jax-ws by eclipse-ee4j.

the class Stub method createPipeline.

/**
 * Creates a new pipeline for the given port name.
 */
private Tube createPipeline(WSPortInfo portInfo, WSBinding binding) {
    // Check all required WSDL extensions are understood
    checkAllWSDLExtensionsUnderstood(portInfo, binding);
    SEIModel seiModel = null;
    Class sei = null;
    if (portInfo instanceof SEIPortInfo) {
        SEIPortInfo sp = (SEIPortInfo) portInfo;
        seiModel = sp.model;
        sei = sp.sei;
    }
    BindingID bindingId = portInfo.getBindingId();
    TubelineAssembler assembler = TubelineAssemblerFactory.create(Thread.currentThread().getContextClassLoader(), bindingId, owner.getContainer());
    if (assembler == null) {
        // TODO: i18n
        throw new WebServiceException("Unable to process bindingID=" + bindingId);
    }
    return assembler.createClient(new ClientTubeAssemblerContext(portInfo.getEndpointAddress(), portInfo.getPort(), this, binding, owner.getContainer(), ((BindingImpl) binding).createCodec(), seiModel, sei));
}
Also used : SEIModel(com.sun.xml.ws.api.model.SEIModel) BindingImpl(com.sun.xml.ws.binding.BindingImpl) WebServiceException(jakarta.xml.ws.WebServiceException) TubelineAssembler(com.sun.xml.ws.api.pipe.TubelineAssembler) BindingID(com.sun.xml.ws.api.BindingID) ClientTubeAssemblerContext(com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext)

Example 4 with ClientTubeAssemblerContext

use of com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext in project metro-jax-ws by eclipse-ee4j.

the class SDODatabindingTestBase method invmSetup.

protected WebServiceFeature[] invmSetup(final URL wsdlURL, final Class sei, final Class seb, final QName serviceName, final QName portName) {
    DatabindingModeFeature dbmf = new DatabindingModeFeature("eclipselink.sdo");
    Class implementorClass = seb;
    boolean handlersSetInDD = false;
    Container container = Container.NONE;
    Map<String, SDDocumentSource> docs = new HashMap<String, SDDocumentSource>();
    SDDocumentSource primaryWSDL = SDDocumentSource.create(wsdlURL);
    docs.put(wsdlURL.toString(), primaryWSDL);
    ExternalMetadataFeature exm = ExternalMetadataFeature.builder().setReader(new com.sun.xml.ws.model.ReflectAnnotationReader() {

        public <A extends Annotation> A getAnnotation(final Class<A> annType, final Class<?> cls) {
            if (WebService.class.equals(annType)) {
                final WebService ws = cls.getAnnotation(WebService.class);
                return (A) new jakarta.jws.WebService() {

                    public Class<? extends Annotation> annotationType() {
                        return WebService.class;
                    }

                    @Override
                    public String endpointInterface() {
                        return sei.getName();
                    }

                    @Override
                    public String name() {
                        return (ws != null) ? ws.name() : null;
                    }

                    @Override
                    public String portName() {
                        return (ws != null) ? ws.portName() : null;
                    }

                    @Override
                    public String serviceName() {
                        return (ws != null) ? ws.serviceName() : null;
                    }

                    @Override
                    public String targetNamespace() {
                        return (ws != null) ? ws.targetNamespace() : null;
                    }

                    @Override
                    public String wsdlLocation() {
                        return (ws != null) ? ws.wsdlLocation() : null;
                    }
                };
            }
            return cls.getAnnotation(annType);
        }
    }).build();
    BindingID bindingID = BindingID.parse(implementorClass);
    WSBinding binding = bindingID.createBinding(dbmf, exm);
    final WSEndpoint<?> endpoint = WSEndpoint.create(implementorClass, !handlersSetInDD, null, serviceName, portName, container, binding, primaryWSDL, docs.values(), XmlUtil.createEntityResolver(null), false);
    ComponentFeature cf = new ComponentFeature(new com.sun.xml.ws.api.Component() {

        public <S> S getSPI(Class<S> spiType) {
            if (TransportTubeFactory.class.equals(spiType))
                return (S) new TransportTubeFactory() {

                    public Tube doCreate(ClientTubeAssemblerContext context) {
                        return new InVmTransportTube(context.getCodec(), context.getBinding(), wsdlURL, endpoint);
                    }
                };
            return null;
        }
    });
    WebServiceFeature[] f = { dbmf, cf };
    return f;
}
Also used : WSBinding(com.sun.xml.ws.api.WSBinding) Tube(com.sun.xml.ws.api.pipe.Tube) HashMap(java.util.HashMap) WebService(jakarta.jws.WebService) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) BindingID(com.sun.xml.ws.api.BindingID) TransportTubeFactory(com.sun.xml.ws.api.pipe.TransportTubeFactory) Container(com.sun.xml.ws.api.server.Container) SDDocumentSource(com.sun.xml.ws.api.server.SDDocumentSource) Annotation(java.lang.annotation.Annotation) ExternalMetadataFeature(com.oracle.webservices.api.databinding.ExternalMetadataFeature) WebService(jakarta.jws.WebService) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) ComponentFeature(com.sun.xml.ws.api.ComponentFeature) ClientTubeAssemblerContext(com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext)

Example 5 with ClientTubeAssemblerContext

use of com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext in project metro-jax-ws by eclipse-ee4j.

the class NonAnonymousResponseProcessor method process.

/**
 * Send a response to a non-anonymous address. Also closes the transport back channel
 * of {@link Packet} if it's not closed already.
 *
 * @param packet
 *      The response from our server, which will be delivered to the destination.
 * @return The response packet that should be used to complete the tubeline response processing
 */
public Packet process(Packet packet) {
    Fiber.CompletionCallback fiberCallback = null;
    Fiber currentFiber = Fiber.getCurrentIfSet();
    if (currentFiber != null) {
        // Link completion of the current fiber to the new fiber that will
        // deliver the async response. This allows access to the response
        // packet that may be generated by sending a new message for the
        // current async response.
        final Fiber.CompletionCallback currentFiberCallback = currentFiber.getCompletionCallback();
        if (currentFiberCallback != null) {
            fiberCallback = new Fiber.CompletionCallback() {

                public void onCompletion(@NotNull Packet response) {
                    currentFiberCallback.onCompletion(response);
                }

                public void onCompletion(@NotNull Throwable error) {
                    currentFiberCallback.onCompletion(error);
                }
            };
            currentFiber.setCompletionCallback(null);
        }
    }
    // we need to assemble a pipeline to talk to this endpoint.
    WSEndpoint<?> endpoint = packet.endpoint;
    WSBinding binding = endpoint.getBinding();
    Tube transport = TransportTubeFactory.create(Thread.currentThread().getContextClassLoader(), new ClientTubeAssemblerContext(packet.endpointAddress, endpoint.getPort(), (WSService) null, binding, endpoint.getContainer(), ((BindingImpl) binding).createCodec(), null, null));
    Fiber fiber = endpoint.getEngine().createFiber();
    fiber.start(transport, packet, fiberCallback);
    // then we'll proceed the rest like one-way.
    Packet copy = packet.copy(false);
    copy.endpointAddress = null;
    return copy;
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) WSBinding(com.sun.xml.ws.api.WSBinding) BindingImpl(com.sun.xml.ws.binding.BindingImpl) Tube(com.sun.xml.ws.api.pipe.Tube) WSService(com.sun.xml.ws.api.WSService) Fiber(com.sun.xml.ws.api.pipe.Fiber) ClientTubeAssemblerContext(com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext)

Aggregations

ClientTubeAssemblerContext (com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext)9 BindingID (com.sun.xml.ws.api.BindingID)6 WSBinding (com.sun.xml.ws.api.WSBinding)4 Tube (com.sun.xml.ws.api.pipe.Tube)4 Container (com.sun.xml.ws.api.server.Container)4 ComponentFeature (com.sun.xml.ws.api.ComponentFeature)3 Packet (com.sun.xml.ws.api.message.Packet)3 TransportTubeFactory (com.sun.xml.ws.api.pipe.TransportTubeFactory)3 WebServiceException (jakarta.xml.ws.WebServiceException)3 URL (java.net.URL)3 Component (com.sun.xml.ws.api.Component)2 EndpointAddress (com.sun.xml.ws.api.EndpointAddress)2 WSService (com.sun.xml.ws.api.WSService)2 WSEndpointReference (com.sun.xml.ws.api.addressing.WSEndpointReference)2 WSPortInfo (com.sun.xml.ws.api.client.WSPortInfo)2 Header (com.sun.xml.ws.api.message.Header)2 WSDLPort (com.sun.xml.ws.api.model.wsdl.WSDLPort)2 NextAction (com.sun.xml.ws.api.pipe.NextAction)2 TubelineAssembler (com.sun.xml.ws.api.pipe.TubelineAssembler)2 BindingImpl (com.sun.xml.ws.binding.BindingImpl)2