1 7 package org.jboss.webservice.server; 8 9 import org.jboss.axis.MessageContext; 10 import org.jboss.axis.description.OperationDesc; 11 import org.jboss.axis.description.ParameterDesc; 12 import org.jboss.axis.description.ServiceDesc; 13 import org.jboss.axis.message.SOAPEnvelopeAxisImpl; 14 import org.jboss.axis.providers.java.RPCInvocation; 15 import org.jboss.axis.providers.java.RPCProvider; 16 import org.jboss.logging.Logger; 17 import org.jboss.webservice.PortComponentInfo; 18 import org.jboss.webservice.deployment.OperationDescription; 19 import org.jboss.webservice.deployment.ServiceDescription; 20 21 import javax.xml.namespace.QName ; 22 import java.util.ArrayList ; 23 import java.util.Iterator ; 24 25 28 public class JBossRPCInvocation extends RPCInvocation 29 { 30 private Logger log = Logger.getLogger(JBossRPCInvocation.class); 31 32 public JBossRPCInvocation(RPCProvider rpcProvider, MessageContext messageContext, SOAPEnvelopeAxisImpl soapEnvelopeDirty, SOAPEnvelopeAxisImpl soapEnvelopeDirty1, Object o) 33 { 34 super(rpcProvider, messageContext, soapEnvelopeDirty, soapEnvelopeDirty1, o); 35 } 36 37 public JBossRPCInvocation(RPCInvocation rpcInvocation) 38 { 39 super(rpcInvocation); 40 } 41 42 public OperationDesc getOperation(ServiceDesc serviceDesc, QName qname) 43 { 44 OperationDesc op = null; 45 op = serviceDesc.getOperationByElementQName(qname); 46 47 RPCProvider provider = getProvider(); 48 49 if (provider instanceof InvokerProvider) 50 { 51 PortComponentInfo pcInfo = ((InvokerProvider)provider).getPortComponentInfo(); 52 ServiceDescription svcDesc = pcInfo.getServiceDescription(); 53 OperationDescription custOp = svcDesc.getOperation(qname.getLocalPart()); 54 if (custOp != null) 55 { 56 String opName = custOp.getJavaName(); 57 QName returnName = custOp.getReturnQName(); 58 QName returnType = custOp.getReturnType(); 59 60 op.setName(opName); 61 op.setReturnQName(returnName); 62 op.setReturnType(returnType); 63 64 Iterator itr = custOp.getParameters(); 66 ArrayList paramList = new ArrayList (); 67 68 while (itr.hasNext()) 69 { 70 OperationDescription.Parameter param = (OperationDescription.Parameter)itr.next(); 71 QName paramName = new QName ("", param.getName()); 73 QName paramType = param.getType(); 74 String mode = param.getMode(); 75 ParameterDesc paramDesc = new ParameterDesc(paramName, convertMode(mode), paramType); 76 paramList.add(paramDesc); 77 } 78 79 if (paramList.size() > 0) 80 { 81 op.setParameters(paramList); 82 } 83 } 85 } 86 87 return op; 88 } 89 90 private byte convertMode(String mode) 91 { 92 if ("INOUT".equals(mode)) 93 { 94 return ParameterDesc.INOUT; 95 } 96 else if ("OUT".equals(mode)) 97 { 98 return ParameterDesc.OUT; 99 } 100 else 101 { 102 return ParameterDesc.IN; 103 } 104 } 105 106 } 107 | Popular Tags |