AxisService axisService = getEndpointDescription().getAxisService();
AxisOperation axisOperation = axisService
.getOperation(OperationDescriptionImpl.determineOperationQName(this, mdc));
OperationDescription operation =
new OperationDescriptionImpl(mdc, this, axisOperation);
//1) if wsdl is defined then we should only expose operations that are in wsdl.
//NOTE:If wsdl is defined AxisService will have all operations found in wsdl,
//AxisServiceBuilder will do that part before metadata layer is invoked.
//2) if wsdl not defined we need to expose operations based on annotation, in
//which case we need add operations not found in AxisService.
if(getWSDLDefinition() != null){
if(log.isDebugEnabled()){
log.debug("wsdl definition found, we will not expose operation not found in AxisService.");
}
if (log.isDebugEnabled())
log.debug("EID: Just added operation= " + operation.getOperationName());
addOperation(operation);
//Cater to partial wsdl case, if wsdl is found but AxisService was
//not built using this wsdl we need to add operation to AxisService.
if(!getEndpointDescriptionImpl().isWSDLFullySpecified()){
if(log.isDebugEnabled()){
log.debug("Partial wsdl definition found, we will add operation to the AxisService.");
}
((OperationDescriptionImpl)operation).addToAxisService(axisService);
}
}
//Since wsdl is not defined add all operations to AxisService and OperationDescriptionList.
else if(axisOperation == null) {
if(log.isDebugEnabled()){
log.debug("wsdl defintion NOT found, we will expose operation using annotations.");
}
// This axisOperation did not already exist on the AxisService, and so was created
// with the OperationDescription, so we need to add the operation to the service
((OperationDescriptionImpl)operation).addToAxisService(axisService);
if (log.isDebugEnabled())
log.debug("EID: Just added operation= " + operation.getOperationName());
addOperation(operation);
}
//This is the case where wsdl is not defined and AxisOperation is found in Axis Service.
//Here we have to ensure that corresponding OperationDescription is added to OperationDescriptionList.
else if(getWSDLDefinition()==null && axisOperation!=null){
if (log.isDebugEnabled())
log.debug("EID: Just added operation= " + operation.getOperationName());
addOperation(operation);
}
}
}