*
* @return The OperationDescription corresponding to the body element QName or null if one can not be found.
*/
private OperationDescription determineOperationDescFromBodyElementQName(EndpointInterfaceDescription endpointInterfaceDesc,
QName bodyElementQName) {
OperationDescription operationDesc = null;
// If there's no bodyElementQName for us to work with, there's nothing more we can do.
if (bodyElementQName != null) {
// This logic mimics the code in SOAPMessageBodyBasedOperationDispatcher.findOperation. We will look for
// the AxisOperation corresponding to the body element name. Note that we are searching for the AxisOperation instead
// of searching through the OperationDescriptions so that we can use the getOperationByMessageElementQName
// for the Doc/Lit/Bare case. Once we have the AxisOperation, we'll use that to find the Operation Description.
AxisService axisService = endpointInterfaceDesc.getEndpointDescription().getAxisService();
AxisOperation axisOperation = null;
// Doc/Lit/Wrapped and RPC, the operation name is the first body element qname
axisOperation = axisService.getOperation(new QName(bodyElementQName.getLocalPart()));
if (axisOperation == null) {
// Doc/Lit/Bare, the first body element qname is the element name contained in the wsdl:message part
axisOperation = axisService.getOperationByMessageElementQName(bodyElementQName);
}
if (axisOperation == null) {
// Not sure why we wouldn't have found the operation above using just the localPart rather than the full QName used here,
// but this is what SOAPMessageBodyBasedOperationDispatcher.findOperation does.
axisOperation = axisService.getOperation(bodyElementQName);
}
// If we found an axis operation, then find the operation description that corresponds to it
if (axisOperation != null) {
OperationDescription allOpDescs[] = endpointInterfaceDesc.getDispatchableOperations();
for (OperationDescription checkOpDesc : allOpDescs ) {
AxisOperation checkAxisOperation = checkOpDesc.getAxisOperation();
if (checkAxisOperation == axisOperation) {
operationDesc = checkOpDesc;
break;