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 ke...@apache.org on 2007/05/29 06:39:33 UTC
svn commit: r542411 - in
/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2:
description/AxisBinding.java description/AxisService2WSDL2.java
util/WSDLSerializationUtil.java
Author: keithc
Date: Mon May 28 21:39:27 2007
New Revision: 542411
URL: http://svn.apache.org/viewvc?view=rev&rev=542411
Log:
Fixing couple of issues in ?wsdl2.
1. Setting the correct url for the binding type.
2. Adding endpoints for all transport listeners.
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.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/AxisBinding.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java?view=diff&rev=542411&r1=542410&r2=542411
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java Mon May 28 21:39:27 2007
@@ -130,6 +130,8 @@
if (WSDL2Constants.URI_WSDL2_SOAP.equals(type) || Constants.URI_SOAP11_HTTP.equals(type) ||
Constants.URI_SOAP12_HTTP.equals(type)) {
// SOAP Binding specific properties
+ bindingElement.addAttribute(
+ omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_TYPE, null, WSDL2Constants.URI_WSDL2_SOAP));
property = (String) options.get(WSDL2Constants.ATTR_WSOAP_VERSION);
if (property != null) {
if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(property)) {
@@ -166,14 +168,11 @@
bindingElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_METHOD_DEFAULT, whttp, property));
}
+ bindingElement.addAttribute(
+ omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_TYPE, null, WSDL2Constants.URI_WSDL2_HTTP));
}
// Common Properties
- property = getType();
- if (property != null) {
- bindingElement.addAttribute(
- omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_TYPE, null, property));
- }
property = (String) options.get(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING);
if (property != null) {
bindingElement.addAttribute(omFactory.createOMAttribute(
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java?view=diff&rev=542411&r1=542410&r2=542411
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL2.java Mon May 28 21:39:27 2007
@@ -14,6 +14,7 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamConstants;
+import javax.xml.namespace.QName;
import java.io.ByteArrayInputStream;
import java.io.StringWriter;
import java.io.OutputStream;
@@ -164,7 +165,7 @@
// Check whether the axisService has any endpoints. If they exists serialize them else
// generate default endpoint elements.
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()};
@@ -172,13 +173,34 @@
OMElement serviceElement = getServiceElement(wsdl, tns, omFactory, interfaceName);
Iterator iterator = endpointMap.values().iterator();
while (iterator.hasNext()) {
+ // With the new binding hierachy in place we need to do some extra checking here.
+ // If a service has both http and https listners up we should show two separate eprs
+ // If the service was deployed with a WSDL and it had two endpoints for http and
+ // https then we have two endpoints populated so we should serialize them instead
+ // of updating the endpoints.
AxisEndpoint axisEndpoint = (AxisEndpoint) iterator.next();
- serviceElement.addChild(axisEndpoint.toWSDL20(wsdl, tns, whttp, eprs[0]));
+ for (int i = 0; i < eprs.length; i++) {
+ OMElement endpointElement = axisEndpoint.toWSDL20(wsdl, tns, whttp, eprs[i]);
+ boolean endpointAlreadyAdded = false;
+ Iterator endpointsAdded = serviceElement.getChildren();
+ 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())) {
+ endpointAlreadyAdded = true;
+ }
- descriptionElement.addChild(axisEndpoint.getBinding().toWSDL20(wsdl, tns, wsoap, whttp,
- interfaceName,
- axisService.getNameSpacesMap(),
- axisService.getWSAddressingFlag()));
+ }
+ if (!endpointAlreadyAdded) {
+ serviceElement.addChild(endpointElement);
+ }
+ }
+ descriptionElement
+ .addChild(axisEndpoint.getBinding().toWSDL20(wsdl, tns, wsoap, whttp,
+ interfaceName,
+ axisService.getNameSpacesMap(),
+ axisService.getWSAddressingFlag()));
}
descriptionElement.addChild(serviceElement);
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=542411&r1=542410&r2=542411
==============================================================================
--- 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 Mon May 28 21:39:27 2007
@@ -278,18 +278,18 @@
eprs = new String[]{axisService.getName()};
}
OMElement serviceElement = null;
+ serviceElement = omFactory.createOMElement(WSDL2Constants.SERVICE_LOCAL_NAME, wsdl);
+ serviceElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME,
+ null, axisService.getName()));
+ serviceElement.addAttribute(omFactory.createOMAttribute(
+ WSDL2Constants.INTERFACE_LOCAL_NAME, null,
+ tns.getPrefix() + ":" + WSDL2Constants.DEFAULT_INTERFACE_NAME));
for (int i = 0; i < eprs.length; i++) {
- serviceElement = omFactory.createOMElement(WSDL2Constants.SERVICE_LOCAL_NAME, wsdl);
- serviceElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME,
- null, axisService.getName()));
- serviceElement.addAttribute(omFactory.createOMAttribute(
- WSDL2Constants.INTERFACE_LOCAL_NAME, null,
- tns.getPrefix() + ":" + WSDL2Constants.DEFAULT_INTERFACE_NAME));
OMElement soap11EndpointElement =
omFactory.createOMElement(WSDL2Constants.ENDPOINT_LOCAL_NAME, wsdl);
soap11EndpointElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_NAME, null,
- WSDL2Constants.DEFAULT_SOAP11_ENDPOINT_NAME));
+ WSDL2Constants.DEFAULT_SOAP11_ENDPOINT_NAME + i));
soap11EndpointElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.BINDING_LOCAL_NAME, null,
tns.getPrefix() + ":" + axisService.getName() +
@@ -301,7 +301,7 @@
omFactory.createOMElement(WSDL2Constants.ENDPOINT_LOCAL_NAME, wsdl);
soap12EndpointElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_NAME, null,
- WSDL2Constants.DEFAULT_SOAP12_ENDPOINT_NAME));
+ WSDL2Constants.DEFAULT_SOAP12_ENDPOINT_NAME + i));
soap12EndpointElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.BINDING_LOCAL_NAME, null,
tns.getPrefix() + ":" + axisService.getName() +
@@ -313,7 +313,7 @@
omFactory.createOMElement(WSDL2Constants.ENDPOINT_LOCAL_NAME, wsdl);
httpEndpointElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_NAME, null,
- WSDL2Constants.DEFAULT_HTTP_ENDPOINT_NAME));
+ WSDL2Constants.DEFAULT_HTTP_ENDPOINT_NAME + i));
httpEndpointElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.BINDING_LOCAL_NAME, null,
tns.getPrefix() + ":" + axisService.getName() + Java2WSDLConstants.HTTP_BINDING));
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org