GithubHelp home page GithubHelp logo

holodeck-b2b / rest-backend Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 2.0 275 KB

An extension for Holodeck B2B that implements the Submit, Notify and Deliver operations using a REST API.

License: GNU General Public License v3.0

Java 100.00%
backend-api connector extension holodeckb2b rest rest-api

rest-backend's Introduction

Holodeck B2B

Holodeck B2B is a standalone B2B messaging solution. This project includes support for the OASIS specifications for ebMS3 and the AS4 profile. Java based, it will run on most platforms.

It is designed with extensibility in mind providing an interface layer (API) which you can find in the Interfaces module, and lots of documentation inside the code.


For more information on using Holodeck B2B visit the website at http://holodeck-b2b.org
Lead developer: Sander Fieten
Code hosted at https://github.com/holodeck-b2b/Holodeck-B2B
Issue tracker https://github.com/holodeck-b2b/Holodeck-B2B/issues

Installation

Prerequisites

Java 8 or higher is required to run Holodeck B2B.

Getting started guide

To help you set up your first instance of Holodeck B2B, you will find a step-by-step guide to setting up Holodeck B2B on the project website.

Contributing

We are using the simplified Github workflow to accept modifications which means you should:

  • create an issue related to the problem you want to fix or the function you want to add (good for traceability and cross-reference)
  • fork the repository
  • create a branch (optionally with the reference to the issue in the name)
  • write your code, including comments
  • commit incrementally with readable and detailed commit messages
  • run integration tests to check everything works on runtime
  • Update the changelog with a short description of the changes including a reference to the issues fixed
  • submit a pull request against the 'next' branch of this repository

If your contribution is more than a patch, please contact us beforehand to discuss which branch you can best submit the pull request to.

Submitting bugs

You can report issues directly on the project Issue Tracker. Please document the steps to reproduce your problem in as much detail as you can (if needed and possible include screenshots).

Versioning

Version numbering follows the Semantic versioning approach.

License

