You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2006/10/24 11:57:51 UTC
svn commit: r467297 - in
/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2:
Constants.java context/ConfigurationContext.java
description/AxisService.java description/AxisService2OM.java
Author: chinthaka
Date: Tue Oct 24 02:57:49 2006
New Revision: 467297
URL: http://svn.apache.org/viewvc?view=rev&rev=467297
Log:
A fix to http://issues.apache.org/jira/browse/AXIS2-1445. Can Charitha please help me to test this from ur initial case.
Modified:
webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/Constants.java
webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/description/AxisService.java
webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java
Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/Constants.java?view=diff&rev=467297&r1=467296&r2=467297
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/Constants.java Tue Oct 24 02:57:49 2006
@@ -216,6 +216,7 @@
*/
public static final String ADDRESSING_ACTION = "WS-Addressing:Action";
public static final String HTTP_FRONTEND_HOST_URL = "httpFrontendHostUrl";
+ public static final String DEFAULT_REST_PATH = "rest";
public static interface Configuration {
public static final String ENABLE_REST = "enableREST";
@@ -229,7 +230,7 @@
public static final String HTTP_METHOD_GET = "GET";
public static final String HTTP_METHOD = "HTTP_METHOD";
public static final String HTTP_METHOD_POST = "POST";
-
+
public static final String ENABLE_SWA = "enableSwA";
public static final String CONTENT_TYPE = "ContentType";
@@ -268,7 +269,7 @@
* Field CHARACTER_SET_ENCODING
*/
public static final String CHARACTER_SET_ENCODING = "CHARACTER_SET_ENCODING";
-
+
/**
* If this is set to a Boolean 'true' value, the replyTo value will not be replaced in
* an OutIn invocation. This is useful for modules that hope to get the reply message in
Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java?view=diff&rev=467297&r1=467296&r2=467297
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java Tue Oct 24 02:57:49 2006
@@ -62,7 +62,7 @@
//To specify url mapping for services
private String contextRoot = "axis2";
private String servicePath = "services";
- private String restPath = "rest";
+ private String restPath = Constants.DEFAULT_REST_PATH;
//To have your own context path
public ConfigurationContext(AxisConfiguration axisConfiguration) {
Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=467297&r1=467296&r2=467297
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/description/AxisService.java Tue Oct 24 02:57:49 2006
@@ -552,6 +552,13 @@
return null;
}
+ /**
+ *
+ * @param out
+ * @param requestIP
+ * @param servicePath
+ * @throws AxisFault
+ */
public void printWSDL(OutputStream out, String requestIP, String servicePath) throws AxisFault {
if (isUseUserWSDL()) {
Parameter wsld4jdefinition = getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
@@ -646,7 +653,7 @@
}
/**
- * Print the WSDL with a default URL
+ * Print the WSDL with a default URL. This will be called only during codegen time.
*
* @param out
* @throws AxisFault
Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java?view=diff&rev=467297&r1=467296&r2=467297
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/description/AxisService2OM.java Tue Oct 24 02:57:49 2006
@@ -1,23 +1,6 @@
package org.apache.axis2.description;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.*;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.om.util.StAXUtils;
import org.apache.axis2.addressing.AddressingConstants;
@@ -34,6 +17,13 @@
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.java2wsdl.Java2WSDLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.*;
+
/*
* Copyright 2004,2005 The Apache Software Foundation.
*
@@ -56,7 +46,7 @@
private AxisService axisService;
- private String[] urls;
+ private String[] serviceEndpointURLs;
private String targetNamespace;
@@ -87,11 +77,17 @@
private ExternalPolicySerializer serializer;
private HashMap messagesMap;
+ private String restPath;
- public AxisService2OM(AxisService service, String[] serviceURL,
+ public AxisService2OM(AxisService service, String[] serviceEndpointURLs,
String style, String use, String servicePath) {
this.axisService = service;
- urls = serviceURL;
+
+ // the EPR list of AxisService contains REST EPRs as well. Those REST EPRs will be used to generated HTTPBinding
+ // and rest of the EPRs will be used to generate SOAP 1.1 and 1.2 bindings. Let's first initialize those set of
+ // EPRs now to be used later, especially when we generate the WSDL.
+ this.serviceEndpointURLs = serviceEndpointURLs;
+
if (style == null) {
this.style = DOCUMENT;
} else {
@@ -117,9 +113,12 @@
}
public OMElement generateOM() throws Exception {
+
+ initURLResolving();
+
OMFactory fac = OMAbstractFactory.getOMFactory();
wsdl = fac.createOMNamespace(WSDL_NAMESPACE,
- DEFAULT_WSDL_NAMESPACE_PREFIX);
+ DEFAULT_WSDL_NAMESPACE_PREFIX);
OMElement ele = fac.createOMElement("definitions", wsdl);
setDefinitionElement(ele);
@@ -144,7 +143,7 @@
prefix = DEFAULT_TARGET_NAMESPACE_PREFIX;
}
axisService.getNameSpacesMap().put(prefix,
- axisService.getTargetNamespace());
+ axisService.getTargetNamespace());
tns = ele.declareNamespace(axisService.getTargetNamespace(), prefix);
// adding documentation element
@@ -154,13 +153,13 @@
String servicedescription = axisService.getServiceDescription();
if (servicedescription != null && !"".equals(servicedescription)) {
OMElement documenentattion = fac.createOMElement("documentation",
- wsdl);
+ wsdl);
documenentattion.setText(servicedescription);
ele.addChild(documenentattion);
}
ele.addAttribute("targetNamespace", axisService.getTargetNamespace(),
- null);
+ null);
OMElement wsdlTypes = fac.createOMElement("types", wsdl);
ele.addChild(wsdlTypes);
@@ -184,7 +183,7 @@
schemaString));
StAXOMBuilder staxOMBuilder = new StAXOMBuilder(fac,
- xmlReader);
+ xmlReader);
wsdlTypes.addChild(staxOMBuilder.getDocumentElement());
}
}
@@ -212,6 +211,25 @@
return ele;
}
+ /**
+ * the EPR list of AxisService contains REST EPRs as well. Those REST EPRs will be used to generated HTTPBinding
+ * and rest of the EPRs will be used to generate SOAP 1.1 and 1.2 bindings. Let's first initialize those set of
+ * EPRs now to be used later, especially when we generate the WSDL.
+ */
+ private void initURLResolving() {
+ Parameter restPathParam = axisService.getParameter(org.apache.axis2.Constants.PARAM_REST_PATH);
+ if (restPathParam != null) {
+ restPath = ((String) restPathParam.getValue()).trim();
+ if (restPath.length() <= 0) {
+ restPath = org.apache.axis2.Constants.DEFAULT_REST_PATH;
+ }
+ } else {
+ restPath = org.apache.axis2.Constants.DEFAULT_REST_PATH;
+ }
+
+ // now search for REST urls in the passed urls list and remove them
+ }
+
private void generateMessages(OMFactory fac, OMElement defintions) {
HashSet faultMessageNames = new HashSet();
messagesMap = new HashMap();
@@ -224,15 +242,15 @@
}
String MEP = axisOperation.getMessageExchangePattern();
if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
.equals(MEP)) {
AxisMessage inaxisMessage = axisOperation
.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
@@ -243,13 +261,13 @@
}
if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_ONLY.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
.equals(MEP)) {
AxisMessage outAxisMessage = axisOperation
.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
@@ -281,21 +299,21 @@
for (int i = 0; i < extList.size(); i++) {
SOAPHeaderMessage header = (SOAPHeaderMessage) extList.get(i);
OMElement messageElement = fac.createOMElement(MESSAGE_LOCAL_NAME,
- wsdl);
+ wsdl);
messageElement.addAttribute(ATTRIBUTE_NAME, header.getMessage()
.getLocalPart(), null);
defintions.addChild(messageElement);
OMElement messagePart = fac.createOMElement(PART_ATTRIBUTE_NAME,
- wsdl);
+ wsdl);
messageElement.addChild(messagePart);
messagePart.addAttribute(ATTRIBUTE_NAME, header.part(), null);
if (header.getElement() == null) {
throw new RuntimeException(ELEMENT_ATTRIBUTE_NAME
- + " is null for " + header.getMessage());
+ + " is null for " + header.getMessage());
}
messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME, getPrefix(header
.getElement().getNamespaceURI())
- + ":" + header.getElement().getLocalPart(), null);
+ + ":" + header.getElement().getLocalPart(), null);
}
}
@@ -305,9 +323,9 @@
messagesMap.put(axismessage.getName(), axismessage);
QName schemaElementName = axismessage.getElementQName();
OMElement messageElement = fac.createOMElement(MESSAGE_LOCAL_NAME,
- wsdl);
+ wsdl);
messageElement.addAttribute(ATTRIBUTE_NAME, axismessage.getName(),
- null);
+ null);
defintions.addChild(messageElement);
if (schemaElementName != null) {
OMElement messagePart = fac.createOMElement(
@@ -315,8 +333,8 @@
messageElement.addChild(messagePart);
messagePart.addAttribute(ATTRIBUTE_NAME, "part1", null);
messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
- getPrefix(schemaElementName.getNamespaceURI()) + ":"
- + schemaElementName.getLocalPart(), null);
+ getPrefix(schemaElementName.getNamespaceURI()) + ":"
+ + schemaElementName.getLocalPart(), null);
}
}
@@ -331,7 +349,7 @@
defintions.addChild(portType);
portType.addAttribute(ATTRIBUTE_NAME, axisService.getName()
- + PORT_TYPE_SUFFIX, null);
+ + PORT_TYPE_SUFFIX, null);
addPolicyAsExtAttribute(PolicyInclude.PORT_TYPE_POLICY, axisService
.getPolicyInclude(), portType, fac);
@@ -342,7 +360,7 @@
}
String operationName = axisOperation.getName().getLocalPart();
OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME,
- wsdl);
+ wsdl);
portType.addChild(operation);
operation.addAttribute(ATTRIBUTE_NAME, operationName, null);
addPolicyAsExtElement(PolicyInclude.OPERATION_POLICY, axisOperation
@@ -350,25 +368,25 @@
String MEP = axisOperation.getMessageExchangePattern();
if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
.equals(MEP)) {
AxisMessage inaxisMessage = axisOperation
.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
if (inaxisMessage != null) {
OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME,
- wsdl);
+ wsdl);
input.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix()
- + ":" + inaxisMessage.getName(), null);
+ + ":" + inaxisMessage.getName(), null);
addPolicyAsExtElement(PolicyInclude.INPUT_POLICY,
- inaxisMessage.getPolicyInclude(), input, fac);
+ inaxisMessage.getPolicyInclude(), input, fac);
addWSAWActionAttribute(input, axisOperation
.getInputAction());
operation.addChild(input);
@@ -376,23 +394,23 @@
}
if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_ONLY.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
.equals(MEP)) {
AxisMessage outAxisMessage = axisOperation
.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
if (outAxisMessage != null) {
OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME,
- wsdl);
+ wsdl);
output.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix()
- + ":" + outAxisMessage.getName(), null);
+ + ":" + outAxisMessage.getName(), null);
addPolicyAsExtElement(PolicyInclude.OUTPUT_POLICY,
- outAxisMessage.getPolicyInclude(), output, fac);
+ outAxisMessage.getPolicyInclude(), output, fac);
addWSAWActionAttribute(output, axisOperation
.getOutputAction());
operation.addChild(output);
@@ -406,11 +424,11 @@
AxisMessage faultyMessge = (AxisMessage) faultyMessages
.get(i);
OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME,
- wsdl);
+ wsdl);
fault.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix()
- + ":" + faultyMessge.getName(), null);
+ + ":" + faultyMessge.getName(), null);
fault.addAttribute(ATTRIBUTE_NAME, faultyMessge.getName(),
- null);
+ null);
addWSAWActionAttribute(fault, axisOperation
.getFaultAction(faultyMessge.getName()));
// TODO add policies for fault messages
@@ -443,37 +461,40 @@
private void generateSOAP11Port(OMFactory fac, OMElement service)
throws Exception {
- for (int i = 0; i < urls.length; i++) {
- String urlString = urls[i];
- String protocol = urlString == null ? null : new URI(urlString)
- .getScheme();
- if (urlString == null) {
- urlString = "REPLACE_WITH_ACTUAL_URL";
- }
- OMElement port = fac.createOMElement(PORT, wsdl);
- service.addChild(port);
- String name = axisService.getName() + SOAP11PORT
- + ((protocol == null) ? "" : "_" + protocol);
- if (i > 0) {
- name += i;
- }
- port.addAttribute(ATTRIBUTE_NAME, name, null);
- port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + ":"
- + axisService.getName() + BINDING_NAME_SUFFIX, null);
- addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, urlString,
- soap);
+ for (int i = 0; i < serviceEndpointURLs.length; i++) {
+ String urlString = serviceEndpointURLs[i];
+ if (urlString == null || urlString.indexOf(restPath) == -1) {
+ String protocol = urlString == null ? null : new URI(urlString)
+ .getScheme();
+ if (urlString == null) {
+ urlString = "REPLACE_WITH_ACTUAL_URL";
+ }
+ OMElement port = fac.createOMElement(PORT, wsdl);
+ service.addChild(port);
+ String name = axisService.getName() + SOAP11PORT
+ + ((protocol == null) ? "" : "_" + protocol);
+ if (i > 0) {
+ name += i;
+ }
+ port.addAttribute(ATTRIBUTE_NAME, name, null);
+ port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + ":"
+ + axisService.getName() + BINDING_NAME_SUFFIX, null);
+ addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, urlString,
+ soap);
- addPolicyAsExtElement(PolicyInclude.PORT_POLICY, axisService
- .getPolicyInclude(), port, fac);
+ addPolicyAsExtElement(PolicyInclude.PORT_POLICY, axisService
+ .getPolicyInclude(), port, fac);
+ }
}
}
private void generateHTTPPort(OMFactory fac, OMElement service)
throws Exception {
- for (int i = 0; i < urls.length; i++) {
- String urlString = urls[i];
- if (urlString != null && urlString.startsWith("http")) {
+ String[] exposedEPRs = axisService.getEPRs();
+ for (int i = 0; i < exposedEPRs.length; i++) {
+ String urlString = serviceEndpointURLs[i];
+ if (urlString != null && urlString.startsWith("http") && (urlString.indexOf(restPath) > -1)) {
OMElement port = fac.createOMElement(PORT, wsdl);
service.addChild(port);
String name = axisService.getName() + HTTP_PORT;
@@ -482,10 +503,10 @@
}
port.addAttribute(ATTRIBUTE_NAME, name, null);
port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + ":"
- + axisService.getName() + HTTP_BINDING, null);
+ + axisService.getName() + HTTP_BINDING, null);
OMElement extElement = fac.createOMElement("address", http);
port.addChild(extElement);
- urlString = urlString.replaceAll(servicePath, "rest");
+// urlString = urlString.replaceAll(servicePath, "rest");
extElement.addAttribute("location", urlString, null);
}
}
@@ -493,28 +514,30 @@
private void generateSOAP12Port(OMFactory fac, OMElement service)
throws Exception {
- for (int i = 0; i < urls.length; i++) {
- String urlString = urls[i];
- String protocol = urlString == null ? null : new URI(urlString)
- .getScheme();
- if (urlString == null) {
- urlString = "REPLACE_WITH_ACTUAL_URL";
- }
- OMElement port = fac.createOMElement(PORT, wsdl);
- service.addChild(port);
- String name = axisService.getName() + SOAP12PORT
- + ((protocol == null) ? "" : "_" + protocol);
- if (i > 0) {
- name += i;
- }
- port.addAttribute(ATTRIBUTE_NAME, name, null);
- port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + ":"
- + axisService.getName() + SOAP12BINDING_NAME_SUFFIX, null);
- addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, urlString,
- soap12);
+ for (int i = 0; i < serviceEndpointURLs.length; i++) {
+ String urlString = serviceEndpointURLs[i];
+ if (urlString == null || urlString.indexOf(restPath) == -1) {
+ String protocol = urlString == null ? null : new URI(urlString)
+ .getScheme();
+ if (urlString == null) {
+ urlString = "REPLACE_WITH_ACTUAL_URL";
+ }
+ OMElement port = fac.createOMElement(PORT, wsdl);
+ service.addChild(port);
+ String name = axisService.getName() + SOAP12PORT
+ + ((protocol == null) ? "" : "_" + protocol);
+ if (i > 0) {
+ name += i;
+ }
+ port.addAttribute(ATTRIBUTE_NAME, name, null);
+ port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + ":"
+ + axisService.getName() + SOAP12BINDING_NAME_SUFFIX, null);
+ addExtensionElement(fac, port, SOAP_ADDRESS, LOCATION, urlString,
+ soap12);
- addPolicyAsExtElement(PolicyInclude.PORT_POLICY, axisService
- .getPolicyInclude(), port, fac);
+ addPolicyAsExtElement(PolicyInclude.PORT_POLICY, axisService
+ .getPolicyInclude(), port, fac);
+ }
}
}
@@ -526,9 +549,9 @@
OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, wsdl);
defintions.addChild(binding);
binding.addAttribute(ATTRIBUTE_NAME, axisService.getName()
- + BINDING_NAME_SUFFIX, null);
+ + BINDING_NAME_SUFFIX, null);
binding.addAttribute("type", tns.getPrefix() + ":"
- + axisService.getName() + PORT_TYPE_SUFFIX, null);
+ + axisService.getName() + PORT_TYPE_SUFFIX, null);
addPolicyAsExtElement(PolicyInclude.AXIS_SERVICE_POLICY, axisService
.getPolicyInclude(), binding, fac);
@@ -537,7 +560,7 @@
// Adding ext elements
addExtensionElemnet(fac, binding, BINDING_LOCAL_NAME, TRANSPORT,
- TRANSPORT_URI, STYLE, style, soap);
+ TRANSPORT_URI, STYLE, style, soap);
// Add WS-Addressing UsingAddressing element if appropriate
// SHOULD be on the binding element per the specification
@@ -546,17 +569,17 @@
OMNamespace wsawNamespace = fac.createOMNamespace(
AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
addExtensionElement(fac, binding,
- AddressingConstants.USING_ADDRESSING,
- DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
- wsawNamespace);
+ AddressingConstants.USING_ADDRESSING,
+ DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
+ wsawNamespace);
} else if (axisService.getWSAddressingFlag().equals(
AddressingConstants.ADDRESSING_REQUIRED)) {
OMNamespace wsawNamespace = fac.createOMNamespace(
AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
addExtensionElement(fac, binding,
- AddressingConstants.USING_ADDRESSING,
- DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
- wsawNamespace);
+ AddressingConstants.USING_ADDRESSING,
+ DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
+ wsawNamespace);
}
for (Iterator operations = axisService.getOperations(); operations.hasNext();) {
@@ -566,66 +589,66 @@
}
String operationName = axisOperation.getName().getLocalPart();
OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME,
- wsdl);
+ wsdl);
binding.addChild(operation);
String soapAction = axisOperation.getInputAction();
if (soapAction == null) {
soapAction = "";
}
addExtensionElemnet(fac, operation, OPERATION_LOCAL_NAME,
- SOAP_ACTION, soapAction, STYLE, style, soap);
+ SOAP_ACTION, soapAction, STYLE, style, soap);
addPolicyAsExtElement(PolicyInclude.BINDING_OPERATION_POLICY,
- axisOperation.getPolicyInclude(), operation, fac);
+ axisOperation.getPolicyInclude(), operation, fac);
addPolicyAsExtElement(PolicyInclude.AXIS_OPERATION_POLICY,
- axisOperation.getPolicyInclude(), operation, fac);
+ axisOperation.getPolicyInclude(), operation, fac);
String MEP = axisOperation.getMessageExchangePattern();
if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
.equals(MEP)) {
AxisMessage inaxisMessage = axisOperation
.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
if (inaxisMessage != null) {
operation.addAttribute(ATTRIBUTE_NAME, operationName, null);
OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME,
- wsdl);
+ wsdl);
addExtensionElemnet(fac, input, SOAP_BODY, SOAP_USE, use,
- null, targetNamespace, soap);
+ null, targetNamespace, soap);
addPolicyAsExtElement(PolicyInclude.BINDING_INPUT_POLICY,
- inaxisMessage.getPolicyInclude(), input, fac);
+ inaxisMessage.getPolicyInclude(), input, fac);
operation.addChild(input);
writeSoapHeaders(inaxisMessage, fac, input, soap);
}
}
if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_ONLY.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
.equals(MEP)) {
AxisMessage outAxisMessage = axisOperation
.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
if (outAxisMessage != null) {
OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME,
- wsdl);
+ wsdl);
addExtensionElemnet(fac, output, SOAP_BODY, SOAP_USE, use,
- null, targetNamespace, soap);
+ null, targetNamespace, soap);
addPolicyAsExtElement(PolicyInclude.BINDING_OUTPUT_POLICY,
- outAxisMessage.getPolicyInclude(), output, fac);
+ outAxisMessage.getPolicyInclude(), output, fac);
operation.addChild(output);
writeSoapHeaders(outAxisMessage, fac, output, soap);
}
@@ -638,11 +661,11 @@
AxisMessage faultyMessge = (AxisMessage) faultyMessages
.get(i);
OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME,
- wsdl);
+ wsdl);
addExtensionElemnet(fac, fault, SOAP_BODY, SOAP_USE, use,
- null, targetNamespace, soap);
+ null, targetNamespace, soap);
fault.addAttribute(ATTRIBUTE_NAME, faultyMessge.getName(),
- null);
+ null);
// TODO adding policies for fault messages
operation.addChild(fault);
writeSoapHeaders(faultyMessge, fac, fault, soap);
@@ -660,9 +683,9 @@
OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, wsdl);
defintions.addChild(binding);
binding.addAttribute(ATTRIBUTE_NAME, axisService.getName()
- + SOAP12BINDING_NAME_SUFFIX, null);
+ + SOAP12BINDING_NAME_SUFFIX, null);
binding.addAttribute("type", tns.getPrefix() + ":"
- + axisService.getName() + PORT_TYPE_SUFFIX, null);
+ + axisService.getName() + PORT_TYPE_SUFFIX, null);
addPolicyAsExtElement(PolicyInclude.AXIS_SERVICE_POLICY, axisService
.getPolicyInclude(), binding, fac);
@@ -671,7 +694,7 @@
// Adding ext elements
addExtensionElemnet(fac, binding, BINDING_LOCAL_NAME, TRANSPORT,
- TRANSPORT_URI, STYLE, style, soap12);
+ TRANSPORT_URI, STYLE, style, soap12);
// Add WS-Addressing UsingAddressing element if appropriate
// SHOULD be on the binding element per the specification
@@ -680,17 +703,17 @@
OMNamespace wsawNamespace = fac.createOMNamespace(
AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
addExtensionElement(fac, binding,
- AddressingConstants.USING_ADDRESSING,
- DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
- wsawNamespace);
+ AddressingConstants.USING_ADDRESSING,
+ DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
+ wsawNamespace);
} else if (axisService.getWSAddressingFlag().equals(
AddressingConstants.ADDRESSING_REQUIRED)) {
OMNamespace wsawNamespace = fac.createOMNamespace(
AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
addExtensionElement(fac, binding,
- AddressingConstants.USING_ADDRESSING,
- DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
- wsawNamespace);
+ AddressingConstants.USING_ADDRESSING,
+ DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
+ wsawNamespace);
}
for (Iterator operations = axisService.getOperations(); operations.hasNext();) {
@@ -700,66 +723,66 @@
}
String opeartionName = axisOperation.getName().getLocalPart();
OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME,
- wsdl);
+ wsdl);
binding.addChild(operation);
String soapAction = axisOperation.getInputAction();
if (soapAction == null) {
soapAction = "";
}
addExtensionElemnet(fac, operation, OPERATION_LOCAL_NAME,
- SOAP_ACTION, soapAction, STYLE, style, soap12);
+ SOAP_ACTION, soapAction, STYLE, style, soap12);
addPolicyAsExtElement(PolicyInclude.BINDING_OPERATION_POLICY,
- axisOperation.getPolicyInclude(), operation, fac);
+ axisOperation.getPolicyInclude(), operation, fac);
addPolicyAsExtElement(PolicyInclude.AXIS_OPERATION_POLICY,
- axisOperation.getPolicyInclude(), operation, fac);
+ axisOperation.getPolicyInclude(), operation, fac);
String MEP = axisOperation.getMessageExchangePattern();
if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
.equals(MEP)) {
AxisMessage inaxisMessage = axisOperation
.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
if (inaxisMessage != null) {
operation.addAttribute(ATTRIBUTE_NAME, opeartionName, null);
OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME,
- wsdl);
+ wsdl);
addExtensionElemnet(fac, input, SOAP_BODY, SOAP_USE, use,
- null, targetNamespace, soap12);
+ null, targetNamespace, soap12);
addPolicyAsExtElement(PolicyInclude.BINDING_INPUT_POLICY,
- inaxisMessage.getPolicyInclude(), input, fac);
+ inaxisMessage.getPolicyInclude(), input, fac);
operation.addChild(input);
writeSoapHeaders(inaxisMessage, fac, input, soap12);
}
}
if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_ONLY.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
.equals(MEP)) {
AxisMessage outAxisMessage = axisOperation
.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
if (outAxisMessage != null) {
OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME,
- wsdl);
+ wsdl);
addExtensionElemnet(fac, output, SOAP_BODY, SOAP_USE, use,
- null, targetNamespace, soap12);
+ null, targetNamespace, soap12);
addPolicyAsExtElement(PolicyInclude.BINDING_OUTPUT_POLICY,
- outAxisMessage.getPolicyInclude(), output, fac);
+ outAxisMessage.getPolicyInclude(), output, fac);
operation.addChild(output);
writeSoapHeaders(outAxisMessage, fac, output, soap12);
}
@@ -772,11 +795,11 @@
AxisMessage faultyMessge = (AxisMessage) faultyMessages
.get(i);
OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME,
- wsdl);
+ wsdl);
addExtensionElemnet(fac, fault, SOAP_BODY, SOAP_USE, use,
- null, targetNamespace, soap12);
+ null, targetNamespace, soap12);
fault.addAttribute(ATTRIBUTE_NAME, faultyMessge.getName(),
- null);
+ null);
// add policies for fault messages
operation.addChild(fault);
writeSoapHeaders(faultyMessge, fac, fault, soap12);
@@ -790,9 +813,9 @@
OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, wsdl);
defintions.addChild(binding);
binding.addAttribute(ATTRIBUTE_NAME, axisService.getName()
- + HTTP_BINDING, null);
+ + HTTP_BINDING, null);
binding.addAttribute("type", tns.getPrefix() + ":"
- + axisService.getName() + PORT_TYPE_SUFFIX, null);
+ + axisService.getName() + PORT_TYPE_SUFFIX, null);
// Adding ext elements
OMElement httpBinding = fac.createOMElement("binding", http);
@@ -807,7 +830,7 @@
}
String opeartionName = axisOperation.getName().getLocalPart();
OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME,
- wsdl);
+ wsdl);
binding.addChild(operation);
OMElement httpOperation = fac.createOMElement("operation", http);
@@ -818,24 +841,24 @@
String MEP = axisOperation.getMessageExchangePattern();
if (WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
.equals(MEP)) {
AxisMessage inaxisMessage = axisOperation
.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
if (inaxisMessage != null) {
operation.addAttribute(ATTRIBUTE_NAME, opeartionName, null);
OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME,
- wsdl);
+ wsdl);
OMElement inputelement = fac.createOMElement("content",
- mime);
+ mime);
input.addChild(inputelement);
inputelement.addAttribute("type", "text/xml", null);
operation.addChild(input);
@@ -843,19 +866,19 @@
}
if (WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_ONLY.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY
.equals(MEP)
- || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
+ || WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT
.equals(MEP)) {
AxisMessage outAxisMessage = axisOperation
.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
if (outAxisMessage != null) {
OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME,
- wsdl);
+ wsdl);
OMElement outElement = fac.createOMElement("content", mime);
outElement.addChild(outElement);
outElement.addAttribute("type", "text/xml", null);
@@ -916,7 +939,7 @@
}
if (header.getMessage() != null) {
extElement.addAttribute("message", getPrefix(targetNamespace) + ":"
- + header.getMessage().getLocalPart(), null);
+ + header.getMessage().getLocalPart(), null);
}
}
@@ -1014,7 +1037,7 @@
if (p == null) {
throw new RuntimeException("Cannot resolve " + uri
- + " to a Policy");
+ + " to a Policy");
}
addPolicyToDefinitionElement(key, p);
}
@@ -1036,7 +1059,7 @@
org.apache.neethi.Constants.URI_POLICY_NS,
org.apache.neethi.Constants.ATTR_WSP);
OMAttribute URIs = factory.createOMAttribute("PolicyURIs", ns,
- value);
+ value);
element.addAttribute(URIs);
}
}
@@ -1050,7 +1073,7 @@
for (; iterator.hasNext();) {
policy = (Policy) iterator.next();
policyElement = PolicyUtil.getPolicyComponentAsOMElement(policy,
- serializer);
+ serializer);
firstChild = definition.getFirstOMChild();
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org