01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.axis.builder;
17:
18: import java.util.Iterator;
19: import java.util.List;
20: import javax.wsdl.BindingOperation;
21: import javax.wsdl.Operation;
22: import javax.wsdl.Message;
23: import javax.wsdl.BindingInput;
24: import javax.wsdl.extensions.soap.SOAPOperation;
25: import javax.wsdl.extensions.soap.SOAPBody;
26: import javax.wsdl.extensions.ExtensibilityElement;
27: import javax.xml.namespace.QName;
28:
29: import org.apache.geronimo.axis.client.OperationInfo;
30: import org.apache.geronimo.common.DeploymentException;
31: import org.apache.geronimo.webservices.builder.SchemaInfoBuilder;
32: import org.apache.axis.soap.SOAPConstants;
33: import org.apache.axis.description.OperationDesc;
34:
35: public abstract class OperationDescBuilder {
36: protected final OperationDesc operationDesc;
37: protected final BindingOperation bindingOperation;
38: protected final Operation operation;
39: protected final String operationName;
40: protected final Message input;
41: protected final Message output;
42: protected final SOAPOperation soapOperation;
43: protected boolean built;
44:
45: public OperationDescBuilder(BindingOperation bindingOperation)
46: throws DeploymentException {
47: this .bindingOperation = bindingOperation;
48: this .operation = bindingOperation.getOperation();
49: this .soapOperation = (SOAPOperation) SchemaInfoBuilder
50: .getExtensibilityElement(SOAPOperation.class,
51: bindingOperation.getExtensibilityElements());
52:
53: operationDesc = new OperationDesc();
54: output = operation.getOutput() == null ? null : operation
55: .getOutput().getMessage();
56: operationName = operation.getName();
57: input = operation.getInput().getMessage();
58: }
59:
60: public abstract OperationInfo buildOperationInfo(
61: SOAPConstants soapVersion) throws DeploymentException;
62:
63: public abstract OperationDesc buildOperationDesc()
64: throws DeploymentException;
65:
66: protected QName getOperationNameFromSOAPBody() {
67: BindingInput bindingInput = bindingOperation.getBindingInput();
68: List extensibilityElements = bindingInput
69: .getExtensibilityElements();
70: for (Iterator iterator = extensibilityElements.iterator(); iterator
71: .hasNext();) {
72: ExtensibilityElement extensibilityElement = (ExtensibilityElement) iterator
73: .next();
74: if (extensibilityElement instanceof SOAPBody) {
75: String namespaceURI = ((SOAPBody) extensibilityElement)
76: .getNamespaceURI();
77: return new QName(namespaceURI, operationName);
78: }
79: }
80: return new QName("", operationName);
81: }
82: }
|