The Holodeck B2B core is licensed under the General Public License V3 (GPLv3) which is included in the license.txt in the root of the project. This means you are not allowed to integrate Holodeck B2B in a closed source product. You can however use Holodeck B2B together with your closed source product as long as you only use the provided interfaces (API's) to communicate with the Holodeck B2B core. For this purpose, the interfaces module is licensed under the Lesser General Public License V3 (LGPLv3).

To implement the cryptographic algorithms Holodeck B2B uses the Bouncy Castle library provided by The Legion of the Bouncy Castle Inc., see the bc_license.txt file.

Support

Commercial Holodeck B2B support is provided by Chasquis. Visit Chasquis-consulting.com for more information.

rest-backend's People

Contributors

holodeck-b2b avatar renates avatar sfieten avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rest-backend's Issues

Setting up URL / Timeout without re-building the image

From my basic understanding rest-backend sets up both the URL/Timeout by hard-coding it into the code, from a sysadmin/devops engineer perspective, it's a nightmare. Is it possible to set it up without compiling it?

Add Header to configure payloadUri

I want to configure the payloadUri for the messages that are sent.

As far as I can see, this is currently not possible, but could be added quickly with another custom header.

Feature Request: Provide a "ping" operation

Our backend application needs to monitor if Holodeck is running. We are already using the REST backend for submission / reception. Using the REST backend for "ping" purposes would be a convenient way to accomplish this.

Should I open a PR for this? Basically, there are only two changes necessary:

rest-backend-service.xml

<operation name="ping">
   <messageReceiver class="org.holodeckb2b.backend.rest.PingOperation"/>
</operation>

New file org.holodeckb2b.backend.rest.PingOperation:

package org.holodeckb2b.backend.rest;

import org.apache.axis2.context.MessageContext;
import org.apache.axis2.receivers.AbstractMessageReceiver;

public class PingOperation extends AbstractMessageReceiver {

	@Override
	public void invokeBusinessLogic(final MessageContext msgCtx) {
	}
}

This results in a HTTP 202 result, which can be interpreted by our backend:

POST http://localhost:8089/holodeckb2b/restbackend/ping

HTTP/1.1 202 Accepted
Date: Thu, 06 Jan 2022 08:24:58 GMT
Transfer-Encoding: chunked
Connection: Keep-Alive

<Response body is empty>

Response code: 202 (Accepted); Time: 112ms; Content length: 0 bytes

Unable to compile from source

I tried to compile the rest-backend and the output is this:

mvn clean install
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< org.holodeckb2b.extensions:rest-backend >---------------
[INFO] Building Holodeck B2B - REST back end 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.holodeckb2b:holodeckb2b-interfaces:jar:5.0.0 is missing, no dependency information available
[WARNING] The POM for org.holodeckb2b:holodeckb2b-core:jar:5.0.0 is missing, no dependency information available
[WARNING] The POM for org.holodeckb2b:holodeckb2b-core:jar:tests:5.0.0 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.193 s
[INFO] Finished at: 2021-07-05T13:14:14+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project rest-backend: Could not resolve dependencies for project org.holodeckb2b.extensions:rest-backend:jar:1.0.0: The following artifacts could not be resolved: org.holodeckb2b:holodeckb2b-interfaces:jar:5.0.0, org.holodeckb2b:holodeckb2b-core:jar:5.0.0, org.holodeckb2b:holodeckb2b-core:jar:tests:5.0.0: Failure to find org.holodeckb2b:holodeckb2b-interfaces:jar:5.0.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

I tried to import the missing depnedencies from local jar files like this:

org.holodeckb2b
holodeckb2b-interfaces
5.0.3
system
/path/to/libs/libs/holodeckb2b-interfaces-5.0.0.jar


org.holodeckb2b
holodeckb2b-core
${holodeckb2b.version}
system
/path/to/libs/holodeckb2b-core-5.0.3.jar

the end output is like this:

mvn clean compile | sed 's/tyr4n7/$USER/'
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.holodeckb2b.extensions:rest-backend:jar:1.0.0
[WARNING] 'dependencies.dependency.systemPath' for org.holodeckb2b:holodeckb2b-interfaces:jar should use a variable instead of a hard-coded path /home/$USER/repos/libs/holodeckb2b-interfaces-5.0.0.jar @ line 77, column 16
[WARNING] 'dependencies.dependency.systemPath' for org.holodeckb2b:holodeckb2b-core:jar should use a variable instead of a hard-coded path /home/$USER/repos/libs/holodeckb2b-core-5.0.3.jar @ line 84, column 16
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] --------------< org.holodeckb2b.extensions:rest-backend >---------------
[INFO] Building Holodeck B2B - REST back end 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.holodeckb2b:holodeckb2b-core:jar:tests:5.0.0 is missing, no dependency information available
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ rest-backend ---
[INFO] Deleting /home/$USER/repos/as4-rest-backend/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ rest-backend ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ rest-backend ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /home/$USER/repos/as4-rest-backend/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[30,29] package org.apache.axiom.soap does not exist
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[31,24] package org.apache.axis2 does not exist
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[32,32] package org.apache.axis2.context does not exist
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[33,34] package org.apache.axis2.receivers does not exist
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[34,42] package org.apache.commons.fileupload.util does not exist
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[66,38] cannot find symbol
symbol: class AbstractMessageReceiver
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[72,47] cannot find symbol
symbol: class MessageContext
location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[72,77] cannot find symbol
symbol: class AxisFault
location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[224,48] cannot find symbol
symbol: class MessageContext
location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/NotifyAndDeliverOperation.java:[27,42] package org.apache.commons.fileupload.util does not exist
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[71,9] method does not override or implement a method from a supertype
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[79,148] cannot find symbol
symbol: variable MessageContext
location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[97,35] cannot find symbol
symbol: class AxisFault
location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[97,75] cannot find symbol
symbol: variable SOAP12Constants
location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[99,35] cannot find symbol
symbol: class AxisFault
location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[99,63] cannot find symbol
symbol: variable SOAP12Constants
location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[247,33] cannot find symbol
symbol: variable Streams
location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/NotifyAndDeliverOperation.java:[175,49] cannot find symbol
symbol: variable Streams
location: class org.holodeckb2b.backend.rest.NotifyAndDeliverOperation.NandDDeliverer
[INFO] 18 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.950 s
[INFO] Finished at: 2021-07-05T13:16:40+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project rest-backend: Compilation failure: Compilation failure:
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[30,29] package org.apache.axiom.soap does not exist
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[31,24] package org.apache.axis2 does not exist
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[32,32] package org.apache.axis2.context does not exist
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[33,34] package org.apache.axis2.receivers does not exist
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[34,42] package org.apache.commons.fileupload.util does not exist
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[66,38] cannot find symbol
[ERROR] symbol: class AbstractMessageReceiver
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[72,47] cannot find symbol
[ERROR] symbol: class MessageContext
[ERROR] location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[72,77] cannot find symbol
[ERROR] symbol: class AxisFault
[ERROR] location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[224,48] cannot find symbol
[ERROR] symbol: class MessageContext
[ERROR] location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/NotifyAndDeliverOperation.java:[27,42] package org.apache.commons.fileupload.util does not exist
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[71,9] method does not override or implement a method from a supertype
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[79,148] cannot find symbol
[ERROR] symbol: variable MessageContext
[ERROR] location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[97,35] cannot find symbol
[ERROR] symbol: class AxisFault
[ERROR] location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[97,75] cannot find symbol
[ERROR] symbol: variable SOAP12Constants
[ERROR] location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[99,35] cannot find symbol
[ERROR] symbol: class AxisFault
[ERROR] location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[99,63] cannot find symbol
[ERROR] symbol: variable SOAP12Constants
[ERROR] location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/SubmitOperation.java:[247,33] cannot find symbol
[ERROR] symbol: variable Streams
[ERROR] location: class org.holodeckb2b.backend.rest.SubmitOperation
[ERROR] /home/$USER/repos/as4-rest-backend/src/main/java/org/holodeckb2b/backend/rest/NotifyAndDeliverOperation.java:[175,49] cannot find symbol
[ERROR] symbol: variable Streams
[ERROR] location: class org.holodeckb2b.backend.rest.NotifyAndDeliverOperation.NandDDeliverer
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Am I doing something wrong? Could you suggest me another way please?

