cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r945881 - in /cxf/branches/2.2.x-fixes: ./ api/src/main/java/org/apache/cxf/ws/addressing/ api/src/main/java/org/apache/cxf/wsdl/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/con...
Date Tue, 18 May 2010 20:55:42 GMT
Author: dkulp
Date: Tue May 18 20:55:42 2010
New Revision: 945881

URL: http://svn.apache.org/viewvc?rev=945881&view=rev
Log:
Merged revisions 945124 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r945124 | dkulp | 2010-05-17 08:59:49 -0400 (Mon, 17 May 2010) | 1 line
  
  Start implementing some JAX-WS 2.2 things that can be implemented in 2.1
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/ws/addressing/JAXWSAConstants.java
    cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointReferenceBuilder.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextImpl.java
    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/ClientServerMiscTest.java

Propchange: cxf/branches/2.2.x-fixes/
            ('svn:mergeinfo' removed)

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/ws/addressing/JAXWSAConstants.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/ws/addressing/JAXWSAConstants.java?rev=945881&r1=945880&r2=945881&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/ws/addressing/JAXWSAConstants.java
(original)
+++ cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/ws/addressing/JAXWSAConstants.java
Tue May 18 20:55:42 2010
@@ -30,6 +30,8 @@ public final class JAXWSAConstants {
     
     public static final String WSAW_PREFIX = "wsaw";
     public static final String NS_WSAW = "http://www.w3.org/2006/05/addressing/wsdl";
+    public static final String WSAM_PREFIX = "wsam";
+    public static final String NS_WSAM = "http://www.w3.org/2007/05/addressing/metadata";
 
     public static final QName WSAW_ACTION_QNAME = new QName(NS_WSAW,  "Action");
     
@@ -38,18 +40,19 @@ public final class JAXWSAConstants {
     public static final String NS_WSA = "http://www.w3.org/2005/08/addressing";
     public static final String WSA_PREFIX = "wsa";
     public static final String WSA_XSD = "http://www.w3.org/2006/03/addressing/ws-addr.xsd";
-    
     public static final String WSA_ERF_NAME = "EndpointReference";
     public static final String WSA_REFERENCEPARAMETERS_NAME = "ReferenceParameters";
     public static final String WSA_METADATA_NAME = "Metadata";
     public static final String WSA_ADDRESS_NAME = "Address";
         
-    public static final String WSAW_SERVICENAME_NAME = "ServiceName";
-    public static final String WSAW_INTERFACE_NAME = "InterfaceName";
-    public static final String WSAW_ENDPOINT_NAME = "EndpointName";    
+    public static final String WSAM_SERVICENAME_NAME = "ServiceName";
+    public static final String WSAM_INTERFACE_NAME = "InterfaceName";
+    public static final String WSAM_ENDPOINT_NAME = "EndpointName";    
 
 
-    
+    public static final String WSDLI_PFX = "wsdli";
+    public static final String WSDLI_WSDLLOCATION = "wsdlLocation";
+    public static final String NS_WSDLI = "http://www.w3.org/ns/wsdl-instance";
 
     /**
      * Well-known Property names for AddressingProperties in BindingProvider

Modified: cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java?rev=945881&r1=945880&r2=945881&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
(original)
+++ cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
Tue May 18 20:55:42 2010
@@ -327,7 +327,8 @@ public final class EndpointReferenceUtil
             if (obj instanceof Element) {
                 Node node = (Element)obj;
                 if ((node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAW)
-                    || node.getNamespaceURI().equals(NS_WSAW_2005))
+                    || node.getNamespaceURI().equals(NS_WSAW_2005)
+                    || node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAM))
                     && node.getLocalName().equals("ServiceName")) {
                     String content = node.getTextContent();
                     String namespaceURI = node.getFirstChild().getNamespaceURI();
@@ -369,7 +370,8 @@ public final class EndpointReferenceUtil
                 if (obj instanceof Element) {
                     Node node = (Element)obj;
                     if ((node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAW)
-                        || node.getNamespaceURI().equals(NS_WSAW_2005))
+                        || node.getNamespaceURI().equals(NS_WSAW_2005)
+                        || node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAM))
                         && node.getNodeName().contains("ServiceName")) {
                         Node item = node.getAttributes().getNamedItem("EndpointName");
                         return item != null ? item.getTextContent() : null;
@@ -400,8 +402,9 @@ public final class EndpointReferenceUtil
                     Element node = (Element)obj;
                     if (node.getNodeName().contains("ServiceName")
                         && (node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAW)
-                        || node.getNamespaceURI().equals(NS_WSAW_2005))) {
-                        node.setAttribute(JAXWSAConstants.WSAW_ENDPOINT_NAME, portName);
+                        || node.getNamespaceURI().equals(NS_WSAW_2005)
+                        || node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAM))) {
+                        node.setAttribute(JAXWSAConstants.WSAM_ENDPOINT_NAME, portName);
                     }
                 } else if (obj instanceof JAXBElement) {
                     Object val = ((JAXBElement)obj).getValue();
@@ -447,7 +450,8 @@ public final class EndpointReferenceUtil
         for (Object obj : metadata.getAny()) {
             if (obj instanceof Element) {
                 Node node = (Element)obj;
-                if (node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAW)
+                if ((node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAW)
+                    || node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAM))
                     && node.getNodeName().contains("InterfaceName")) {
                     
                     String content = node.getTextContent();

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java?rev=945881&r1=945880&r2=945881&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
Tue May 18 20:55:42 2010
@@ -20,6 +20,7 @@ package org.apache.cxf.jaxws;
 
 import java.security.AccessController;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -34,6 +35,7 @@ import javax.xml.transform.Source;
 import javax.xml.ws.Binding;
 import javax.xml.ws.EndpointReference;
 import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceFeature;
 import javax.xml.ws.WebServicePermission;
 import javax.xml.ws.handler.Handler;
 import javax.xml.ws.http.HTTPBinding;
@@ -131,16 +133,25 @@ public class EndpointImpl extends javax.
      * WebService annotation. Optional.
      */
     public EndpointImpl(Bus b, Object i, String bindingUri, String wsdl) {
+        this(b, i, bindingUri, wsdl, null);
+    }
+    public EndpointImpl(Bus b, Object i, String bindingUri, String wsdl, WebServiceFeature
f[]) {
         bus = b;
         implementor = i;
         this.bindingUri = bindingUri;
         wsdlLocation = wsdl == null ? null : new String(wsdl);
         serverFactory = new JaxWsServerFactoryBean();
+        if (f != null) {
+            ((JaxWsServiceFactoryBean)serverFactory.getServiceFactory()).setWsFeatures(Arrays.asList(f));
+        }
     }
         
     public EndpointImpl(Bus b, Object i, String bindingUri) {
         this(b, i, bindingUri, (String)null);
     }
+    public EndpointImpl(Bus b, Object i, String bindingUri, WebServiceFeature features[])
{
+        this(b, i, bindingUri, (String)null, features);
+    }
    
     public EndpointImpl(Bus bus, Object implementor) {
         this(bus, implementor, (String) null);
@@ -746,4 +757,11 @@ public class EndpointImpl extends javax.
                 .getName()).toString());
         }
     }
