servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r655768 - in /servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src: main/java/org/apache/servicemix/cxfbc/ main/java/org/apache/servicemix/cxfbc/interceptors/ test/resources/org/apache/servicemix/cxfbc/ws/security/
Date Tue, 13 May 2008 08:05:32 GMT
Author: ffang
Date: Tue May 13 01:05:31 2008
New Revision: 655768

URL: http://svn.apache.org/viewvc?rev=655768&view=rev
Log:
[SM-1351]Cxf Bc should transform import xsd to inline xsd for endpoint's definition

Added:
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/base.xsd
  (with props)
Modified:
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
    servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_base.wsdl

Modified: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java?rev=655768&r1=655767&r2=655768&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
(original)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
Tue May 13 01:05:31 2008
@@ -20,7 +20,9 @@
 import java.io.OutputStream;
 import java.net.URI;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 import javax.jbi.management.DeploymentException;
@@ -35,7 +37,7 @@
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
-
+import org.w3c.dom.Element;
 import com.ibm.wsdl.Constants;
 
 import org.apache.cxf.Bus;
@@ -61,12 +63,16 @@
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transport.ConduitInitiatorManager;
 import org.apache.cxf.transport.jbi.JBIMessageHelper;
 import org.apache.cxf.wsdl.WSDLManager;
+import org.apache.cxf.wsdl11.SchemaUtil;
+import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
+import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 import org.apache.cxf.wsdl11.WSDLServiceFactory;
 import org.apache.servicemix.common.endpoints.ProviderEndpoint;
 import org.apache.servicemix.cxfbc.interceptors.JbiOutInterceptor;
@@ -77,6 +83,7 @@
 
 
 
