1 16 package org.apache.axis2.engine; 17 18 import org.apache.axis2.context.ConfigurationContext; 19 import org.apache.axis2.context.MessageContext; 20 import org.apache.axis2.description.HandlerDescription; 21 import org.apache.axis2.description.OperationDescription; 22 import org.apache.axis2.description.ServiceDescription; 23 import org.apache.axis2.om.OMElement; 24 import org.apache.axis2.om.OMNamespace; 25 import org.apache.axis2.util.Utils; 26 27 import javax.xml.namespace.QName ; 28 29 32 public class SOAPMessageBodyBasedDispatcher extends AbstractDispatcher { 33 36 public static final QName NAME = 37 new QName ("http://axis.ws.apache.org", "SOAPMessageBodyBasedDispatcher"); 38 QName serviceName = null; 39 QName operatoinName = null; 40 41 44 public SOAPMessageBodyBasedDispatcher() { 45 init(new HandlerDescription(NAME)); 46 } 47 48 public OperationDescription findOperation( 49 ServiceDescription service, 50 MessageContext messageContext) 51 throws AxisFault { 52 OMElement bodyFirstChild = messageContext.getEnvelope().getBody().getFirstElement(); 53 operatoinName = new QName (bodyFirstChild.getLocalName()); 54 55 OperationDescription axisOp = service.getOperation(operatoinName); 56 return axisOp; 57 } 58 59 62 public ServiceDescription findService(MessageContext messageContext) throws AxisFault { 63 final String URI_ID_STRING = "/services"; 64 OMElement bodyFirstChild = messageContext.getEnvelope().getBody().getFirstElement(); 65 OMNamespace ns = bodyFirstChild.getNamespace(); 66 if (ns != null) { 67 String filePart = ns.getName(); 68 69 String [] values = Utils.parseRequestURLForServiceAndOperation(filePart); 70 if (values[1] != null) { 71 operatoinName = new QName (values[1]); 72 } 73 if (values[0] != null) { 74 serviceName = new QName (values[0]); 75 AxisConfiguration registry = 76 messageContext.getSystemContext().getAxisConfiguration(); 77 return registry.getService(serviceName); 78 } 79 } 80 return null; 81 82 } 83 } 84 | Popular Tags |