+    
+    /*
+    //new in 2.2, but introduces a new class not found in 2.1
+    public void setEndpointContext(EndpointContext ctxt) {
+        //TODO - JAXWS 2.2
+    }
+    */
 }

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointReferenceBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointReferenceBuilder.java?rev=945881&r1=945880&r2=945881&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointReferenceBuilder.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointReferenceBuilder.java
Tue May 18 20:55:42 2010
@@ -50,10 +50,11 @@ public class EndpointReferenceBuilder {
         builder.address(this.endpoint.getEndpointInfo().getAddress());
         builder.serviceName(this.endpoint.getService().getName());
         builder.endpointName(this.endpoint.getEndpointInfo().getName());
-        
-        //TODO: get wsdlDocumentLocation
-        //builder.wsdlDocumentLocation(endpoint.getService().getServiceInfos().toString());
       
-        
+        if (this.endpoint.getEndpointInfo().getService()
+                .getDescription() != null) {
+            builder.wsdlDocumentLocation(this.endpoint.getEndpointInfo().getService()
+                                         .getDescription().getBaseURI());
+        }
         return builder.build();
     }
 

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=945881&r1=945880&r2=945881&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
Tue May 18 20:55:42 2010
@@ -22,6 +22,7 @@ package org.apache.cxf.jaxws;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
@@ -116,12 +117,13 @@ public class ServiceImpl extends Service
 
     private final Collection<QName> ports = new HashSet<QName>();
     private Map<QName, PortInfoImpl> portInfos = new HashMap<QName, PortInfoImpl>();
+    private WebServiceFeature serviceFeatures[];
 
