我的目的是通过另一个 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.
另外查看数据库中的存储库表,我可以看到已插入一行,内容列包含十六进制形式的消息(\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。两个实例都配置了正确的合作伙伴关系。
有人能指出我正确的方向吗?
好吧,我花了更长的时间才找到问题并找到解决方案,所以希望我可以节省别人的时间。
关于 Hermes 2 安装的文档表明它需要 PostgreSQL 8.0 或更高版本。这是个谎言!删除 Postgres 9.3 并使用 Postgres 8.4 重新安装 Hermes 解决了问题。
我是一名优秀的程序员,十分优秀!