Package javax.jws

Examples of javax.jws.WebService


        return clazz.isAnnotationPresent(WebService.class);
    }

    public WebServiceAnnotation getWebServiceAnnotation(Class clazz)
    {
        WebService webService = (WebService) clazz.getAnnotation(WebService.class);
        if (webService != null)
        {
            WebServiceAnnotation annotation = new WebServiceAnnotation();
            annotation.setEndpointInterface(webService.endpointInterface());
            annotation.setName(webService.name());
            annotation.setServiceName(webService.serviceName());
            annotation.setTargetNamespace(webService.targetNamespace());
            annotation.setPortName(webService.portName());
            annotation.setWsdlLocation(webService.wsdlLocation());
           
            return annotation;
        }
        else
        {
View Full Code Here


        NodeList list = msg.getSOAPBody().getChildNodes();
        assertEquals(1, list.getLength());
        Node operationNode = list.item(0);
        assertEquals(objContext.getMethod().getName(), operationNode.getLocalName());
        WebService wsAnnotation = objContext.getMethod().getDeclaringClass().getAnnotation(WebService.class);
        String expectedNameSpace = wsAnnotation.targetNamespace();
        assertTrue(expectedNameSpace.equals(operationNode.getNamespaceURI()));
        assertTrue(operationNode.hasChildNodes());
        assertEquals(arg0, operationNode.getFirstChild().getFirstChild().getNodeValue());
    }
View Full Code Here

        NodeList list = msg.getSOAPBody().getChildNodes();
        assertEquals(1, list.getLength());
        Node operationNode = list.item(0);
        assertEquals(objContext.getMethod().getName() + "Response", operationNode.getLocalName());
       
        WebService wsAnnotation = objContext.getMethod().getDeclaringClass().getAnnotation(WebService.class);
        String expectedNameSpace = wsAnnotation.targetNamespace();
        assertTrue(expectedNameSpace.equals(operationNode.getNamespaceURI()));
       
        assertTrue(operationNode.hasChildNodes());
        assertEquals(arg0, operationNode.getFirstChild().getFirstChild().getNodeValue());
    }
View Full Code Here

                    } else {
                        //TODO: What if the WSDL is RPC-Literal encoded.
                        // We need to get action out of available annotations?
                        //
                       
                        WebService wsAnnotation = method.getDeclaringClass().getAnnotation(WebService.class);
                        WebMethod wmAnnotation = method.getAnnotation(WebMethod.class);
                       
                        action = getAction(wsAnnotation.targetNamespace(),
                                           method,
                                           wmAnnotation.operationName(),
                                           false);
                    }
                       
                } else {
                    ResponseWrapper responseWrapper =
                        method.getAnnotation(ResponseWrapper.class);
                    if (responseWrapper != null) {
                        action = getAction(responseWrapper.targetNamespace(),
                                           method,
                                           responseWrapper.localName(),
                                          false);
                    } else {
                       //RPC-Literal case.
                        WebService wsAnnotation = method.getDeclaringClass().getAnnotation(WebService.class);
                        WebMethod wmAnnotation = method.getAnnotation(WebMethod.class);
                       
                        action = getAction(wsAnnotation.targetNamespace(),
                                           method,
                                           wmAnnotation.operationName(),
                                           false);
                    }
                }
View Full Code Here

       
        targetMethod = Greeter.class.getMethod("sayHi");
        assertNotNull("could not set up target method", targetMethod);
        context.setMethod(targetMethod);

        WebService ws = Greeter.class.getAnnotation(WebService.class);
        assertNotNull(ws);
        serviceName = new QName(ws.targetNamespace(), ws.name());
        initFixture();
    }
View Full Code Here

       
        QName ret = null;
       
        if (isServiceProvider()) {
            if (serviceName == null) {
                WebService ws = (WebService)serviceImplementation.getClass().getAnnotation(WebService.class);
                serviceName = new QName(ws.targetNamespace(), ws.serviceName());
            }
            ret = serviceName;
        }
        return ret;
    }