+
 /**
  * 
  * @author gnodet
@@ -257,6 +264,8 @@
                     // use wsdl manager to parse wsdl or get cached definition
                     definition = getBus().getExtension(WSDLManager.class)
                             .getDefinition(wsdl.getURL());
+                    
+                    
                 } catch (WSDLException ex) {
                     // 
                 }
@@ -265,6 +274,7 @@
                 cxfService = factory.create();
                 ei = cxfService.getServiceInfos().iterator().next()
                         .getEndpoints().iterator().next();
+                          
                 for (ServiceInfo serviceInfo : cxfService.getServiceInfos()) {
                     if (serviceInfo.getName().equals(service)
                         && getEndpoint() != null 
@@ -275,6 +285,32 @@
                  
                     }
                 }
+                //transform import xsd to inline xsd
+                ServiceWSDLBuilder swBuilder = new ServiceWSDLBuilder(getBus(), cxfService.getServiceInfos());
+                ServiceInfo serInfo = new ServiceInfo();
+                                                 
+                Map<String, Element> schemaList = new HashMap<String, Element>();
+                SchemaUtil schemaUtil = new SchemaUtil(bus, schemaList);
+                schemaUtil.getSchemas(definition, serInfo);
+                
+                serInfo = ei.getService();
+                for (String key : schemaList.keySet()) {
+                    Element ele = schemaList.get(key);
+                    for (SchemaInfo sInfo : serInfo.getSchemas()) {
+                        if (sInfo.getNamespaceURI() == null //it's import schema 
+                            && ((Element)sInfo.getElement().getElementsByTagNameNS(
+                                    "http://www.w3.org/2001/XMLSchema",
+                                    "import").item(0)).
+                                getAttribute("namespace").
+                                    equals(ele.getAttribute("targetNamespace"))) {
+                            
+                            sInfo.setElement(ele);
+                        }
+                    }
+                }
+                serInfo.setProperty(WSDLServiceBuilder.WSDL_DEFINITION, null);
+                description = WSDLFactory.newInstance().newWSDLWriter().getDocument(swBuilder.build());
+                               
 
                 if (endpoint == null) {
                     endpoint = ei.getName().getLocalPart();

Modified: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java?rev=655768&r1=655767&r2=655768&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
(original)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
Tue May 13 01:05:31 2008
@@ -233,7 +233,7 @@
         }
         SchemaInfo schemaInfo = 
             getOperation(message).getBinding().getService().getSchema(jbiFaultDetail.getNamespaceURI());
-        if (!schemaInfo.isElementFormQualified()) {
+        if (schemaInfo != null && !schemaInfo.isElementFormQualified()) {
             //that's unquailied fault
             jbiFaultDetail = addEmptyDefaultTns((Element)jbiFaultDetail);
         }

Added: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/base.xsd
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/base.xsd?rev=655768&view=auto
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/base.xsd
(added)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/base.xsd
Tue May 13 01:05:31 2008
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+ <schema targetNamespace="http://apache.org/hello_world_soap_http/types" xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:x1="http://apache.org/hello_world_soap_http/types" elementFormDefault="qualified">
+            <element name="sayHi">
+                <complexType/>
+            </element>
+            <element name="sayHiResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMe">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+
+            <element name="testNillable">
+                <complexType>
+                    <sequence>
+                        <element name="NillElem" nillable="true" type="string"/>
+                        <element name="intElem" type="int"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="testNillableResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" nillable="true" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+
+            <element name="greetMeLater">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="long"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeLaterResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeSometime">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeSometimeResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeOneWay">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="testDocLitFault">
+                <complexType>
+                    <sequence>
+                        <element name="faultType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="testDocLitFaultResponse">
+                <complexType>
+                    <sequence/>
+                </complexType>
+            </element>
+            <complexType name="ErrorCode">
+                <sequence>
+                    <element name="minor" type="short"/>
+                    <element name="major" type="short"/>
+                </sequence>
+            </complexType>
+            <element name="NoSuchCodeLit">
+                <complexType>
+                    <sequence>
+                        <element name="code" type="x1:ErrorCode"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="BadRecordLit" type="string"/>
+            <complexType name="BadRecord">
+                <sequence>
+                    <element name="reason" type="string"/>
+                    <element name="code" type="short"/>
+                </sequence>
+            </complexType>
+            <complexType name="addNumbers">
+                <sequence>
+                    <element name="arg0" type="int"/>
+                    <element name="arg1" type="int"/>
+                </sequence>
+            </complexType>
+            <element name="addNumbers" type="x1:addNumbers"/>
+            <complexType name="addNumbersResponse">
+                <sequence>
+                    <element name="return" type="int"/>
+                </sequence>
+            </complexType>
+            <element name="addNumbersResponse" type="x1:addNumbersResponse"/>
+            <complexType name="stringStruct">
+                <sequence>
+                    <element name="arg0" type="string"/>
+                    <element name="arg1" type="string"/>
+                </sequence>
+            </complexType>
+            <element name="BareDocument" type="string"/>
+            <element name="BareDocumentResponse">
+                <complexType>
+                    <sequence>
+                        <element name="company" type="string"/>
+                    </sequence>
+                    <attribute name="id" type="int"/>
+                </complexType>
+            </element>
+        </schema>

Propchange: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/base.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/base.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/base.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_base.wsdl
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_base.wsdl?rev=655768&r1=655767&r2=655768&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_base.wsdl
(original)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/security/hello_world_base.wsdl
Tue May 13 01:05:31 2008
@@ -25,144 +25,9 @@
     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     targetNamespace="http://apache.org/hello_world_soap_http" name="HelloWorld">
     <wsdl:types>
-        <schema targetNamespace="http://apache.org/hello_world_soap_http/types" xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:x1="http://apache.org/hello_world_soap_http/types" elementFormDefault="qualified">
-            <element name="sayHi">
-                <complexType/>
-            </element>
-            <element name="sayHiResponse">
-                <complexType>
-                    <sequence>
-                        <element name="responseType" type="string"/>
-                    </sequence>
-                </complexType>
-            </element>
-            <element name="greetMe">
-                <complexType>
-                    <sequence>
-                        <element name="requestType" type="string"/>
-                    </sequence>
-                </complexType>
-            </element>
-            <element name="greetMeResponse">
-                <complexType>
-                    <sequence>
-                        <element name="responseType" type="string"/>
-                    </sequence>
-                </complexType>
-            </element>
-
-            <element name="testNillable">
-                <complexType>
-                    <sequence>
-                        <element name="NillElem" nillable="true" type="string"/>
-                        <element name="intElem" type="int"/>
-                    </sequence>
-                </complexType>
-            </element>
-            <element name="testNillableResponse">
-                <complexType>
-                    <sequence>
-                        <element name="responseType" nillable="true" type="string"/>
-                    </sequence>
-                </complexType>
-            </element>
-
-            <element name="greetMeLater">
-                <complexType>
-                    <sequence>
-                        <element name="requestType" type="long"/>
-                    </sequence>
-                </complexType>
-            </element>
-            <element name="greetMeLaterResponse">
-                <complexType>
-                    <sequence>
-                        <element name="responseType" type="string"/>
-                    </sequence>
-                </complexType>
-            </element>
-            <element name="greetMeSometime">
-                <complexType>
-                    <sequence>
-                        <element name="requestType" type="string"/>
-                    </sequence>
-                </complexType>
-            </element>
-            <element name="greetMeSometimeResponse">
-                <complexType>
-                    <sequence>
-                        <element name="responseType" type="string"/>
-                    </sequence>
-                </complexType>
-            </element>
-            <element name="greetMeOneWay">
-                <complexType>
-                    <sequence>
-                        <element name="requestType" type="string"/>
-                    </sequence>
-                </complexType>
-            </element>
-            <element name="testDocLitFault">
-                <complexType>
-                    <sequence>
-                        <element name="faultType" type="string"/>
-                    </sequence>
-                </complexType>
-            </element>
-            <element name="testDocLitFaultResponse">
-                <complexType>
-                    <sequence/>
-                </complexType>
-            </element>
-            <complexType name="ErrorCode">
-                <sequence>
-                    <element name="minor" type="short"/>
-                    <element name="major" type="short"/>
-                </sequence>
-            </complexType>
-            <element name="NoSuchCodeLit">
-                <complexType>
-                    <sequence>
-                        <element name="code" type="x1:ErrorCode"/>
-                    </sequence>
-                </complexType>
-            </element>
-            <element name="BadRecordLit" type="string"/>
-            <complexType name="BadRecord">
-                <sequence>
-                    <element name="reason" type="string"/>
-                    <element name="code" type="short"/>
-                </sequence>
-            </complexType>
-            <complexType name="addNumbers">
-                <sequence>
-                    <element name="arg0" type="int"/>
-                    <element name="arg1" type="int"/>
-                </sequence>
-            </complexType>
-            <element name="addNumbers" type="x1:addNumbers"/>
-            <complexType name="addNumbersResponse">
-                <sequence>
-                    <element name="return" type="int"/>
-                </sequence>
-            </complexType>
-            <element name="addNumbersResponse" type="x1:addNumbersResponse"/>
-            <complexType name="stringStruct">
-                <sequence>
-                    <element name="arg0" type="string"/>
-                    <element name="arg1" type="string"/>
-                </sequence>
-            </complexType>
-            <element name="BareDocument" type="string"/>
-            <element name="BareDocumentResponse">
-                <complexType>
-                    <sequence>
-                        <element name="company" type="string"/>
-                    </sequence>
-                    <attribute name="id" type="int"/>
-                </complexType>
-            </element>      
-        </schema>
+        <xsd:schema>
+            <xsd:import namespace="http://apache.org/hello_world_soap_http/types" schemaLocation="base.xsd"/>
+        </xsd:schema>
     </wsdl:types>
     <wsdl:message name="sayHiRequest">
         <wsdl:part name="in" element="x1:sayHi"/>



Mime
View raw message