-
-    public ServiceImpl(Bus b, URL url, QName name, Class<?> cls) {
+    public ServiceImpl(Bus b, URL url, QName name, Class<?> cls, WebServiceFeature
... f) {
         bus = b;
         this.serviceName = name;
         clazz = cls;
+        serviceFeatures = f;
         
         handlerResolver = new HandlerResolverImpl(bus, name, clazz);
         
@@ -220,6 +222,17 @@ public class ServiceImpl extends Service
         portInfos.put(portName, portInfo);
     }
 
+    private WebServiceFeature[] getAllFeatures(WebServiceFeature features[]) {
+        if (serviceFeatures == null || serviceFeatures.length == 0) {
+            return features;
+        } else if (features == null || features.length == 0) {
+            return serviceFeatures;
+        }
+        List<WebServiceFeature> f = new ArrayList<WebServiceFeature>(Arrays.asList(features));
+        f.addAll(Arrays.asList(serviceFeatures));
+        return f.toArray(new WebServiceFeature[f.size()]);
+    }
+    
     private JaxWsClientEndpointImpl getJaxwsEndpoint(QName portName, AbstractServiceFactoryBean
sf, 
                                       WebServiceFeature...features) {
         Service service = sf.getService();
@@ -246,7 +259,8 @@ public class ServiceImpl extends Service
         }
 
         try {
-            return new JaxWsClientEndpointImpl(bus, service, ei, this, features);
+            return new JaxWsClientEndpointImpl(bus, service, ei, this,
+                                               getAllFeatures(features));
         } catch (EndpointException e) {
             throw new WebServiceException(e);
         }
@@ -392,7 +406,10 @@ public class ServiceImpl extends Service
         JaxWsClientFactoryBean clientFac = (JaxWsClientFactoryBean) proxyFac.getClientFactoryBean();
         JaxWsServiceFactoryBean serviceFactory = (JaxWsServiceFactoryBean) proxyFac.getServiceFactory();
         proxyFac.initFeatures();
-        serviceFactory.setWsFeatures(Arrays.asList(features));
+        WebServiceFeature f[] = getAllFeatures(features);
+        if (f != null) {
+            serviceFactory.setWsFeatures(Arrays.asList(f));
+        }
         
         proxyFac.setBus(bus);
         proxyFac.setServiceClass(serviceEndpointInterface);

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextImpl.java?rev=945881&r1=945880&r2=945881&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextImpl.java
Tue May 18 20:55:42 2010
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.jaxws.context;
 
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.security.Principal;
 import java.util.logging.Logger;
 
@@ -70,7 +72,6 @@ public class WebServiceContextImpl imple
         return ctx.isUserInRole(role);
     }
     
-    //  TODO JAX-WS 2.1
     public EndpointReference getEndpointReference(Element... referenceParameters) {
         WrappedMessageContext ctx = (WrappedMessageContext)getMessageContext();
         org.apache.cxf.message.Message msg = ctx.getWrappedMessage();
@@ -80,8 +81,24 @@ public class WebServiceContextImpl imple
         builder.address(ep.getEndpointInfo().getAddress());
         builder.serviceName(ep.getService().getName());
         builder.endpointName(ep.getEndpointInfo().getName());
-
-//        builder.wsdlDocumentLocation(wsdlLocation);        
+        URI wsdlDescription = ep.getEndpointInfo().getProperty("URI", URI.class);
+        if (wsdlDescription == null) {
+            String address = ep.getEndpointInfo().getAddress();
+            try {
+                wsdlDescription = new URI(address + "?wsdl");
+            } catch (URISyntaxException e) {
+                // do nothing
+            }
+            ep.getEndpointInfo().setProperty("URI", wsdlDescription);
+        }
+        builder.wsdlDocumentLocation(wsdlDescription.toString());
+        
+        /*
+        if (ep.getEndpointInfo().getService().getDescription() != null) {
+            builder.wsdlDocumentLocation(ep.getEndpointInfo().getService()
+                                     .getDescription().getBaseURI());
+        }
+        */
         if (referenceParameters != null) {
             for (Element referenceParameter : referenceParameters) {
                 builder.referenceParameter(referenceParameter);

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=945881&r1=945880&r2=945881&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 May 18 20:55:42 2010
@@ -19,9 +19,9 @@
 
 package org.apache.cxf.jaxws.spi;
 
-import java.io.IOException;
 import java.net.URL;
 import java.util.List;
+import java.util.Map;
 import java.util.logging.Logger;
 
 import javax.wsdl.Definition;
@@ -29,8 +29,6 @@ import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
 import javax.xml.transform.Source;
 import javax.xml.ws.Endpoint;
 import javax.xml.ws.EndpointReference;
@@ -46,11 +44,11 @@ import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.WSDLConstants;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxws.EndpointImpl;
 import org.apache.cxf.jaxws.EndpointUtils;
 import org.apache.cxf.jaxws.ServiceImpl;
 import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.staxutils.W3CDOMStreamWriter;
 import org.apache.cxf.ws.addressing.JAXWSAConstants;
 import org.apache.cxf.wsdl.WSDLManager;
 
@@ -64,6 +62,16 @@ public class ProviderImpl extends javax.
         Bus bus = BusFactory.getThreadDefaultBus();
         return new ServiceImpl(bus, url, qname, cls);
     }
+    //new in 2.2
+    public ServiceDelegate createServiceDelegate(URL wsdlDocumentLocation,
+                                                 QName serviceName,
+                                                 Class serviceClass,
+                                                 WebServiceFeature ... features) {
+        Bus bus = BusFactory.getThreadDefaultBus();
+        return new ServiceImpl(bus, wsdlDocumentLocation,
+                               serviceName, serviceClass, features);
+        
+    }
 
     @Override
     public Endpoint createEndpoint(String bindingId, Object implementor) {
@@ -77,6 +85,19 @@ public class ProviderImpl extends javax.
             throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString());
         }
     }
