cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r658386 - in /cxf/trunk/tools/wsdlto: databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/ frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ test/src/test/java/org/apache/cxf...
Date Tue, 20 May 2008 18:41:36 GMT
Author: dkulp
Date: Tue May 20 11:41:36 2008
New Revision: 658386

URL: http://svn.apache.org/viewvc?rev=658386&view=rev
Log:
Fix some tooling to map ws-addressing elements to the appropriate EPR if we can.

Modified:
    cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
    cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/W3CEPRJaxbBinding.xml
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
    cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/OutOfBandHeaderBug.wsdl

Modified: cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=658386&r1=658385&r2=658386&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
(original)
+++ cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
Tue May 20 11:41:36 2008
@@ -93,6 +93,7 @@
     private S2JJAXBModel rawJaxbModelGenCode;
     private ToolContext context;
     private DefaultValueProvider defaultValues;
+    private boolean initialized;
     
     static {
         DEFAULT_TYPE_MAP.add("boolean");
@@ -123,10 +124,8 @@
     }    
 
 
-    @SuppressWarnings("unchecked")
     public void initialize(ToolContext c) throws ToolException {
         this.context = c;
-
         
         SchemaCompilerImpl schemaCompiler = (SchemaCompilerImpl)XJC.createSchemaCompiler();
         ClassCollector classCollector = context.get(ClassCollector.class);
@@ -138,10 +137,9 @@
         schemaCompiler.setErrorListener(listener);
         // Collection<SchemaInfo> schemas = serviceInfo.getSchemas();
         List<InputSource> jaxbBindings = context.getJaxbBindingFile();
-        Map<String, Element> schemaLists = (Map<String, Element>)context.get(ToolConstants.SCHEMA_MAP);
+        Map<String, Element> schemaLists = CastUtils.cast((Map<?, ?>)context.get(ToolConstants.SCHEMA_MAP));
 
-        Set<String> keys = schemaLists.keySet();
-        for (String key : keys) {
+        for (String key : schemaLists.keySet()) {
             Element ele = schemaLists.get(key);
             this.removeImportElement(ele);
             String tns = ele.getAttribute("targetNamespace");
@@ -160,8 +158,7 @@
         }
 
                        
-        Map<String, String> nsPkgMap = context.getNamespacePackageMap();
-        for (String ns : nsPkgMap.keySet()) {
+        for (String ns : context.getNamespacePackageMap().keySet()) {
             File file = JAXBUtils.getPackageMappingSchemaBindingFile(ns, context.mapPackageName(ns));
             try {
                 InputSource ins = new InputSource(file.toURI().toString());
@@ -244,6 +241,7 @@
                 }
             }
         }
+        initialized = true;
     }
 
     private String getPluginUsageString(Options opts) {
@@ -305,7 +303,9 @@
     }
 
     public void generate(ToolContext c) throws ToolException {
-        initialize(c);
+        if (!initialized) {
+            initialize(c);
+        }
         if (rawJaxbModelGenCode == null) {
             return;
         }

Modified: cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/W3CEPRJaxbBinding.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/W3CEPRJaxbBinding.xml?rev=658386&r1=658385&r2=658386&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/W3CEPRJaxbBinding.xml
(original)
+++ cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/W3CEPRJaxbBinding.xml
Tue May 20 11:41:36 2008
@@ -23,6 +23,15 @@
 		<bindings scd="wsa:EndpointReference">
 			<class ref="javax.xml.ws.wsaddressing.W3CEndpointReference" />
 		</bindings>
+		<bindings scd="wsa:ReplyTo">
+			<class ref="javax.xml.ws.wsaddressing.W3CEndpointReference" />
+		</bindings>
+		<bindings scd="wsa:FaultTo">
+			<class ref="javax.xml.ws.wsaddressing.W3CEndpointReference" />
+		</bindings>
+		<bindings scd="wsa:From">
+			<class ref="javax.xml.ws.wsaddressing.W3CEndpointReference" />
+		</bindings>
 		<bindings scd="~wsa:EndpointReferenceType">
 			<class ref="javax.xml.ws.wsaddressing.W3CEndpointReference" />
 		</bindings>

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java?rev=658386&r1=658385&r2=658386&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
Tue May 20 11:41:36 2008
@@ -146,6 +146,22 @@
         } else {
             name = dataBinding.getType(part.getTypeQName(), false);
         }
+        if (name == null) {
+            String namespace = resolvePartNamespace(part);
+            if ("http://www.w3.org/2005/08/addressing".equals(namespace)) {
+                //The ws-addressing stuff isn't mapped in jaxb as jax-ws specifies they 
+                //need to be mapped differently
+                String pn = part.getConcreteName().getLocalPart();
+                if ("EndpointReference".equals(pn)
+                    || "ReplyTo".equals(pn)
+                    || "From".equals(pn)
+                    || "FaultTo".equals(pn)) {
+                
+                    name = "javax.xml.ws.wsaddressing.W3CEndpointReference";
+                }
+            }
+            
+        }
         return name;       
     }
 

