You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ke...@apache.org on 2007/06/08 12:55:12 UTC
svn commit: r545475 - in
/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2:
description/ util/
Author: keithc
Date: Fri Jun 8 03:55:11 2007
New Revision: 545475
URL: http://svn.apache.org/viewvc?view=rev&rev=545475
Log:
cleaning up ?wsdl2 stuff.
The https endpoints will have the prefix "Secure"
Fixing bug in WSDL11ToAxisServiceBuilder.java (Not necessary creating a new AxisBinding when we have alresdy created one to hold the same details, so using the same
reference and have a field processBindings which keeps track of unique bindings)
Serializing unique bindings only.
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java?view=diff&rev=545475&r1=545474&r2=545475
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java Fri Jun 8 03:55:11 2007
@@ -115,9 +115,17 @@
public OMElement toWSDL20(OMNamespace wsdl, OMNamespace tns, OMNamespace whttp, String epr) {
String property;
+ String name;
+ if (epr.startsWith("https://")) {
+ // The reason to do this is to have camel case
+ String endpointName = this.getName();
+ name = WSDL2Constants.DEFAULT_HTTPS_PREFIX + endpointName.substring(0,1).toUpperCase() + endpointName.substring(1);
+ } else {
+ name = this.getName();
+ }
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMElement endpointElement = omFactory.createOMElement(WSDL2Constants.ENDPOINT_LOCAL_NAME, wsdl);
- endpointElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null, this.getName()));
+ endpointElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null, name));
endpointElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.BINDING_LOCAL_NAME, null, tns.getPrefix() + ":" + getBinding().getName().getLocalPart()));
endpointElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ADDRESS, null, epr));
HTTPAuthenticationScheme authenticationScheme = (HTTPAuthenticationScheme) this.options.get(WSDL2Constants.ATTR_WHTTP_AUTHENTICATION_TYPE);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java?view=diff&rev=545475&r1=545474&r2=545475
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java Fri Jun 8 03:55:11 2007
@@ -22,6 +22,8 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
public class AxisService2WSDL20 implements WSDL2Constants {
@@ -161,8 +163,9 @@
// Check whether the axisService has any endpoints. If they exists serialize them else
// generate default endpoint elements.
+ Set bindings = new HashSet();
Map endpointMap = axisService.getEndpoints();
- if (endpointMap != null && endpointMap.size() > 0) {
+ if (endpointMap != null && endpointMap.size() > 0) {
String[] eprs = axisService.getEPRs();
if (eprs == null) {
eprs = new String[]{axisService.getName()};
@@ -176,6 +179,7 @@
// https then we have two endpoints populated so we should serialize them instead
// of updating the endpoints.
AxisEndpoint axisEndpoint = (AxisEndpoint) iterator.next();
+ bindings.add(axisEndpoint.getBinding());
for (int i = 0; i < eprs.length; i++) {
String epr = eprs[i];
if (!epr.endsWith("/")) {
@@ -187,8 +191,13 @@
while (endpointsAdded.hasNext()) {
OMElement endpoint = (OMElement) endpointsAdded.next();
// Checking whether a endpoint with the same binding and address exists.
- if (endpoint.getAttribute(new QName(WSDL2Constants.BINDING_LOCAL_NAME)).getAttributeValue().equals(endpointElement.getAttribute(new QName(WSDL2Constants.BINDING_LOCAL_NAME)).getAttributeValue())
- && endpoint.getAttribute(new QName(WSDL2Constants.ATTRIBUTE_ADDRESS)).getAttributeValue().equals(endpointElement.getAttribute(new QName(WSDL2Constants.ATTRIBUTE_ADDRESS)).getAttributeValue())) {
+ if (endpoint.getAttribute(new QName(WSDL2Constants.BINDING_LOCAL_NAME))
+ .getAttributeValue().equals(endpointElement.getAttribute(
+ new QName(WSDL2Constants.BINDING_LOCAL_NAME)).getAttributeValue())
+ && endpoint
+ .getAttribute(new QName(WSDL2Constants.ATTRIBUTE_ADDRESS))
+ .getAttributeValue().equals(endpointElement.getAttribute(
+ new QName(WSDL2Constants.ATTRIBUTE_ADDRESS)).getAttributeValue())) {
endpointAlreadyAdded = true;
}
@@ -197,11 +206,15 @@
serviceElement.addChild(endpointElement);
}
}
+ }
+ Iterator iter = bindings.iterator();
+ while (iter.hasNext()) {
+ AxisBinding binding = (AxisBinding) iter.next();
descriptionElement
- .addChild(axisEndpoint.getBinding().toWSDL20(wsdl, tns, wsoap, whttp,
- interfaceName,
- axisService.getNameSpacesMap(),
- axisService.getWSAddressingFlag()));
+ .addChild(binding.toWSDL20(wsdl, tns, wsoap, whttp,
+ interfaceName,
+ axisService.getNameSpacesMap(),
+ axisService.getWSAddressingFlag()));
}
descriptionElement.addChild(serviceElement);
@@ -215,7 +228,8 @@
WSDLSerializationUtil.generateSOAP12Binding(omFactory, axisService, wsdl, wsoap,
tns));
descriptionElement.addChild(
- WSDLSerializationUtil.generateHTTPBinding(omFactory, axisService, wsdl, whttp, tns));
+ WSDLSerializationUtil.generateHTTPBinding(omFactory, axisService, wsdl, whttp,
+ tns));
descriptionElement
.addChild(WSDLSerializationUtil.generateServiceElement(omFactory, wsdl, tns,
axisService));
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?view=diff&rev=545475&r1=545474&r2=545475
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Fri Jun 8 03:55:11 2007
@@ -164,6 +164,9 @@
private static final String JAVAX_WSDL_VERBOSE_MODE_KEY = "javax.wsdl.verbose";
+ // As bindings are processed add it to this array so that we dont process the same binding twice
+ private Map processedBindings;
+
/**
* constructor taking in the service name and the port name
*
@@ -316,6 +319,8 @@
Port port;
AxisEndpoint axisEndpoint = null;
+ processedBindings = new HashMap();
+
// process the port type for this binding
// although we support multiports they must be belongs to same port type and should have the
// same soap style
@@ -367,14 +372,23 @@
copyExtensibleElements(wsdl4jPort.getExtensibilityElements(), wsdl4jDefinition,
axisEndpoint, BINDING);
- AxisBinding axisBinding = new AxisBinding();
+
Binding wsdl4jBinding = wsdl4jDefinition.getBinding(wsdl4jPort.getBinding().getQName());
- axisBinding.setName(wsdl4jBinding.getQName());
- axisBinding.setParent(axisEndpoint);
- axisEndpoint.setBinding(axisBinding);
addDocumentation(axisEndpoint, wsdl4jPort.getDocumentationElement());
- populateBinding(axisBinding, wsdl4jBinding, isSetMessageQNames);
+ if (processedBindings.containsKey(wsdl4jBinding.getQName())) {
+ axisEndpoint.setBinding(
+ (AxisBinding) processedBindings.get(wsdl4jBinding.getQName()));
+ } else {
+ AxisBinding axisBinding = new AxisBinding();
+ axisBinding.setName(wsdl4jBinding.getQName());
+ axisBinding.setParent(axisEndpoint);
+ axisEndpoint.setBinding(axisBinding);
+ axisEndpoint.setBinding(axisBinding);
+ populateBinding(axisBinding, wsdl4jBinding, isSetMessageQNames);
+ processedBindings.put(wsdl4jBinding.getQName(), axisBinding);
+ }
+
}
private void populatePortType(PortType wsdl4jPortType) throws AxisFault {
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java?view=diff&rev=545475&r1=545474&r2=545475
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java Fri Jun 8 03:55:11 2007
@@ -36,6 +36,7 @@
String DEFAULT_SOAP11_ENDPOINT_NAME = "SOAP11Endpoint";
String DEFAULT_SOAP12_ENDPOINT_NAME = "SOAP12Endpoint";
String DEFAULT_HTTP_ENDPOINT_NAME = "HTTPEndpoint";
+ String DEFAULT_HTTPS_PREFIX = "Secure";
String DEFAULT_INTERFACE_NAME = "ServiceInterface";
String TYPES_LOCAL_NALE = "types";
String INTERFACE_LOCAL_NAME = "interface";
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java?view=diff&rev=545475&r1=545474&r2=545475
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java Fri Jun 8 03:55:11 2007
@@ -285,15 +285,19 @@
WSDL2Constants.INTERFACE_LOCAL_NAME, null,
tns.getPrefix() + ":" + WSDL2Constants.DEFAULT_INTERFACE_NAME));
for (int i = 0; i < eprs.length; i++) {
+ String name = "";
String epr = eprs[i];
if (!epr.endsWith("/")) {
epr = epr + "/";
}
+ if (epr.startsWith("https://")) {
+ name = WSDL2Constants.DEFAULT_HTTPS_PREFIX;
+ }
OMElement soap11EndpointElement =
omFactory.createOMElement(WSDL2Constants.ENDPOINT_LOCAL_NAME, wsdl);
soap11EndpointElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_NAME, null,
- WSDL2Constants.DEFAULT_SOAP11_ENDPOINT_NAME + i));
+ name + WSDL2Constants.DEFAULT_SOAP11_ENDPOINT_NAME));
soap11EndpointElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.BINDING_LOCAL_NAME, null,
tns.getPrefix() + ":" + axisService.getName() +
@@ -305,7 +309,7 @@
omFactory.createOMElement(WSDL2Constants.ENDPOINT_LOCAL_NAME, wsdl);
soap12EndpointElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_NAME, null,
- WSDL2Constants.DEFAULT_SOAP12_ENDPOINT_NAME + i));
+ name + WSDL2Constants.DEFAULT_SOAP12_ENDPOINT_NAME));
soap12EndpointElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.BINDING_LOCAL_NAME, null,
tns.getPrefix() + ":" + axisService.getName() +
@@ -317,13 +321,34 @@
omFactory.createOMElement(WSDL2Constants.ENDPOINT_LOCAL_NAME, wsdl);
httpEndpointElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_NAME, null,
- WSDL2Constants.DEFAULT_HTTP_ENDPOINT_NAME + i));
+ name + WSDL2Constants.DEFAULT_HTTP_ENDPOINT_NAME));
httpEndpointElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.BINDING_LOCAL_NAME, null,
tns.getPrefix() + ":" + axisService.getName() + Java2WSDLConstants.HTTP_BINDING));
httpEndpointElement.addAttribute(
omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ADDRESS, null, epr));
serviceElement.addChild(httpEndpointElement);
+ if (epr.startsWith("https://")) {
+ OMElement soap11Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
+ soap11Documentation.setText("This endpoint exposes a SOAP 11 binding over a HTTPS");
+ soap11EndpointElement.addChild(soap11Documentation);
+ OMElement soap12Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
+ soap12Documentation.setText("This endpoint exposes a SOAP 12 binding over a HTTPS");
+ soap12EndpointElement.addChild(soap12Documentation);
+ OMElement httpDocumentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
+ httpDocumentation.setText("This endpoint exposes a HTTP binding over a HTTPS");
+ httpEndpointElement.addChild(httpDocumentation);
+ } else if (epr.startsWith("http://")) {
+ OMElement soap11Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
+ soap11Documentation.setText("This endpoint exposes a SOAP 11 binding over a HTTP");
+ soap11EndpointElement.addChild(soap11Documentation);
+ OMElement soap12Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
+ soap12Documentation.setText("This endpoint exposes a SOAP 12 binding over a HTTP");
+ soap12EndpointElement.addChild(soap12Documentation);
+ OMElement httpDocumentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
+ httpDocumentation.setText("This endpoint exposes a HTTP binding over a HTTP");
+ httpEndpointElement.addChild(httpDocumentation);
+ }
}
return serviceElement;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org