+    //new in 2.2
+    public Endpoint createEndpoint(String bindingId,
+                                   Object implementor,
+                                   WebServiceFeature ... features) {
+        EndpointImpl ep = null;
+        if (EndpointUtils.isValidImplementor(implementor)) {
+            Bus bus = BusFactory.getThreadDefaultBus();
+            ep = new EndpointImpl(bus, implementor, bindingId, features);
+            return ep;
+        } else {
+            throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString());
+        }
+    }
 
     @Override
     public Endpoint createAndPublishEndpoint(String url, Object implementor) {
@@ -84,31 +105,53 @@ public class ProviderImpl extends javax.
         ep.publish(url);
         return ep;
     }
+    //new in 2.2
+    public Endpoint createAndPublishEndpoint(String address,
+                                             Object implementor, WebServiceFeature ... features)
{
+        Endpoint ep = createEndpoint(null, implementor, features);
+        ep.publish(address);
+        return ep;
+    }
 
-    public W3CEndpointReference createW3CEndpointReference(String address, QName serviceName,
QName portName,
+    public W3CEndpointReference createW3CEndpointReference(String address, 
+                                                           QName serviceName, 
+                                                           QName portName,
                                                            List<Element> metadata,
                                                            String wsdlDocumentLocation,
                                                            List<Element> referenceParameters)
{
-        QName portType = null;
-        if (serviceName != null && portName != null && wsdlDocumentLocation
!= null) {
+        return createW3CEndpointReference(address, null, serviceName, portName,
+                                          metadata, wsdlDocumentLocation, referenceParameters,
+                                          null, null);
+    }
+    //CHECKSTYLE:OFF - spec requires a bunch of params
+    public W3CEndpointReference createW3CEndpointReference(String address,
+                                                           QName interfaceName, 
+                                                           QName serviceName, 
+                                                           QName portName,
+                                                           List<Element> metadata,
+                                                           String wsdlDocumentLocation,
+                                                           List<Element> referenceParameters,
+                                                           List<Element> elements,
+                                                           Map<QName, String> attributes)
{
+        //CHECKSTYLE:ON
+        if (serviceName != null && portName != null 
+            && wsdlDocumentLocation != null && interfaceName == null) {
             Bus bus = BusFactory.getThreadDefaultBus();
             WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);          
             try {
                 Definition def = wsdlManager.getDefinition(wsdlDocumentLocation);
-                portType = def.getService(serviceName).getPort(portName.getLocalPart()).getBinding()
+                interfaceName = def.getService(serviceName).getPort(portName.getLocalPart()).getBinding()
                     .getPortType().getQName();
             } catch (Exception e) {
                 // do nothing
             }
         }
-        CachedOutputStream cos = new CachedOutputStream();
-        XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(cos);
+        if (serviceName == null && portName == null && address == null) {
+            throw new IllegalStateException("Address in an EPR cannot be null, "
+                                            + " when serviceName or portName is null");
+        }
         try {
-            // TODO: when serviceName/portName is null
-            if (serviceName == null && portName == null && address == null)
{
-                throw new IllegalStateException("Address in an EPR cannot be null, "
-                                                + " when serviceName or portName is null");
-            }
+            W3CDOMStreamWriter writer = new W3CDOMStreamWriter();
             writer.setPrefix(JAXWSAConstants.WSA_PREFIX, JAXWSAConstants.NS_WSA);
             writer.writeStartElement(JAXWSAConstants.WSA_PREFIX, JAXWSAConstants.WSA_ERF_NAME,
                                      JAXWSAConstants.NS_WSA);
@@ -133,16 +176,25 @@ public class ProviderImpl extends javax.
             writer.writeStartElement(JAXWSAConstants.WSA_PREFIX, JAXWSAConstants.WSA_METADATA_NAME,
                                      JAXWSAConstants.NS_WSA);
             writer.writeNamespace(JAXWSAConstants.WSAW_PREFIX, JAXWSAConstants.NS_WSAW);
-
-            if (portType != null) {
-                writer.writeStartElement(JAXWSAConstants.WSAW_PREFIX, JAXWSAConstants.WSAW_INTERFACE_NAME,
-                                         JAXWSAConstants.NS_WSAW);
-                String portTypePrefix = portType.getPrefix();
+            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";
                 }
-                writer.writeNamespace(portTypePrefix, portType.getNamespaceURI());
-                writer.writeCharacters(portTypePrefix + ":" + portType.getLocalPart());
+                writer.writeNamespace(portTypePrefix, interfaceName.getNamespaceURI());
+                writer.writeCharacters(portTypePrefix + ":" + interfaceName.getLocalPart());
                 writer.writeEndElement();
             }
 
@@ -153,11 +205,12 @@ public class ProviderImpl extends javax.
                 serviceNamePrefix = (serviceName.getPrefix() == null || serviceName.getPrefix().length()
== 0)
                     ? "ns2" : serviceName.getPrefix();
 
-                writer.writeStartElement(JAXWSAConstants.WSAW_PREFIX, JAXWSAConstants.WSAW_SERVICENAME_NAME,
-                                         JAXWSAConstants.NS_WSAW);
+                writer.writeStartElement(JAXWSAConstants.WSAM_PREFIX,
+                                         JAXWSAConstants.WSAM_SERVICENAME_NAME,
+                                         JAXWSAConstants.NS_WSAM);
 
                 if (portName != null) {
-                    writer.writeAttribute(JAXWSAConstants.WSAW_ENDPOINT_NAME, portName.getLocalPart());
+                    writer.writeAttribute(JAXWSAConstants.WSAM_ENDPOINT_NAME, portName.getLocalPart());
                 }
                 writer.writeNamespace(serviceNamePrefix, serviceName.getNamespaceURI());
                 writer.writeCharacters(serviceNamePrefix + ":" + serviceName.getLocalPart());
@@ -188,21 +241,18 @@ public class ProviderImpl extends javax.
             }
 
             writer.writeEndElement();
+            
+            if (elements != null) {
+                for (Element e : elements) {
+                    StaxUtils.writeElement(e, writer, true);
+                }
+            }
             writer.writeEndElement();
             writer.flush();
-        } catch (XMLStreamException e) {
-            throw new WebServiceException(new Message("ERROR_UNMARSHAL_ENDPOINTREFERENCE",
LOG).toString(),
-                                          e);
-        }
 
