Hi
I was wondering if anyone tried programmatic deployment of Axis2 services
without say creating an aar file. I have Axis2 deployed as a web module
inside my application ear file. Its supposed to run on any app server. I am
trying to use the code below [which will be called at startup of the server]
to deploy a service in Axis2.

I am using the axis2 admin console to see if the service appears - but I
dont see it in the available services and if I try to send a message to it -
it returns with "service not found" error. I have the AxisServlet deployed
in my web.xml but I didnt set any axis2.xml.path or axis2.repository.path.
Not sure what else I need to do to get this working.

If try the aar way - the same service works great. Its only when I try to go
without aar I have this issue.

public void deployWebService(String serviceName, String operation) throws
AxisFault
{
       AxisServiceGroup serviceGroup;
  AxisConfiguration axis2Config;
  String axisConfigFile = "axis2.xml";
  ConfigurationContext configContext;
 System.out.println("In deployyyyyyyyyyyyyyyyyyyyyyyyyy");
 try
 {
  if (configContext == null)
  {
   configContext = ConfigurationContextFactory
    .createConfigurationContextFromFileSystem("C:\\deployment\\axis2",
"C:\\deployment\\axis2\\axis2.xml");
   axis2Config = configContext.getAxisConfiguration();
  }
 }
 catch (AxisFault e)
 {
  e.printStackTrace();
 }


 if (serviceGroup == null)
 {
  serviceGroup = new AxisServiceGroup();
 }
 AxisService axisService = new AxisService(serviceName);
 axisService.setClientSide(false);
 axisService.setParent(serviceGroup);

 AxisOperation axisOp = AxisOperationFactory.getAxisOperation(
WSDLConstants.MEP_CONSTANT_IN_OUT);
 axisOp.setName(new QName(operation));
 MessageReceiver messageReceiver = new RawXMLINOutMessageReceiver();
 axisOp.setMessageReceiver(messageReceiver);
 axisOp.setSoapAction("urn:"+operation);
 PhasesInfo pinfo = axis2Config.getPhasesInfo();
 pinfo.setOperationPhases(axisOp);
 axisService.addOperation(axisOp);

 Parameter param1 = new Parameter(WSConstants.PARAM_SERVICE_CLASS,
WSConstants.STANDARD_SERVICE);
 axisService.addParameter(param1);

 Parameter param2 = new Parameter(WSConstants.MAX_SERVICE, serviceName);
 axisService.addParameter(param2);

 Parameter param3 = new Parameter(WSConstants.PARAM_QUEUED, "false");
 axisService.addParameter(param3);

 Parameter param4 = new Parameter(WSConstants.PARAM_SECURITY, "None");
 axisService.addParameter(param4);

 serviceGroup.addService(axisService);

 axis2Config.addServiceGroup(serviceGroup);

}


--
thanks
Rishi

Reply via email to