jentrata / jentrata-msh

Jentrata - Message Handler Service
jentrara.org
Other
19 stars 57 forks source link

Jentra ebxml to xml conversion? #50

Closed telstrajhinjer closed 5 years ago

telstrajhinjer commented 5 years ago

Hi There,

I am using jentrata in my project. But downstream and upstream systems do not understand ebxml. Therefore, I need to convert xml to ebxml and ebxml to xml. If anyone can help on this. It would be great.

Thanks Kind Regards Sumanpreet Singh

aaronwalker commented 5 years ago

@telstrajhinjer This is exactly what Jentrata is doing. You provide a xml payload using either the Web Service SOAP interface or configure a integration using the jentrata.integration plugin. Jentrata handles the ebxml layer for you.

The jentrata.integration plugin supports configuring apache camel routes here is an example integration https://github.com/jentrata/jentrata-msh/blob/master/Dist/src/main/deploy/example-ebms.xml.example. To deploy it just rename it to example-ebms.xml and put it in the deploy directory are restart jentrata.

This example use the camel file component to pickup a payload (xml file) from the /opt/jentrata/outbound directory and using the loopback partnership config delivery it to /opt/jentrata/inbound This demonstrates the end to end of sending and receiving a payload using Jentrata.

This example assumes you have a partnership configured with

cpdId : loopback
service: testService
action: testAction

You can just change these to match your partnerships/CPA

This example It also sets the to/from party info which you would also probably want to change

telstrajhinjer commented 5 years ago

@aaronwalker thanks for your response.

I was not able to find opt/jentrata/inbound or outbound folders. Additionally I dont have much understanding about jentrata.

My ask is to convert below ebxml to xml. If you please help that would be great. `POST /ebXML HTTP/1.1 User-Agent: TIBCO BusinessConnect Host: 58.163.220.63:8500 SOAPAction: "ebXML" Content-Length: 3951 Connection: close Message-ID: 584549659.1530665274866.BusinessConnect@10.174.12.139 Content-Type: multipart/related; type="text/xml"; start="2123700610.1530665274860.BusinessConnect@10.174.12.139"; boundary=1970730530.1530665274860.BusinessConnect.10.174.12.139

--1970730530.1530665274860.BusinessConnect.10.174.12.139 Content-Type: text/xml; charset="UTF-8" Content-Transfer-Encoding: binary Content-ID: 2123700610.1530665274860.BusinessConnect@10.174.12.139

<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 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 xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd" 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">

mysuplier Supplier mybuyer Buyer mycpaid myconid Manage Service Qualification requestSingleSiteQualification A18e0ZHLMg8Bl-QOZrD8GKsUSWg 2018-07-04T00:47:54.846Z 2018-07-04T01:47:54.846Z --1970730530.1530665274860.BusinessConnect.10.174.12.139 Content-Type: text/xml; charset=UTF-8 Content-Transfer-Encoding: binary Content-ID: <0339016E-5378-4B63-AFF7-F9CA272E544D-0> ServiceQualification LOC180428010146 mytype --1970730530.1530665274860.BusinessConnect.10.174.12.139-- `
telstrajhinjer commented 5 years ago

@aaronwalker Also I am not able to find opt/jentrata/outbound folder.

aaronwalker commented 5 years ago

@telstrajhinjer did you deploy the example camel integration? How are you running jentrata? via Docker? If you are then /opt/jentrata/output directory will get created. Otherwise you can update the example to point to whatever directory you like

You don't need convert the ebxml message you invoke the receiver web server to retrieve message from the inbox.

If you want to use Jentrata's SOAP interface

Here is the SOAP endpoint for getting a list of receivable messages ids http://<HOST>:<PORT>/jentrata/httpd/ebms/receiver_list

example soap request

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <tns:cpaId xmlns:tns="http://service.ebms.edi.cecid.hku.hk/">[CPA_Id]</tns:cpaId>
        <tns:service xmlns:tns="http://service.ebms.edi.cecid.hku.hk/">[Service]</tns:service>
        <tns:action xmlns:tns="http://service.ebms.edi.cecid.hku.hk/">[Action]</tns:action>
        <tns:convId xmlns:tns="http://service.ebms.edi.cecid.hku.hk/">[Conversation_Id]</tns:convId>
        <tns:fromPartyId xmlns:tns="http://service.ebms.edi.cecid.hku.hk/">[From_Party_Id]</tns:fromPartyId>
        <tns:fromPartyType xmlns:tns="http://service.ebms.edi.cecid.hku.hk/">[From_Party_Type]</tns:fromPartyType>
        <tns:toPartyId xmlns:tns="http://service.ebms.edi.cecid.hku.hk/">[To_Party_Id]</tns:toPartyId>
        <tns:toPartyType xmlns:tns="http://service.ebms.edi.cecid.hku.hk/">[To_Party_Type]</tns:toPartyType>
        <tns:numOfMessages xmlns:tns="http://service.ebms.edi.cecid.hku.hk/">[Number_of_messages]</tns:numOfMessages>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Only cpaId, service, and action are required

Response will look like

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <messageIds xmlns="http://service.ebms.edi.cecid.hku.hk/">
            <messageId>[downloadable_message_id]</messageId>
            <messageId>[downloadable_message_id]</messageId>
        </messageIds>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Using the messageId you can then download the message using the receiver SOAP endpoint http://<HOST>:<PORT>/corvus/httpd/ebms/receiver

sample request

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <tns:messageId xmlns:tns="http://service.ebms.edi.cecid.hku.hk/">[id_of_message_to_download]</tns:messageId>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

suppling one of the message Ids from the previous request.

The response will look like

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <hasMessage xmlns="http://service.ebms.edi.cecid.hku.hk/">[true_if_payload_in_message]</hasMessage>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<!--
    Attached payloads...
-->

The response is a SOAP with attachments which you can then extract the payload using the SAAJ java library or whatever your using as a client.

It is much easier to use camel integration to deal with sending/receiving messages, this is one of the major differences between Hermes and Jentrata (along with Clustering support).

If you do go down the SOAP integration you can look at the hermes documentation for the SOAP interface as it mostly the same for jentrata. See http://hermes.cecid.org/en/latest/web_service_communication.html#ebms-2-0-web-service

telstrajhinjer commented 5 years ago

@aaronwalker thanks for your response. Yes, I tried example camel in my program. But I was not able to see the conversion. I'll again give it a try and let you know if it resolves my issue.