-        try {
             Unmarshaller unmarshaller = getJAXBContext().createUnmarshaller();
-            return (W3CEndpointReference)unmarshaller.unmarshal(cos.getInputStream());
-
-        } catch (JAXBException e) {
-            throw new WebServiceException(new Message("ERROR_UNMARSHAL_ENDPOINTREFERENCE",
LOG).toString(),
-                                          e);
-        } catch (IOException e) {
+            return (W3CEndpointReference)unmarshaller.unmarshal(writer.getDocument());
+        } catch (Exception e) {
             throw new WebServiceException(new Message("ERROR_UNMARSHAL_ENDPOINTREFERENCE",
LOG).toString(),
                                           e);
         }
@@ -235,5 +285,11 @@ public class ProviderImpl extends javax.
         }
         return jaxbContext;
     }
-
+    /*
+    //new in 2.2, but introduces a new class not found in 2.1
+    public Endpoint createEndpoint(String bindingId, Class<?> implementorClass,
+                                   Invoker invoker, WebServiceFeature ... features) {
+        //TODO - JAXWS 2.2
+    }
+    */
 }

Modified: cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=945881&r1=945880&r2=945881&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
Tue May 18 20:55:42 2010
@@ -33,6 +33,7 @@ import java.util.Map;
 import java.util.Set;
 
 import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Holder;
 import javax.xml.ws.Service;
 import javax.xml.ws.soap.SOAPBinding;
@@ -236,6 +237,7 @@ public class ClientServerMiscTest extend
         DocLitWrappedCodeFirstServiceMissingOps port = service.getPort(portName,
                                   DocLitWrappedCodeFirstServiceMissingOps.class);
 
+        ((BindingProvider)port).getEndpointReference();
         int[] ret = port.echoIntArray(new int[] {1, 2});
         assertNotNull(ret);
         ret = port.echoIntArray(new int[] {1, 2});



Mime
View raw message