Modified: cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?rev=658386&r1=658385&r2=658386&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
(original)
+++ cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Tue May 20 11:41:36 2008
@@ -259,8 +259,9 @@
         for (Method m : meths) {
             if ("login".equals(m.getName())) {
                 assertEquals(String.class, m.getReturnType());
-                assertEquals(2, m.getParameterTypes().length);
+                assertEquals(3, m.getParameterTypes().length);
                 assertEquals(Holder.class, m.getParameterTypes()[1]);
+                assertEquals(Holder.class, m.getParameterTypes()[2]);
             }
         }
     }

Modified: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/OutOfBandHeaderBug.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/OutOfBandHeaderBug.wsdl?rev=658386&r1=658385&r2=658386&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/OutOfBandHeaderBug.wsdl
(original)
+++ cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/OutOfBandHeaderBug.wsdl
Tue May 20 11:41:36 2008
@@ -1,8 +1,13 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<wsdl:definitions targetNamespace="http://cxf.apache.org/bugs/oobh" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://cxf.apache.org/bugs/oobh"
xmlns:intf="http://cxf.apache.org/bugs/oobh" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+<wsdl:definitions targetNamespace="http://cxf.apache.org/bugs/oobh" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://cxf.apache.org/bugs/oobh"
xmlns:intf="http://cxf.apache.org/bugs/oobh" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"

+xmlns:wsa="http://www.w3.org/2005/08/addressing"
+xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <wsdl:types>
 
         <schema targetNamespace="http://cxf.apache.org/bugs/oobh" xmlns="http://www.w3.org/2001/XMLSchema">
+            <import namespace="http://www.w3.org/2005/08/addressing"
+				schemaLocation="classpath:/schemas/wsdl/ws-addr.xsd" />
+
             <!--  type defined for soap header  -->
             <complexType name="SessionHeader">
                 <sequence>
@@ -25,6 +30,9 @@
     <wsdl:message name="SessionHeader">
         <wsdl:part name="SessionHeader" element="impl:SessionHeader"/>
     </wsdl:message>
+    <wsdl:message name="WSAHeader">
+        <wsdl:part name="WSAHeader" element="wsa:ReplyTo"/>
+    </wsdl:message>
     <wsdl:message name="LoginRequest">
         <wsdl:part name="param" element="impl:Login"/>
     </wsdl:message>
@@ -46,6 +54,7 @@
                 <wsdlsoap:body use="literal"/>
             </wsdl:input>
             <wsdl:output>
+                <wsdlsoap:header message="impl:WSAHeader" part="WSAHeader" use="literal"/>
                 <wsdlsoap:header message="impl:SessionHeader" part="SessionHeader" use="literal"/>
                 <wsdlsoap:body use="literal"/>
             </wsdl:output>



Mime
View raw message