1 package org.apache.axis.tool.core; 2 3 import java.io.File ; 4 import java.io.FileWriter ; 5 import java.util.ArrayList ; 6 7 22 23 public class ServiceFileCreator { 24 public File createServiceFile(String providerClassName,String serviceClass,ArrayList methodList) throws Exception { 25 26 27 String content = this.getFileString(providerClassName,serviceClass,methodList); 28 File serviceFile = new File ("service.xml"); 29 30 FileWriter fileWriter = new FileWriter (serviceFile); 31 fileWriter.write(content); 32 fileWriter.flush(); 33 34 return serviceFile; 35 36 37 38 39 } 40 41 private String getFileString(String providerClassName,String serviceClass,ArrayList methodList){ 42 String str = "<service provider=\"" + 43 providerClassName + "\" >" + 44 " <java:implementation class=\"" + 45 serviceClass + "\" " + 46 "xmlns:java=\"http://ws.apache.org/axis2/deployment/java\"/>\n" ; 47 for (int i = 0; i < methodList.size(); i++) { 48 str = str + " <operation name=\"" + 49 methodList.get(i).toString() + 50 "\" qname=\"" + 51 methodList.get(i).toString() + 52 "\" >\n"; 53 54 } 55 str = str + "</service>"; 56 return str; 57 } 58 59 } 60 | Popular Tags |