Author: dkulp Date: Mon Dec 21 20:09:24 2009 New Revision: 892957 URL: http://svn.apache.org/viewvc?rev=892957&view=rev Log: Merged revisions 892955 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.2.x-fixes
................ r892955 | dkulp | 2009-12-21 15:08:13 -0500 (Mon, 21 Dec 2009) | 10 lines Merged revisions 892953 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r892953 | dkulp | 2009-12-21 15:05:07 -0500 (Mon, 21 Dec 2009) | 2 lines [CXF-2587] Workaround "bug" in wsdl4j that really isn't looking into imports like the docs say. ........ ................ Modified: cxf/branches/2.1.x-fixes/ (props changed) cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java Propchange: cxf/branches/2.1.x-fixes/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Dec 21 20:09:24 2009 @@ -1,2 +1,2 @@ -/cxf/branches/2.2.x-fixes:891302,891453 -/cxf/trunk:891301,891452 +/cxf/branches/2.2.x-fixes:891302,891453,892955 +/cxf/trunk:891301,891452,892953 Propchange: cxf/branches/2.1.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?rev=892957&r1=892956&r2=892957&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java (original) +++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java Mon Dec 21 20:09:24 2009 @@ -27,6 +27,7 @@ import javax.wsdl.BindingInput; import javax.wsdl.BindingOutput; import javax.wsdl.Definition; +import javax.wsdl.Import; import javax.wsdl.Part; import javax.wsdl.WSDLException; import javax.wsdl.extensions.ExtensibilityElement; @@ -61,6 +62,7 @@ import org.apache.cxf.common.util.StringUtils; import org.apache.cxf.common.xmlschema.SchemaCollection; import org.apache.cxf.endpoint.Endpoint; +import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.interceptor.AttachmentInInterceptor; import org.apache.cxf.interceptor.AttachmentOutInterceptor; import org.apache.cxf.interceptor.BareOutInterceptor; @@ -412,16 +414,52 @@ SchemaCollection schemas = serviceInfo.getXmlSchemaCollection(); if (def != null && schemas != null) { - javax.wsdl.Message msg = def.getMessage(header.getMessage()); + QName qn = header.getMessage(); + + javax.wsdl.Message msg = findMessage(qn, def); if (msg != null) { addOutOfBandParts(bop, msg, schemas, isInput, header.getPart()); serviceInfo.refresh(); } else { throw new RuntimeException("Problem with WSDL: soap:header element" - + " is referring to an undefined wsdl:message element."); + + " for operation " + bop.getName() + + " is referring to an undefined wsdl:message element: " + qn); + } + } + } + } + private javax.wsdl.Message findMessage(QName qn, Definition def) { + javax.wsdl.Message msg = def.getMessage(qn); + if (msg == null) { + msg = findMessage(qn, def, new ArrayList<Definition>()); + } + return msg; + } + private javax.wsdl.Message findMessage(QName qn, Definition def, List<Definition> done) { + javax.wsdl.Message msg = def.getMessage(qn); + if (msg == null) { + if (done.contains(def)) { + return null; + } + done.add(def); + Collection<List<Import>> ilist = CastUtils.cast(def.getImports().values()); + for (List<Import> list : ilist) { + for (Import i : list) { + if (qn.getNamespaceURI().equals(i.getDefinition().getTargetNamespace())) { + return i.getDefinition().getMessage(qn); + } + } + } + for (List<Import> list : ilist) { + for (Import i : list) { + msg = findMessage(qn, i.getDefinition(), done); + if (msg != null) { + return msg; + } } } } + return msg; } private void addOutOfBandParts(final BindingOperationInfo bop, final javax.wsdl.Message msg,
