Java Web Service Class Get getServiceClassSource(String PackageName, String className, boolean stubs)

Here you can find the source of getServiceClassSource(String PackageName, String className, boolean stubs)

Description

get Service Class Source

License

Open Source License

Declaration

public static String getServiceClassSource(String PackageName,
            String className, boolean stubs) 

Method Source Code

//package com.java2s;
/*//  w  ww .j  a  v  a 2s  . c o  m
 * Copyright (c) 2012, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class Main {
    public static String getServiceClassSource(String PackageName,
            String className, boolean stubs) {

        StringBuffer buffer = new StringBuffer();
        if (!PackageName.equalsIgnoreCase("")) {
            buffer.append("package " + PackageName + ";\n");
            buffer.append("\n");
        }
        buffer.append("import javax.jws.WebService;\n");
        /*buffer.append("import javax.jws.WebMethod;\n");
        buffer.append("import javax.jws.WebParam;\n");*/
        buffer.append("\n");
        buffer.append("@WebService\n" + "public interface " + className
                + "{\n\n");
        if (stubs) {
            buffer.append("\t/** This is a sample web service operation */\n");
            buffer.append("\tpublic String hello(String txt);");
            buffer.append("\t\n");
        }
        buffer.append("\n}");
        return buffer.toString();
    }
}

Related

  1. getServiceInterface(Class clazz)
  2. getUrlPatternByWebService(Class beanClass)
  3. getWebServiceClass(Class cls)
  4. hasWebServiceAnnotation(Class clazz)