我在wso2 esb 4.8.1的ERROR_DETAIL属性中收到以下类型的消息。
消息:
<ErrorDetail>org.xml.sax.SAXParseException; cvc-type.3.1.3: The value '' of element 'ds1:HomecomingDate' is not valid.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.elementLocallyValidType(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.processElementContent(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.endElement(Unknown Source)
at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.endElement(Unknown Source)
at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:279)
at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:251)
at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:251)
at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:251)
at org.apache.axiom.om.impl.serialize.OMXMLReader.parse(OMXMLReader.java:171)
at org.apache.axiom.om.impl.serialize.OMXMLReader.parse(OMXMLReader.java:161)
at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.validate(Unknown Source)
at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source)
at javax.xml.validation.Validator.validate(Unknown Source)
at org.apache.synapse.mediators.builtin.ValidateMediator.mediate(ValidateMediator.java:183)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.template.TemplateMediator.mediate(TemplateMediator.java:77)
at org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:129)
at org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:78)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:196)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:411)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)</ErrorDetail>
要检索的内容: 我想总是得到有意义的信息,比如在这种情况下:
The value '' of element 'ds1:HomecomingDate' is not valid.
每封邮件在开头都包含以下行:
org.xml.sax.SAXParseException;
并在每条消息中,堆栈跟踪从此行开始:
at org.apache.xerces.
所以我想在两者之间得到消息。我尝试了下面的房产调解员,但没有运气。
<property xmlns:ns2="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" name="DesiredValue" expression="fn:substring(get-property('ERROR_DETAIL'),1,fn:substring-before(get-property('ERROR_DETAIL'),"org.apache."))" scope="default" type="STRING"></property>
答案 0 :(得分:1)
我们可以这样做
<property name="MSISDN" scope="default" type="STRING" value="94710000000"/>
<property expression="fn:substring($ctx:MSISDN, 3)"
name="MSISDN_WITHOUT_COUNTRY_CODE" scope="default" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
输出将是 710000000
答案 1 :(得分:0)
您可以尝试以下属性:
<property xmlns:ns="http://org.apache.synapse/xsd" name="Cause" expression="get-property('ERROR_MESSAGE')"/>
<property xmlns:ns="http://org.apache.synapse/xsd" name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>