cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r953819 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointReferenceBuilder.java rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
Date Fri, 11 Jun 2010 18:39:02 GMT
Author: dkulp
Date: Fri Jun 11 18:39:02 2010
New Revision: 953819

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

........
  r952550 | ema | 2010-06-08 02:51:07 -0400 (Tue, 08 Jun 2010) | 1 line
  
  [CXF-2840]:Process the wsdl port extenstion EPR
........

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/EndpointReferenceBuilder.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java

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/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=953819&r1=953818&r2=953819&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
Fri Jun 11 18:39:02 2010
@@ -19,16 +19,27 @@
 
 package org.apache.cxf.jaxws;
 
+import java.util.Iterator;
+import java.util.List;
 import java.util.logging.Logger;
+
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.xml.namespace.QName;
+import javax.xml.transform.dom.DOMSource;
 import javax.xml.ws.EndpointReference;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
 import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
 
+import org.w3c.dom.Element;
+
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.jaxws.binding.soap.SOAPBindingImpl;
 import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
+import org.apache.cxf.ws.addressing.Names;
 
 public class EndpointReferenceBuilder {
     private static final Logger LOG = LogUtils.getL7dLogger(EndpointReferenceBuilder.class);
@@ -38,6 +49,35 @@ public class EndpointReferenceBuilder {
         this.endpoint = e;
     }
     public EndpointReference getEndpointReference() {
+        
+        //if there is epr in wsdl, direct return this EPR
+        List<ExtensibilityElement> portExtensors = endpoint.getEndpointInfo()
+            .getExtensors(ExtensibilityElement.class);
+        if (portExtensors != null) {
+            Iterator<ExtensibilityElement> extensionElements = portExtensors.iterator();
+            QName wsaEpr = new QName(Names.WSA_NAMESPACE_NAME, "EndpointReference");
+            while (extensionElements.hasNext()) {
+                ExtensibilityElement ext = (ExtensibilityElement)extensionElements.next();
+                if (ext instanceof UnknownExtensibilityElement && wsaEpr.equals(ext.getElementType()))
{
+                    Element eprEle = ((UnknownExtensibilityElement)ext).getElement();
+                    List<Element> addressElements = DOMUtils.getChildrenWithName(eprEle,
+                                                                                 Names.WSA_NAMESPACE_NAME,
+                                                                                 Names.WSA_ADDRESS_NAME);
+                    if (!addressElements.isEmpty()) {
+                        /*
+                         * [WSA-WSDL Binding] : in a SOAP 1.1 port described using WSDL 1.1,
the location
+                         * attribute of a soap11:address element (if present) would have
the same value as the
+                         * wsa:Address child element of the wsa:EndpointReference element.
+                         */
+                        addressElements.get(0).setTextContent(this.endpoint.getEndpointInfo().getAddress());
+                    }
+                    return W3CEndpointReference.readFrom(new DOMSource(eprEle));
+                }
+
+            }
+        }
+        
+        
         String bindingId = endpoint.getJaxwsBinding().getBindingID();   
         
         if (!SOAPBindingImpl.isSoapBinding(bindingId)) {
@@ -45,16 +85,17 @@ public class EndpointReferenceBuilder {
                                                                 LOG, bindingId).toString());
         }
         
-        W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
-        
+        W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();      
         builder.address(this.endpoint.getEndpointInfo().getAddress());
+        
         builder.serviceName(this.endpoint.getService().getName());
         builder.endpointName(this.endpoint.getEndpointInfo().getName());
-        if (this.endpoint.getEndpointInfo().getService()
-                .getDescription() != null) {
-            builder.wsdlDocumentLocation(this.endpoint.getEndpointInfo().getService()
-                                         .getDescription().getBaseURI());
+
+        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/support/JaxWsEndpointImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java?rev=953819&r1=953818&r2=953819&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
Fri Jun 11 18:39:02 2010
@@ -25,6 +25,8 @@ import java.util.List;
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.wsdl.extensions.ExtensionRegistry;
 import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.xml.namespace.QName;
+import javax.xml.transform.dom.DOMSource;
 import javax.xml.ws.Binding;
 import javax.xml.ws.Service.Mode;
 import javax.xml.ws.WebServiceFeature;
@@ -32,6 +34,7 @@ import javax.xml.ws.soap.Addressing;
 import javax.xml.ws.soap.AddressingFeature;
 import javax.xml.ws.soap.MTOMFeature;
 import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
 
 import org.w3c.dom.Element;
 
@@ -69,7 +72,10 @@ import org.apache.cxf.service.model.Bind
 import org.apache.cxf.service.model.DescriptionInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.staxutils.W3CDOMStreamWriter;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.apache.cxf.ws.addressing.Names;
+import org.apache.cxf.ws.addressing.VersionTransformer;
 import org.apache.cxf.ws.addressing.WSAddressingFeature;
 import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.wsdl.WSDLManager;
@@ -194,6 +200,28 @@ public class JaxWsEndpointImpl extends E
             }
             addAddressingFeature(feature);
         }
+        extractWsdlEprs(endpoint);
+    }
+    
+    private void extractWsdlEprs(EndpointInfo endpoint) {
+        //parse the EPR in wsdl
+        List<ExtensibilityElement> portExtensors = endpoint.getExtensors(ExtensibilityElement.class);
+        if (portExtensors != null) {
+            Iterator<ExtensibilityElement> extensionElements = portExtensors.iterator();
+            QName wsaEpr = new QName(Names.WSA_NAMESPACE_NAME, "EndpointReference");
+            while (extensionElements.hasNext()) {
+                ExtensibilityElement ext = (ExtensibilityElement)extensionElements.next();
+                if (ext instanceof UnknownExtensibilityElement && wsaEpr.equals(ext.getElementType()))
{
+                    DOMSource domSource = new DOMSource(((UnknownExtensibilityElement)ext).getElement());
+                    W3CEndpointReference w3cEPR = new W3CEndpointReference(domSource);
+                    EndpointReferenceType ref = VersionTransformer.convertToInternal(w3cEPR);
+                    endpoint.getTarget().setMetadata(ref.getMetadata());
+                    endpoint.getTarget().setReferenceParameters(ref.getReferenceParameters());
+                    endpoint.getTarget().getOtherAttributes().putAll(ref.getOtherAttributes());
+                }
+
+            }
+        }
     }
     
     private boolean hasUsingAddressing(List<ExtensibilityElement> exts) {



Mime
View raw message