NullPointerException for AS2 reception

For incoming AS2 messages that should be delivered using the NotifyAndDeliverOperation, a NullPointerException is thrown:

(HttpConnection-8089-1)[DEBUG] org.holodeckb2b.backend.rest.NotifyAndDeliverOperation - Preparing User Message for delivery to back-end
(HttpConnection-8089-1)[WARN ] org.holodeckb2b.msgproc.core.RESPONSE_IN_FLOW.DeliverUserMessage - NandDDeliverer threw NullPointerException instead of MessageDeliveryException!
(HttpConnection-8089-1)[ERROR] org.holodeckb2b.msgproc.core.RESPONSE_IN_FLOW.DeliverUserMessage - Could not deliver the user message [msgId=xxx] using specified delivery method!

Reason is, that no collaboration info is set on the incoming AS2 user message in NotifyAndDeliverOperation:140:

headers.setHeader(HTTPHeaders.CONVERSATION_ID, userMsg.getCollaborationInfo().getConversationId());

Any collaboration info access should be checked for null (fix verified locally):

ICollaborationInfo collaborationInfo = userMsg.getCollaborationInfo();
if (collaborationInfo != null) {
   headers.setHeader(HTTPHeaders.CONVERSATION_ID, collaborationInfo.getConversationId());
   headers.setServiceHeader(collaborationInfo.getService());
   headers.setHeader(HTTPHeaders.ACTION, collaborationInfo.getAction());
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.