Author: sergeyb
Date: Tue Sep 7 09:42:00 2010
New Revision: 993299
URL: http://svn.apache.org/viewvc?rev=993299&view=rev
Log:
Merged revisions 991923,991925,991927 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r991923 | sergeyb | 2010-09-02 14:00:10 +0100 (Thu, 02 Sep 2010) | 1 line
Updating ProviderImpl to have wsdlLocation attribute contain a pair of values
by default
........
r991925 | sergeyb | 2010-09-02 14:08:06 +0100 (Thu, 02 Sep 2010) | 1 line
Restoring the mungled comment
........
r991927 | sergeyb | 2010-09-02 14:11:09 +0100 (Thu, 02 Sep 2010) | 1 line
Removing println from the test
........
Added:
cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spi/ProviderImplTest.java
- copied, changed from r991923,
cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spi/ProviderImplTest.java
cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorServiceImpl.java
- copied, changed from r991923,
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorServiceImpl.java
Removed:
cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spi/ProverImplTest.java
cxf/branches/2.2.x-fixes/testutils/src/main/java/org/apache/locator_test/LocatorServiceImpl.java
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorClientServerTest.java
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Sep 7 09:42:00 2010
@@ -1 +1 @@
-/cxf/trunk:989123,989434,990386,990593,991324,991416,991797,991893,992000
+/cxf/trunk:989123,989434,990386,990593,991324,991416,991797,991893,991923,991925-991927,992000
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java?rev=993299&r1=993298&r2=993299&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
(original)
+++
cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
Tue Sep 7 09:42:00 2010
@@ -47,6 +47,8 @@ import org.apache.cxf.common.logging.Log
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.jaxws.EndpointUtils;
import org.apache.cxf.jaxws.ServiceImpl;
+import org.apache.cxf.message.MessageUtils;
+import org.apache.cxf.phase.PhaseInterceptorChain;
import org.apache.cxf.staxutils.StaxUtils;
import org.apache.cxf.staxutils.W3CDOMStreamWriter;
import org.apache.cxf.ws.addressing.JAXWSAConstants;
@@ -138,7 +140,7 @@ public class ProviderImpl extends javax.
List<Element>
referenceParameters,
List<Element>
elements,
Map<QName, String>
attributes) {
- //CHECKSTYLE:ON
+ //CHECKSTYLE:ON
if (serviceName != null && portName != null
&& wsdlDocumentLocation != null && interfaceName == null) {
Bus bus = BusFactory.getThreadDefaultBus();
@@ -178,74 +180,92 @@ public class ProviderImpl extends javax.
writer.writeEndElement();
}
- writer.writeStartElement(JAXWSAConstants.WSA_PREFIX,
JAXWSAConstants.WSA_METADATA_NAME,
- JAXWSAConstants.NS_WSA);
- writer.writeNamespace(JAXWSAConstants.WSAW_PREFIX,
JAXWSAConstants.NS_WSAW);
- writer.writeNamespace(JAXWSAConstants.WSAM_PREFIX,
JAXWSAConstants.NS_WSAM);
- if (wsdlDocumentLocation != null) {
- writer.writeNamespace(JAXWSAConstants.WSDLI_PFX,
- JAXWSAConstants.NS_WSDLI);
- writer.writeAttribute(JAXWSAConstants.WSDLI_PFX,
- JAXWSAConstants.NS_WSDLI,
- JAXWSAConstants.WSDLI_WSDLLOCATION,
- wsdlDocumentLocation);
- }
- if (interfaceName != null) {
- writer.writeStartElement(JAXWSAConstants.WSAM_PREFIX,
- JAXWSAConstants.WSAM_INTERFACE_NAME,
- JAXWSAConstants.NS_WSAM);
- String portTypePrefix = interfaceName.getPrefix();
- if (portTypePrefix == null || portTypePrefix.equals("")) {
- portTypePrefix = "ns1";
+ if (wsdlDocumentLocation != null
+ || interfaceName != null
+ || serviceName != null
+ || metadata != null) {
+
+
+ writer.writeStartElement(JAXWSAConstants.WSA_PREFIX,
JAXWSAConstants.WSA_METADATA_NAME,
+ JAXWSAConstants.NS_WSA);
+ writer.writeNamespace(JAXWSAConstants.WSAW_PREFIX,
JAXWSAConstants.NS_WSAW);
+ writer.writeNamespace(JAXWSAConstants.WSAM_PREFIX,
JAXWSAConstants.NS_WSAM);
+
+ if (wsdlDocumentLocation != null) {
+ boolean includeLocationOnly = false;
+ org.apache.cxf.message.Message message =
PhaseInterceptorChain.getCurrentMessage();
+ if (message != null) {
+ includeLocationOnly = MessageUtils.isTrue(
+
message.getContextualProperty("org.apache.cxf.wsa.metadata.wsdlLocationOnly"));
+ }
+ String attrubuteValue = serviceName != null &&
!includeLocationOnly
+ ? serviceName.getNamespaceURI() + " " +
wsdlDocumentLocation
+ : wsdlDocumentLocation;
+ writer.writeNamespace(JAXWSAConstants.WSDLI_PFX,
+ JAXWSAConstants.NS_WSDLI);
+ writer.writeAttribute(JAXWSAConstants.WSDLI_PFX,
+ JAXWSAConstants.NS_WSDLI,
+ JAXWSAConstants.WSDLI_WSDLLOCATION,
+ attrubuteValue);
}
- writer.writeNamespace(portTypePrefix,
interfaceName.getNamespaceURI());
- writer.writeCharacters(portTypePrefix + ":" +
interfaceName.getLocalPart());
- writer.writeEndElement();
- }
-
-
- String serviceNamePrefix = null;
-
- if (serviceName != null) {
- serviceNamePrefix = (serviceName.getPrefix() == null ||
serviceName.getPrefix().length() == 0)
- ? "ns2" : serviceName.getPrefix();
-
- writer.writeStartElement(JAXWSAConstants.WSAM_PREFIX,
- JAXWSAConstants.WSAM_SERVICENAME_NAME,
- JAXWSAConstants.NS_WSAM);
-
- if (portName != null) {
- writer.writeAttribute(JAXWSAConstants.WSAM_ENDPOINT_NAME,
portName.getLocalPart());
+ if (interfaceName != null) {
+ writer.writeStartElement(JAXWSAConstants.WSAM_PREFIX,
+
JAXWSAConstants.WSAM_INTERFACE_NAME,
+ JAXWSAConstants.NS_WSAM);
+ String portTypePrefix = interfaceName.getPrefix();
+ if (portTypePrefix == null || portTypePrefix.equals("")) {
+ portTypePrefix = "ns1";
+ }
+ writer.writeNamespace(portTypePrefix,
interfaceName.getNamespaceURI());
+ writer.writeCharacters(portTypePrefix + ":" +
interfaceName.getLocalPart());
+ writer.writeEndElement();
}
- writer.writeNamespace(serviceNamePrefix,
serviceName.getNamespaceURI());
- writer.writeCharacters(serviceNamePrefix + ":" +
serviceName.getLocalPart());
-
- writer.writeEndElement();
- }
-
- if (wsdlDocumentLocation != null) {
-
- writer.writeStartElement(WSDLConstants.WSDL_PREFIX,
WSDLConstants.QNAME_DEFINITIONS
- .getLocalPart(), WSDLConstants.NS_WSDL11);
- writer.writeNamespace(WSDLConstants.WSDL_PREFIX,
WSDLConstants.NS_WSDL11);
- writer.writeStartElement(WSDLConstants.WSDL_PREFIX,
-
WSDLConstants.QNAME_IMPORT.getLocalPart(),
-
WSDLConstants.QNAME_IMPORT.getNamespaceURI());
+
+
+ String serviceNamePrefix = null;
+
if (serviceName != null) {
- writer.writeAttribute(WSDLConstants.ATTR_NAMESPACE,
serviceName.getNamespaceURI());
+ serviceNamePrefix =
+ (serviceName.getPrefix() == null ||
serviceName.getPrefix().length() == 0)
+ ? "ns2" : serviceName.getPrefix();
+
+ writer.writeStartElement(JAXWSAConstants.WSAM_PREFIX,
+
JAXWSAConstants.WSAM_SERVICENAME_NAME,
+ JAXWSAConstants.NS_WSAM);
+
+ if (portName != null) {
+
writer.writeAttribute(JAXWSAConstants.WSAM_ENDPOINT_NAME,
portName.getLocalPart());
+ }
+ writer.writeNamespace(serviceNamePrefix,
serviceName.getNamespaceURI());
+ writer.writeCharacters(serviceNamePrefix + ":" +
serviceName.getLocalPart());
+
+ writer.writeEndElement();
}
- writer.writeAttribute(WSDLConstants.ATTR_LOCATION,
wsdlDocumentLocation);
- writer.writeEndElement();
- writer.writeEndElement();
- }
-
- if (metadata != null) {
- for (Element e : metadata) {
- StaxUtils.writeElement(e, writer, true);
+
+ if (wsdlDocumentLocation != null) {
+
+ writer.writeStartElement(WSDLConstants.WSDL_PREFIX,
WSDLConstants.QNAME_DEFINITIONS
+ .getLocalPart(), WSDLConstants.NS_WSDL11);
+ writer.writeNamespace(WSDLConstants.WSDL_PREFIX,
WSDLConstants.NS_WSDL11);
+ writer.writeStartElement(WSDLConstants.WSDL_PREFIX,
+
WSDLConstants.QNAME_IMPORT.getLocalPart(),
+
WSDLConstants.QNAME_IMPORT.getNamespaceURI());
+ if (serviceName != null) {
+ writer.writeAttribute(WSDLConstants.ATTR_NAMESPACE,
serviceName.getNamespaceURI());
+ }
+ writer.writeAttribute(WSDLConstants.ATTR_LOCATION,
wsdlDocumentLocation);
+ writer.writeEndElement();
+ writer.writeEndElement();
+ }
+
+ if (metadata != null) {
+ for (Element e : metadata) {
+ StaxUtils.writeElement(e, writer, true);
+ }
}
+
+ writer.writeEndElement();
}
-
- writer.writeEndElement();
if (elements != null) {
for (Element e : elements) {
Copied:
cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spi/ProviderImplTest.java
(from r991923,
cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spi/ProviderImplTest.java)
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spi/ProviderImplTest.java?p2=cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spi/ProviderImplTest.java&p1=cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spi/ProviderImplTest.java&r1=991923&r2=993299&rev=993299&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spi/ProviderImplTest.java
(original)
+++
cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spi/ProviderImplTest.java
Tue Sep 7 09:42:00 2010
@@ -44,9 +44,8 @@ public class ProviderImplTest extends or
assertTrue("Embeded wsdl element is not generated",
sw.toString().indexOf(expected) > -1);
assertTrue("wsdlLocation attribute has the wrong value",
sw.toString().contains("wsdli:wsdlLocation=\"http://cxf.apache.org wsdlLoc\""));
- System.out.println(sw.toString());
-
}
+
@After
public void tearDown() {
BusFactory.setDefaultBus(null);
Modified:
cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorClientServerTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorClientServerTest.java?rev=993299&r1=993298&r2=993299&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorClientServerTest.java
(original)
+++
cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorClientServerTest.java
Tue Sep 7 09:42:00 2010
@@ -34,7 +34,7 @@ import org.apache.cxf.testutil.common.Ab
import org.apache.locator.LocatorService;
import org.apache.locator.LocatorService_Service;
import org.apache.locator.types.QueryEndpoints;
-import org.apache.locator_test.LocatorServiceImpl;
+
import org.junit.BeforeClass;
import org.junit.Test;
@@ -103,6 +103,34 @@ public class LocatorClientServerTest ext
port.queryEndpoints(new QueryEndpoints());
}
+
+ @Test
+ public void testLookupEndpointAndVerifyWsdlLocationAndNamespace() throws
Exception {
+ URL wsdl = getClass().getResource("/wsdl/locator.wsdl");
+ assertNotNull(wsdl);
+
+ LocatorService_Service ss = new LocatorService_Service(wsdl,
serviceName);
+ LocatorService port = ss.getLocatorServicePort();
+ updateAddressPort(port, PORT);
+
+ W3CEndpointReference epr = port.lookupEndpoint(new
QName("http://service/1", "Number"));
+ String eprString = epr.toString();
+ assertTrue(eprString.contains("Metadata
wsdli:wsdlLocation=\"http://service/1 wsdlLoc\""));
+ }
+
+ @Test
+ public void testLookupEndpointAndVerifyWsdlLocationOnly() throws Exception
{
+ URL wsdl = getClass().getResource("/wsdl/locator.wsdl");
+ assertNotNull(wsdl);
+
+ LocatorService_Service ss = new LocatorService_Service(wsdl,
serviceName);
+ LocatorService port = ss.getLocatorServicePort();
+ updateAddressPort(port, PORT);
+
+ W3CEndpointReference epr = port.lookupEndpoint(new
QName("http://service/2", "Number"));
+ String eprString = epr.toString();
+ assertTrue(eprString.contains("Metadata
wsdli:wsdlLocation=\"wsdlLoc\""));
+ }
@Test
public void testIllegalState() throws Exception {
Copied:
cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorServiceImpl.java
(from r991923,
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorServiceImpl.java)
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorServiceImpl.java?p2=cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorServiceImpl.java&p1=cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorServiceImpl.java&r1=991923&r2=993299&rev=993299&view=diff
==============================================================================
---
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorServiceImpl.java
(original)
+++
cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/LocatorServiceImpl.java
Tue Sep 7 09:42:00 2010
@@ -91,7 +91,7 @@ public class LocatorServiceImpl implemen
// create a wsdlLocation attribute with a location only
if (serviceQname.getNamespaceURI().endsWith("2")) {
Message m = PhaseInterceptorChain.getCurrentMessage();
-
m.setContextualProperty("org.apache.cxf.wsa.metadata.wsdlLocationOnly", "true");
+ m.put("org.apache.cxf.wsa.metadata.wsdlLocationOnly", "true");
}
return eprBuilder.build();