Hermes2 - “无法从存储库重建消息”错误

Posted

技术标签:

【中文标题】Hermes2 - “无法从存储库重建消息”错误【英文标题】:Hermes2 - "Cannot reconstruct the message from repository" error 【发布时间】:2015-01-12 08:57:23 【问题描述】:

我的意图是通过另一个 Hermes2 向 MSH (Hermes2 http://www.cecid.hku.hk/hermes.php) 发送 ebxml 消息。

我正在发送相当简单的消息(没有附件),这是消息:

POST /corvus/httpd/ebms/sender HTTP/1.0
User-Agent: PEAR-SOAP 0.12.0-beta
Host: 10.0.4.9
Content-Type: text/xml; charset=UTF-8
Content-Length: 698
SOAPAction: "PaymentAddRequest"
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<cpaId>ZSK_KOLEK</cpaId>
<service>http://www.squiz.pl/zsk/ebxml</service>
<action>PaymentAddRequest</action>
<convId>convId</convId>
<fromPartyId>KOLEK</fromPartyId>
<fromPartyType>urn:oasis:names:tc:ebxml-cppa:partyid-type:duns</fromPartyType>
<toPartyId>ZSK-C</toPartyId>
<toPartyType>urn:oasis:names:tc:ebxml-cppa:partyid-type:duns</toPartyType>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

作为回应,我得到以下信息:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<message_id xmlns="http://service.ebms.edi.cecid.hku.hk/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" type="xsd:string">20150112-092001-65410@127.0.1.1</message_id>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

消息已注册,但随后在 logs/ebms.log 中出现以下错误

[Thread-1855 ] <ERROR> <cecid.ebms.spa> <Error in outbox task>
hk.hku.cecid.ebms.spa.task.MessageValidationException: Cannot reconstruct the message 20150112-092435-20713@127.0.1.1 from repository
    by java.lang.RuntimeException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source: 
    by com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source: 
    by javax.xml.transform.TransformerException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

同时查看 DB 中的存储库表,我可以看到已插入一行,内容列包含十六进制形式的消息 (\x3c3f786d6c2076657273696f6e3d...),一旦转换为 ASCII,它会显示:

<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://www.oasis-open.org/committees/ebxml-msg/schema/envelope.xsd">
    <SOAP-ENV:Header xsi:schemaLocation="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd">
        <eb:MessageHeader SOAP-ENV:mustUnderstand="1" eb:version="2.0" xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd">
            <eb:From>
                <eb:PartyId eb:type="urn:oasis:names:tc:ebxml-cppa:partyid-type:duns">KOLEK</eb:PartyId>
            </eb:From>
            <eb:To>
                <eb:PartyId eb:type="urn:oasis:names:tc:ebxml-cppa:partyid-type:duns">ZSK-C</eb:PartyId>
            </eb:To>
            <eb:CPAId>ZSK_KOLEK</eb:CPAId>
            <eb:ConversationId>convId</eb:ConversationId>
            <eb:Service>http://www.squiz.pl/zsk/ebxml</eb:Service>
            <eb:Action>PaymentAddRequest</eb:Action>
            <eb:MessageData>
                <eb:MessageId>20150112-092435-20713@127.0.1.1</eb:MessageId>
                <eb:Timestamp>2015-01-12T09:24:35.207+01:00</eb:Timestamp>
            </eb:MessageData>
            <eb:DuplicateElimination/>
        </eb:MessageHeader>
        <eb:SyncReply SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:mustUnderstand="1" eb:version="2.0" xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd"/>
        <eb:AckRequested SOAP-ENV:actor="urn:oasis:names:tc:ebxml-msg:actor:toPartyMSH" SOAP-ENV:mustUnderstand="1" eb:signed="false" eb:version="2.0" xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd"/>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body xsi:schemaLocation="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd"/>
</SOAP-ENV:Envelope>

但它没有传递到端点,似乎 Hermes2 甚至没有尝试将它发送到第二个 Hermes2。两个实例都配置了适当的伙伴关系。

有人能指出正确的方向吗?

【问题讨论】:

【参考方案1】:

好的,我花了更长的时间才找到问题并找到解决方案,所以希望我可以节省别人的时间。

Hermes 2 安装文档说它需要 PostgreSQL 8.0 或更高版本。这是个谎言!删除 Postgres 9.3 并使用 Postgres 8.4 重新安装 Hermes 解决了这个问题。

【讨论】:

您可以通过将 postgresql.conf 中的 bytea_output 配置设置更改为 'escape' 使较新版本的 Postgres 与 Hermes2 一起使用 这是 Postgresql 8 中的默认设置,在 Postgresql 9 中,默认设置已更改到“十六进制”。详情postgresql.org/docs/9.0/static/release-9-0.html

以上是关于Hermes2 - “无法从存储库重建消息”错误的主要内容,如果未能解决你的问题,请参考以下文章

js常见的9种报错记录一下

idea 导入Mapper错误报错设置

PHP常见报错解析

console报错类型

为啥我应该没有错时却出现链接错误

maven总是显示错误,程序能正常运行,就是显示错