cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r539379 - in /incubator/cxf/trunk: rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/
Date Fri, 18 May 2007 10:58:20 GMT
Author: ema
Date: Fri May 18 03:58:19 2007
New Revision: 539379

URL: http://svn.apache.org/viewvc?view=rev&rev=539379
Log:
Fixed issue CXF-564

Modified:
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_holder.wsdl

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?view=diff&rev=539379&r1=539378&r2=539379
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Fri May 18 03:58:19 2007
@@ -402,6 +402,16 @@
                         createWrappedSchema(serviceInfo, op.getInput(),
                                             op.getUnwrappedOperation().getInput(), wraperBeanName);
                     }
+                    
+                    for (MessagePartInfo mpi : op.getInput().getMessageParts()) {
+                        if (Boolean.TRUE.equals(mpi.getProperty(HEADER))) {
+                            QName qn = (QName)mpi.getProperty(ELEMENT_NAME);
+                            mpi.setElement(true);
+                            mpi.setElementQName(qn);
+                        }
+                    }
+                    
+                  
                 }
                 if (op.hasOutput()) {
                     QName wraperBeanName = op.getOutput().getMessageParts().get(0).getElementQName();
@@ -416,6 +426,14 @@
                         createWrappedSchema(serviceInfo, op.getOutput(), op.getUnwrappedOperation()
                             .getOutput(), wraperBeanName);
                     }
+                    
+                    for (MessagePartInfo mpi : op.getOutput().getMessageParts()) {
+                        if (Boolean.TRUE.equals(mpi.getProperty(HEADER))) {
+                            QName qn = (QName)mpi.getProperty(ELEMENT_NAME);
+                            mpi.setElement(true);
+                            mpi.setElementQName(qn);
+                        }
+                    }
                 }
             }
         }
@@ -603,6 +621,22 @@
 
     }
     
+    private boolean isExistSchemaElement(XmlSchema schema, QName qn) {
+        boolean isExist = false;
+        for (Iterator ite = schema.getItems().getIterator(); ite.hasNext();) {
+            XmlSchemaObject obj = (XmlSchemaObject)ite.next();
+            if (obj instanceof XmlSchemaElement) {
+                XmlSchemaElement xsEle = (XmlSchemaElement)obj;
+                if (xsEle.getQName().equals(qn)) {
+                    isExist = true;
+                    break;
+                }
+            }
+        }
+        return isExist;
+    }
+    
+    
     private void createWrappedMessageSchema(AbstractMessageContainer wrappedMessage,
                                             AbstractMessageContainer unwrappedMessage, XmlSchema
schema,
                                             QName wrapperName) {
@@ -623,11 +657,16 @@
         ct.setParticle(seq);
 
         for (MessagePartInfo mpi : unwrappedMessage.getMessageParts()) {
-            if (!Boolean.TRUE.equals(mpi.getProperty(HEADER))) {
-                el = new XmlSchemaElement();
-                el.setName(mpi.getName().getLocalPart());
-                el.setQName(mpi.getName());
 
+            el = new XmlSchemaElement();
+            el.setName(mpi.getName().getLocalPart());
+            el.setQName(mpi.getName());
+            if (mpi.isElement()) {
+                el.setRefName(mpi.getElementQName());
+            } else {
+                el.setSchemaTypeName(mpi.getTypeQName());
+            }
+            if (!Boolean.TRUE.equals(mpi.getProperty(HEADER))) {
                 if (mpi.getTypeClass() != null && mpi.getTypeClass().isArray()
                     && !Byte.TYPE.equals(mpi.getTypeClass().getComponentType()))
{
                     el.setMinOccurs(0);
@@ -638,13 +677,18 @@
                         el.setMinOccurs(0);
                     }
                 }
+                seq.getItems().add(el);
+            }
+            if (Boolean.TRUE.equals(mpi.getProperty(HEADER))) {
 
-                if (mpi.isElement()) {
-                    el.setRefName(mpi.getElementQName());
-                } else {
-                    el.setSchemaTypeName(mpi.getTypeQName());
+                QName qn = (QName)mpi.getProperty(ELEMENT_NAME);
+
+                el.setName(qn.getLocalPart());
+                el.setQName(qn);
+
+                if (!isExistSchemaElement(schema, qn)) {
+                    schema.getItems().add(el);
                 }
-                seq.getItems().add(el);
             }
         }
     }
@@ -667,7 +711,8 @@
                 }
 
                 if (isHeader(method, j)) {
-                    part.setElementQName(q);
+                    //part.setElementQName(q);
+                    part.setProperty(ELEMENT_NAME, q);
                     part.setProperty(HEADER, Boolean.TRUE);
                 }
                 part.setIndex(j);
@@ -718,7 +763,8 @@
                         part.setProperty(MODE_INOUT, Boolean.TRUE);
                     }
                     if (isHeader(method, j)) {
-                        part.setElementQName(q2);
+                        //part.setElementQName(q2);
+                        part.setProperty(ELEMENT_NAME, q2);
                         part.setProperty(HEADER, Boolean.TRUE);
                     }
                 }
@@ -767,8 +813,8 @@
         }
     }
 
-    protected void createOutputWrappedMessageParts(OperationInfo op, Method method, MessageInfo
inMsg) {
-        MessagePartInfo part = inMsg.addMessagePart("parameters");
+    protected void createOutputWrappedMessageParts(OperationInfo op, Method method, MessageInfo
outMsg) {
+        MessagePartInfo part = outMsg.addMessagePart("parameters");
         part.setElement(true);
         part.setIndex(-1);
         for (Iterator itr = serviceConfigurations.iterator(); itr.hasNext();) {
@@ -780,7 +826,7 @@
         }
 
         if (part.getElementQName() == null) {
-            part.setElementQName(inMsg.getName());
+            part.setElementQName(outMsg.getName());
         } else if (!part.getElementQName().equals(op.getOutput().getName())) {
             op.getOutput().setName(part.getElementQName());
         }
@@ -789,6 +835,14 @@
             part.setTypeClass(this.getResponseWrapper(method));
         } else if (getResponseWrapperClassName(method) != null) {
             part.setProperty("RESPONSE.WRAPPER.CLASSNAME", getResponseWrapperClassName(method));
+        }
+        
+        for (MessagePartInfo mpart : op.getOutput().getMessageParts()) {
+            if (Boolean.TRUE.equals(mpart.getProperty(HEADER))) {
+                int idx = mpart.getIndex();
+                outMsg.addMessagePart(mpart);
+                mpart.setIndex(idx);
+            }
         }
     }
 

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_holder.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_holder.wsdl?view=diff&rev=539379&r1=539378&r2=539379
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_holder.wsdl
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_holder.wsdl
Fri May 18 03:58:19 2007
@@ -40,6 +40,7 @@
 <xsd:element minOccurs="0" name="arg1" type="xsd:string"/>
 </xsd:sequence>
 </xsd:complexType>
+<xsd:element name="header" type="xsd:string"/>
 <xsd:element name="echo3Response" type="echo3Response"/>
 <xsd:complexType name="echo3Response">
 <xsd:sequence>
@@ -68,6 +69,8 @@
   </wsdl:message>
   <wsdl:message name="echo3Response">
     <wsdl:part name="parameters" element="ns1:echo3Response">
+    </wsdl:part>
+    <wsdl:part name="header" element="ns1:header">
     </wsdl:part>
   </wsdl:message>
   <wsdl:message name="echo2">



Mime
View raw message