[CXF-5793] A better error message than an NPE if the "message" attribute isn't there.
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9e94fdd6 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9e94fdd6 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9e94fdd6 Branch: refs/heads/2.6.x-fixes Commit: 9e94fdd61b942ce6be2076f82a766a08542d0b96 Parents: ac78dd7 Author: Daniel Kulp <[email protected]> Authored: Mon Jun 9 13:42:50 2014 -0400 Committer: Daniel Kulp <[email protected]> Committed: Mon Jun 9 14:47:19 2014 -0400 ---------------------------------------------------------------------- .../java/org/apache/cxf/binding/soap/SoapBindingFactory.java | 6 ++++++ 1 file changed, 6 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/9e94fdd6/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java ---------------------------------------------------------------------- diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java index 61a01cf..d3fcff0 100644 --- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java +++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java @@ -445,6 +445,12 @@ public class SoapBindingFactory extends AbstractBindingFactory { ServiceInfo serviceInfo = bop.getBinding().getService(); + if (header != null && header.getMessage() == null) { + throw new RuntimeException("Problem with WSDL: soap:header element" + + " for operation " + bop.getName() + " under binding " + bop.getBinding().getName() + + " does not contain a valid message attribute."); + } + if (header != null && serviceInfo.getMessage(header.getMessage()) == null) { Definition def = (Definition)serviceInfo.getProperty(WSDLServiceBuilder.WSDL_DEFINITION); SchemaCollection schemas = serviceInfo.getXmlSchemaCollection();
