Search in sources :

Example 6 with ComponentFeature

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

the class ClientProxyTest method testNullResponseFromTransprt.

@SuppressWarnings("unchecked")
public void testNullResponseFromTransprt() 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() {

                            public NextAction processRequest(Packet request) {
                                NextAction na = new NextAction();
                                na.returnWith(new Packet());
                                return na;
                            }
                        };
                    }
                };
            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<String>(wsdlURL.toString()));
        fail();
    } catch (Exception e) {
        assertFalse(e instanceof NullPointerException);
        assertTrue(e instanceof WebServiceException);
    }
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) NumbersRequest(com.sun.xml.ws.client.test.NumbersRequest) WebServiceException(jakarta.xml.ws.WebServiceException) Echo(com.sun.xml.ws.client.test.Echo) EchoService(com.sun.xml.ws.client.test.EchoService) URL(java.net.URL) WebServiceException(jakarta.xml.ws.WebServiceException) TransportTubeFactory(com.sun.xml.ws.api.pipe.TransportTubeFactory) ComponentFeature(com.sun.xml.ws.api.ComponentFeature) NextAction(com.sun.xml.ws.api.pipe.NextAction) ClientTubeAssemblerContext(com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext)

Aggregations

ComponentFeature (com.sun.xml.ws.api.ComponentFeature)6 ComponentsFeature (com.sun.xml.ws.api.ComponentsFeature)3 ClientTubeAssemblerContext (com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext)3 TransportTubeFactory (com.sun.xml.ws.api.pipe.TransportTubeFactory)3 BindingID (com.sun.xml.ws.api.BindingID)2 Packet (com.sun.xml.ws.api.message.Packet)2 NextAction (com.sun.xml.ws.api.pipe.NextAction)2 Tube (com.sun.xml.ws.api.pipe.Tube)2 BindingImpl (com.sun.xml.ws.binding.BindingImpl)2 Echo (com.sun.xml.ws.client.test.Echo)2 EchoService (com.sun.xml.ws.client.test.EchoService)2 NumbersRequest (com.sun.xml.ws.client.test.NumbersRequest)2 WebServiceException (jakarta.xml.ws.WebServiceException)2 URL (java.net.URL)2 DatabindingModeFeature (com.oracle.webservices.api.databinding.DatabindingModeFeature)1 ExternalMetadataFeature (com.oracle.webservices.api.databinding.ExternalMetadataFeature)1 WSBinding (com.sun.xml.ws.api.WSBinding)1 ServerTubeAssemblerContext (com.sun.xml.ws.api.pipe.ServerTubeAssemblerContext)1 TubelineAssembler (com.sun.xml.ws.api.pipe.TubelineAssembler)1 TubelineAssemblerFactory (com.sun.xml.ws.api.pipe.TubelineAssemblerFactory)1