the code may be like this:
private static void createServiceXML(String serviceXmlDir, String
serviceName) throws IOException, SAXException, ParserConfigurationException
{
File serviceXML = new File(serviceXmlDir);
if (serviceXML.exists()) {
return;
}
serviceXML.mkdirs();
FileOutputStream serviceos = new FileOutputStream(serviceXmlDir + fs
+ "services.xml");
String servicesXml = "";
String serviceDescXml = "<service name=\"" + serviceName + "\"
targetNamespace=\"http://www.abc.com/webservice\<http://www.abc.com/webservice/>">"
+ "\r\n" +
"<description>Service description for " + serviceName +
"</description>" + "\r\n" +
"<schema
schemaNamespace=\"http://www.abc.com/webservice\"/<http://www.abc.com/webservice/%22/>>"
+ "\r\n";
String parameterDescXml = "<parameter name=\"ServiceClass\">" +
serviceName + "</parameter>" + "\r\n" +
"<parameter name = \"disasbleREST\">" + "true" +
"</parameter>" + "\r\n";
// String attachmentParamXml = "<parameter name = \"enableSwA\">" +
"true" + "</parameter>" + "\r\n";
String attachmentParamXml = "<parameter name = \"enableMTOM\">" +
String.valueOf(isEnabledMTOM) + "</parameter>" + "\r\n" +
"<parameter name = \"enableSwA\">" +
String.valueOf(isEnabledSwA) + "</parameter>" + "\r\n";
String operationDescXml = "<operation name=\"" + OPERATION_NAME +
"\">" + "\r\n" +
"<messageReceiver
class=\"org.apache.axis2.rpc.receivers.RPCMessageReceiver\"/>" + "\r\n" +
"</operation>" + "\r\n" +
"<module ref=\"soapmonitor\"/>" + "\r\n" +
"</service >";
if(isFileType()){
servicesXml = serviceDescXml + parameterDescXml +
attachmentParamXml + operationDescXml;
setFileType(false);
} else {
servicesXml = serviceDescXml + parameterDescXml +
operationDescXml;
}
serviceos.write(servicesXml.getBytes());
serviceos.close();
}
The steps:
1. Get the service class
2. get the service.xml
3. deploy the service
4. call the service
Chinmoy
On Mon, May 25, 2009 at 8:38 PM, Sirasani, Balaji <[email protected]>wrote:
> Create the service.xml at runtime (programatically)…..**
>
>
>
> Can you please share any examples if you have?
>
>
>
> *From:* Chinmoy Chakraborty [mailto:[email protected]]
> *Sent:* Monday, May 25, 2009 8:34 PM
> *To:* [email protected]
> *Subject:* Re: Reading environment variables in services.xml
>
>
>
> Can we define targetnamespace and service name at runtime? i.e by reading
> environment variable is it possible to set targetnamespace and service name
> in services.xml.
>
>
>
>
> -- Yes you can. Create the service.xml at runtime (programatically) and
> deploy the service programatically at runtime..make sure you deploy the
> service before calling it..
>
>
>
> Chinmoy
>
> On Mon, May 25, 2009 at 3:20 PM, Sirasani, Balaji <[email protected]>
> wrote:
>
> Hi All,
>
>
>
> Is there a way to read environment variables in services.xml?
>
>
>
> Can we define targetnamespace and service name at runtime? i.e by reading
> environment variable is it possible to set targetnamespace and service name
> in services.xml.
>
>
>
> And also is there a way to define targetnamespace in build.xml?
>
>
>
> Thanks,
>
> Balaji
>
>
>
>
>