Search in sources :

Example 1 with TubelineAssembler

use of com.sun.xml.ws.api.pipe.TubelineAssembler 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 2 with TubelineAssembler

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

the class ClientProxyTest method testNullResponseFromTube.

@SuppressWarnings("unchecked")
public void testNullResponseFromTube() throws Exception {
    URL wsdlURL = Thread.currentThread().getContextClassLoader().getResource("etc/EchoService.wsdl");
    EchoService srv = new EchoService(wsdlURL, 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 EchoTube();
                    }
                };
            if (TubelineAssemblerFactory.class.equals(spiType))
                return (S) new TubelineAssemblerFactory() {

                    public TubelineAssembler doCreate(BindingID bindingId) {
                        return new TubelineAssembler() {

                            public Tube createClient(ClientTubeAssemblerContext context) {
                                final Tube head = context.createTransportTube();
                                return new EchoTube() {

                                    public NextAction processRequest(Packet request) {
                                        NextAction na = new NextAction();
                                        na.invoke(head, request);
                                        return na;
                                    }

                                    public NextAction processResponse(Packet response) {
                                        NextAction na = new NextAction();
                                        na.returnWith(new Packet());
                                        return na;
                                    }
                                };
                            }

                            public Tube createServer(ServerTubeAssemblerContext context) {
                                return null;
                            }
                        };
                    }
                };
            return null;
        }
    }));
    Echo echo = srv.getEchoPort();
    try {
        int res = echo.add(new NumbersRequest());
        fail();
    } catch (Exception e) {
        assertFalse(e instanceof NullPointerException);
        assertTrue(e instanceof WebServiceException);
    }
    try {
        echo.echoString(new Holder(wsdlURL.toString()));
        fail();
    } catch (Exception e) {
        assertFalse(e instanceof NullPointerException);
        assertTrue(e instanceof WebServiceException);
    }
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) ServerTubeAssemblerContext(com.sun.xml.ws.api.pipe.ServerTubeAssemblerContext) NumbersRequest(com.sun.xml.ws.client.test.NumbersRequest) Tube(com.sun.xml.ws.api.pipe.Tube) WebServiceException(jakarta.xml.ws.WebServiceException) Echo(com.sun.xml.ws.client.test.Echo) EchoService(com.sun.xml.ws.client.test.EchoService) Holder(jakarta.xml.ws.Holder) TubelineAssembler(com.sun.xml.ws.api.pipe.TubelineAssembler) BindingID(com.sun.xml.ws.api.BindingID) URL(java.net.URL) WebServiceException(jakarta.xml.ws.WebServiceException) TransportTubeFactory(com.sun.xml.ws.api.pipe.TransportTubeFactory) TubelineAssemblerFactory(com.sun.xml.ws.api.pipe.TubelineAssemblerFactory) ComponentFeature(com.sun.xml.ws.api.ComponentFeature) NextAction(com.sun.xml.ws.api.pipe.NextAction) ClientTubeAssemblerContext(com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext)

Aggregations

BindingID (com.sun.xml.ws.api.BindingID)2 ClientTubeAssemblerContext (com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext)2 TubelineAssembler (com.sun.xml.ws.api.pipe.TubelineAssembler)2 WebServiceException (jakarta.xml.ws.WebServiceException)2 ComponentFeature (com.sun.xml.ws.api.ComponentFeature)1 Packet (com.sun.xml.ws.api.message.Packet)1 SEIModel (com.sun.xml.ws.api.model.SEIModel)1 NextAction (com.sun.xml.ws.api.pipe.NextAction)1 ServerTubeAssemblerContext (com.sun.xml.ws.api.pipe.ServerTubeAssemblerContext)1 TransportTubeFactory (com.sun.xml.ws.api.pipe.TransportTubeFactory)1 Tube (com.sun.xml.ws.api.pipe.Tube)1 TubelineAssemblerFactory (com.sun.xml.ws.api.pipe.TubelineAssemblerFactory)1 BindingImpl (com.sun.xml.ws.binding.BindingImpl)1 Echo (com.sun.xml.ws.client.test.Echo)1 EchoService (com.sun.xml.ws.client.test.EchoService)1 NumbersRequest (com.sun.xml.ws.client.test.NumbersRequest)1 Holder (jakarta.xml.ws.Holder)1 URL (java.net.URL)1