Package org.jibx.ws.server

Examples of org.jibx.ws.server.ServiceDefinition


                        logger.error("Service definition not found for service " + path + " at " + file);
                        throw new UnavailableException("Service definition not found for service " + path + " at "
                            + file + ". Check configuration of servlet " + servlet.getServletName()
                            + " in WEB-INF/web.xml.");
                    }
                    ServiceDefinition sdef = (ServiceDefinition) ctx.unmarshalDocument(is, null);
                    if (!path.startsWith("/")) {
                        path = "/" + path;
                    }
                    map.put(path, sdef);
View Full Code Here


    private ServiceDefinition getServiceDefinition(HttpServletRequest req) {
        String servicePath = req.getPathInfo();
        if (servicePath == null) {
            servicePath = req.getServletPath();
        }
        ServiceDefinition defn = (ServiceDefinition) m_serviceDefnMap.get(servicePath);
        if (defn == null && logger.isWarnEnabled()) {
            logger.warn("No service definition for service path '" + servicePath + "' based on "
                + (req.getPathInfo() != null ? "path info" : "servlet path") + " of request '" + req.getRequestURI()
                + "'");
        }
View Full Code Here

        return defn;
    }

    /** {@inheritDoc} */
    public Service getServiceInstance(HttpServletRequest req) throws WsException {
        ServiceDefinition sdef = getServiceDefinition(req);
        if (sdef == null) {
            return null;
        }
        ServiceFactory serviceFactory = ProtocolDirectory.getProtocol(sdef.getProtocolName()).getServiceFactory();
        return ServicePool.getInstance(serviceFactory, sdef);
    }
View Full Code Here

    }

    static Service createSoapServiceWithHandler(String handlerMethodName, String handlerId, Class handlerClass)
        throws NoSuchMethodException, JiBXException, WsException {

        ServiceDefinition sdef = getServiceDefinition(handlerMethodName);
        HandlerDefinition hdef = new HandlerDefinition();
        hdef.setClassName(handlerClass.getName());
        sdef.setHandlerDefinitions(Arrays.asList(new HandlerDefinition[] { hdef }));
        sdef.init();

        ServiceFactory serviceFactory = ProtocolDirectory.getProtocol(sdef.getProtocolName()).getServiceFactory();
        return ServicePool.getInstance(serviceFactory, sdef);
    }
View Full Code Here

        OperationDefinition odef = new OperationDefinition();
        odef.setMethodName(serviceMethodName);
        odef.setInputClassName(Person.class.getName());
        odef.setOutputClassName(Customer.class.getName());

        ServiceDefinition sdef = new ServiceDefinition();
        // sdef.setBindingFactory(BindingDirectory.getFactory(Customer.class));
        sdef.setServiceClassName(SoapServiceTestHelper.class.getName());
        sdef.setOperationDefinitions(Arrays.asList(new OperationDefinition[] { odef }));
        sdef.setProtocolName("SOAP1.1");

        return sdef;
    }
View Full Code Here

    }
   
    @Test
    public void givenWsdlFileInServiceDefinition_SoapServiceShouldBeConfiguredWithInputStreamWsdlProvider()
            throws Exception {
        ServiceDefinition sdef = new ServiceDefinition();
        sdef.setOperationDefinitions(Collections.EMPTY_LIST);
        sdef.setWsdlFilepath(WSDL_FILE_PATH);
        Service soapService = SoapProtocol.SOAP1_1.getServiceFactory().createInstance(sdef);
        assertThat(soapService.getWsdlProvider(), instanceOf(InputStreamWsdlProvider.class));
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ((InputStreamWsdlProvider)soapService.getWsdlProvider()).writeWSDL(baos, null);
        String wsdl = FileUtils.readFileToString(new File(WSDL_FILE_PATH));
View Full Code Here

        assertThat(baos.toString(), is(wsdl));
    }

    @Test
    public void givenInvalidWsdlFileInServiceDefinition_SoapServiceShouldThrowWsException() throws Exception {
        ServiceDefinition sdef = new ServiceDefinition();
        sdef.setOperationDefinitions(Collections.EMPTY_LIST);
        sdef.setWsdlFilepath(WSDL_FILE_PATH + "nonexistent");
        try {
            SoapProtocol.SOAP1_1.getServiceFactory().createInstance(sdef);
            Assert.fail("Expected WsException");
        } catch (WsConfigurationException e) {
            assertThat(e.getMessage(), containsString(WSDL_FILE_PATH));
View Full Code Here

    }

    @Test
    public void givenWsdlTransformInServiceDefinition_SoapServiceShouldBeConfiguredWithWsdlAdapter()
            throws Exception {
        ServiceDefinition sdef = new ServiceDefinition();
        sdef.setOperationDefinitions(Collections.EMPTY_LIST);
        sdef.setWsdlFilepath(WSDL_FILE_PATH);
        sdef.setWsdlLocationTransform(true);
        Service soapService = SoapProtocol.SOAP1_1.getServiceFactory().createInstance(sdef);
        assertThat(soapService.getWsdlProvider(), instanceOf(WsdlLocationToRequestUrlAdapter.class));
    }
View Full Code Here

    }

    static Service createSoapService(String serviceMethodName) throws NoSuchMethodException, JiBXException,
            WsException {

        ServiceDefinition sdef = getServiceDefinition(serviceMethodName);
        sdef.init();

        ServiceFactory serviceFactory = ProtocolDirectory.getProtocol(sdef.getProtocolName()).getServiceFactory();
        return ServicePool.getInstance(serviceFactory, sdef);
    }
View Full Code Here

TOP

Related Classes of org.jibx.ws.server.ServiceDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.