1 17 package org.apache.geronimo.axis.builder; 18 19 import java.util.Iterator ; 20 import java.util.List ; 21 import javax.wsdl.BindingOperation; 22 import javax.wsdl.Operation; 23 import javax.wsdl.Message; 24 import javax.wsdl.BindingInput; 25 import javax.wsdl.extensions.soap.SOAPOperation; 26 import javax.wsdl.extensions.soap.SOAPBody; 27 import javax.wsdl.extensions.ExtensibilityElement; 28 import javax.xml.namespace.QName ; 29 30 import org.apache.geronimo.axis.client.OperationInfo; 31 import org.apache.geronimo.common.DeploymentException; 32 import org.apache.geronimo.webservices.builder.SchemaInfoBuilder; 33 import org.apache.axis.soap.SOAPConstants; 34 import org.apache.axis.description.OperationDesc; 35 36 public abstract class OperationDescBuilder { 37 protected final OperationDesc operationDesc; 38 protected final BindingOperation bindingOperation; 39 protected final Operation operation; 40 protected final String operationName; 41 protected final Message input; 42 protected final Message output; 43 protected final SOAPOperation soapOperation; 44 protected boolean built; 45 46 public OperationDescBuilder(BindingOperation bindingOperation) throws DeploymentException { 47 this.bindingOperation = bindingOperation; 48 this.operation = bindingOperation.getOperation(); 49 this.soapOperation = (SOAPOperation) SchemaInfoBuilder.getExtensibilityElement(SOAPOperation.class, bindingOperation.getExtensibilityElements()); 50 51 operationDesc = new OperationDesc(); 52 output = operation.getOutput() == null ? null : operation.getOutput().getMessage(); 53 operationName = operation.getName(); 54 input = operation.getInput().getMessage(); 55 } 56 57 public abstract OperationInfo buildOperationInfo(SOAPConstants soapVersion) throws DeploymentException; 58 59 public abstract OperationDesc buildOperationDesc() throws DeploymentException; 60 61 protected QName getOperationNameFromSOAPBody() { 62 BindingInput bindingInput = bindingOperation.getBindingInput(); 63 List extensibilityElements = bindingInput.getExtensibilityElements(); 64 for (Iterator iterator = extensibilityElements.iterator(); iterator.hasNext();) { 65 ExtensibilityElement extensibilityElement = (ExtensibilityElement) iterator.next(); 66 if (extensibilityElement instanceof SOAPBody) { 67 String namespaceURI = ((SOAPBody)extensibilityElement).getNamespaceURI(); 68 return new QName (namespaceURI, operationName); 69 } 70 } 71 return new QName ("", operationName); 72 } 73 } 74 | Popular Tags |