在Soap故障原因文本的Soap 1.2版本中是否必须xml:lang
?
<soap:Reason>
<soap:Text xml:lang="en-US">
<xsl:value-of select="$error-message"/>
</soap:Text>
</soap:Reason>
我在XSLT中添加时遇到错误:
14:14:25,683 ERROR [org.apache.camel.builder.xml.XsltErrorListener] (MSC service thread 1-14) "xml:lang" attribute is not allowed on the soap:Text element!; Line#: 16; Column#: 32: javax.xml.transform.TransformerException: "xml:lang" attribute is not allowed on the soap:Text element!
at org.apache.xalan.processor.StylesheetHandler.error(StylesheetHandler.java:907)
at org.apache.xalan.processor.StylesheetHandler.error(StylesheetHandler.java:950)
at org.apache.xalan.processor.XSLTElementProcessor.setPropertiesFromAttributes(XSLTElementProcessor.java:348)
at org.apache.xalan.processor.XSLTElementProcessor.setPropertiesFromAttributes(XSLTElementProcessor.java:268)
at org.apache.xalan.processor.ProcessorLRE.startElement(ProcessorLRE.java:283)
at org.apache.xalan.processor.StylesheetHandler.startElement(StylesheetHandler.java:626)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:496) [xercesImpl-2.9.1.redhat-6.jar:2.9.1.redhat-6]
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:283) [xercesImpl-2.9.1.redhat-6.jar:2.9.1.redhat-6]
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1653) [xercesImpl-2.9.1.redhat-6.jar:2.9.1.redhat-6]
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324) [xercesImpl-2.9.1.redhat-6.jar:2.9.1.redhat-6]
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:845) [xercesImpl-2.9.1.redhat-6.jar:2.9.1.redhat-6]
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768) [xercesImpl-2.9.1.redhat-6.jar:2.9.1.redhat-6]
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108) [xercesImpl-2.9.1.redhat-6.jar:2.9.1.redhat-6]
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1196) [xercesImpl-2.9.1.redhat-6.jar:2.9.1.redhat-6]
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:555) [xercesImpl-2.9.1.redhat-6.jar:2.9.1.redhat-6]
at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:926)
at __redirected.__TransformerFactory.newTemplates(__TransformerFactory.java:140) [jboss-modules.jar:1.3.3.Final-redhat-1]
at org.apache.camel.builder.xml.XsltBuilder.setTransformerSource(XsltBuilder.java:329) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:90) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.component.xslt.XsltEndpoint.doStart(XsltEndpoint.java:99) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:1777) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.impl.DefaultCamelContext.doAddService(DefaultCamelContext.java:940) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:901) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:484) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:61) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:187) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:108) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:114) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.SendDefinition.resolveEndpoint(SendDefinition.java:61) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.SendDefinition.createProcessor(SendDefinition.java:55) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.ProcessorDefinition.createProcessor(ProcessorDefinition.java:426) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.ProcessorDefinition.createOutputsProcessor(ProcessorDefinition.java:395) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.ProcessorDefinition.createOutputsProcessor(ProcessorDefinition.java:130) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.ProcessorDefinition.createChildProcessor(ProcessorDefinition.java:149) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.ExpressionNode.createFilterProcessor(ExpressionNode.java:109) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.WhenDefinition.createProcessor(WhenDefinition.java:77) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.WhenDefinition.createProcessor(WhenDefinition.java:31) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.ProcessorDefinition.createProcessor(ProcessorDefinition.java:426) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.ChoiceDefinition.createProcessor(ChoiceDefinition.java:135) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.ProcessorDefinition.createProcessor(ProcessorDefinition.java:426) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.ProcessorDefinition.createOutputsProcessor(ProcessorDefinition.java:395) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.TryDefinition.createProcessor(TryDefinition.java:75) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:466) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:179) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:876) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:172) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:731) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1803) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.apache.camel.impl.DefaultCamelContext.addRouteDefinitions(DefaultCamelContext.java:675) [camel-core-2.10.0.redhat-60083.jar:2.10.0.redhat-60083]
at org.switchyard.component.camel.deploy.CamelActivator.handleImplementation(CamelActivator.java:95) [switchyard-component-camel-1.1.1-p11-redhat-1.jar:1.1.1-p11-redhat-1]
at org.switchyard.component.camel.deploy.CamelActivator.activateService(CamelActivator.java:75) [switchyard-component-camel-1.1.1-p11-redhat-1.jar:1.1.1-p11-redhat-1]
at org.switchyard.deploy.internal.Deployment.deployImplementations(Deployment.java:546)
at org.switchyard.deploy.internal.Deployment.start(Deployment.java:144)
at org.switchyard.as7.extension.deployment.SwitchYardDeployment.start(SwitchYardDeployment.java:127) [switchyard-deploy-jboss-as7-1.1.1-p11-redhat-1.jar:1.1.1-p11-redhat-1]
at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:77) [switchyard-deploy-jboss-as7-1.1.1-p11-redhat-1.jar:1.1.1-p11-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_80]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_80]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_80]
答案 0 :(得分:0)
参见规范SOAP 1.2 SOAP Text Element
强制属性信息项,其[本地名称]为lang,[名称空间名称]为&#34; http://www.w3.org/XML/1998/namespace&#34;。注意,lang属性信息项中的定义要求[prefix]是&#34; xml&#34;或其任何大写(见XML 1.0 [XML 1.0],语言识别)。
也许您必须将名称空间xmlns:xml="http://www.w3.org/XML/1998/namespace
绑定到xml中的前缀xml
。