View Full Code Here

   
    Document getWsdlAsDocument() {
       
        Document doc = null;
        try {
            WebService ws = serviceImplementation.getClass().getAnnotation(WebService.class);
            if (ws != null) {
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                factory.setNamespaceAware(true);
                DocumentBuilder builder = factory.newDocumentBuilder();
                doc = builder.parse(ws.wsdlLocation());
            } else {
                LOG.severe("could not get WebService annotation from " + serviceImplementation);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
View Full Code Here

            Method targetMethod = (Method)context.get(ObjectMessageContext.METHOD_OBJ);
            Class<?> clz = targetMethod.getDeclaringClass();
           
            LOG.fine("invoking service " + clz);
           
            WebService ws = clz.getAnnotation(WebService.class);
            assert ws != null;
            QName interfaceName = new QName(ws.targetNamespace(), ws.name());
           
            MessageExchangeFactory factory = channel.createExchangeFactoryForService(serviceName);
            LOG.fine("create message exchange svc: " + serviceName);
            InOut xchng = factory.createInOutExchange();
           
View Full Code Here

        assertTrue("class " + clz.getName() + " modifier is not public", Modifier
                   .isPublic(clz.getModifiers()));
        assertTrue("class " + clz.getName() + " modifier is interface",
                   Modifier.isInterface(clz.getModifiers()));

        WebService webServiceAnn = AnnotationUtil.getPrivClassAnnotation(clz, WebService.class);
        assertEquals("Greeter", webServiceAnn.name());

        Method method = clz.getMethod("sayHi", new Class[] {});
        WebMethod webMethodAnno = AnnotationUtil.getPrivMethodAnnotation(method, WebMethod.class);
        assertEquals(method.getName() + "()" + " Annotation : WebMethod.operationName ", "sayHi",
                     webMethodAnno.operationName());
View Full Code Here

        }
        checkWebMethodUseClass(clz.getSuperclass());
    }

    private void populateWSDLInfo(Class clazz) {
        WebService webService = AnnotationUtil.getPrivClassAnnotation(clazz, WebService.class);
        if (webService == null) {
            Message message = new Message("SEI_CLASS_NO_WEBSERVICE_ANNOTATED", LOG);
            throw new ToolException(message);

        }
        if (webService.endpointInterface().length() > 0) {
            clazz = AnnotationUtil.loadClass(webService.endpointInterface(), clazz.getClassLoader());
            webService = AnnotationUtil.getPrivClassAnnotation(clazz, WebService.class);
            if (webService == null) {
                Message message = new Message("SEI_INTERFACE_NO_WEBSERVICE_ANNOTATED", LOG);
                throw new ToolException(message);
            }
        }

        String portTypeName = clazz.getSimpleName() + "PortType";
        if (webService.name().length() > 0) {
            portTypeName = webService.name();
        }

        model.setPortTypeName(portTypeName);

        String portName = clazz.getSimpleName() + "Port";

        if (webService.portName().length() > 0) {
            portName = webService.portName();
        } else if (webService.name().length() > 0) {
            portName = webService.name() + "Port";

        }
        model.setPortName(portName);

        String serviceName = clazz.getSimpleName() + "Service";
        if (env.optionSet(ToolConstants.CFG_SERVICENAME)) {
            serviceName = (String)env.get(ToolConstants.CFG_SERVICENAME);
        } else {
            if (webService.serviceName().length() > 0) {
                serviceName = webService.serviceName();
            }
        }
        model.setServiceName(serviceName);

        String packageName = "";
        if (clazz.getPackage() != null) {
            packageName = clazz.getPackage().getName();
        }
        model.setPackageName(packageName);

        String targetNamespace = URIParserUtil.getNamespace(packageName);
        if (env.optionSet(ToolConstants.CFG_TNS)) {
            targetNamespace = (String)env.get(ToolConstants.CFG_TNS);
        } else if (webService.targetNamespace().length() > 0) {
            targetNamespace = webService.targetNamespace();
        } else if (targetNamespace == null) {
            Message message = new Message("SEI_CLASS_HASNO_PACKAGE", LOG);
            throw new ToolException(message);
        }

        model.setTargetNameSpace(targetNamespace);
        String wsdlLocation = webService.wsdlLocation();
        model.setWsdllocation(wsdlLocation);

        javax.jws.soap.SOAPBinding soapBinding = AnnotationUtil
            .getPrivClassAnnotation(clazz, javax.jws.soap.SOAPBinding.class);
        if (soapBinding != null) {
View Full Code Here

TOP

Related Classes of javax.jws.WebService

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.