Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom web services to pass in a RawMessage object in addition to just a string #2957

rbeckman-nextgen opened this issue May 11, 2020 · 3 comments


Copy link

@rbeckman-nextgen rbeckman-nextgen commented May 11, 2020

This would be useful for custom methods that need to pass in metadata as well as the actual payload. They would be able to place that metadata in the channel map of a RawMessage object, and pass that into processData instead.

The actual changes needed are very small: Just add a second version of processData that takes in a RawMessage.

Imported Issue. Original Details:
Jira Issue Key: MIRTH-3038
Reporter: narupley
Created: 2013-10-31T09:06:00.000-0700

@rbeckman-nextgen rbeckman-nextgen added this to the 3.1.0 milestone May 11, 2020
Copy link
Collaborator Author

@rbeckman-nextgen rbeckman-nextgen commented May 11, 2020

Revision 7260: The Web Service Listener now supports custom classes that pass in a RawMessage object instead of just a string.

Imported Comment. Original Details:
Author: narupley
Created: 2014-08-05T08:45:37.000-0700

Copy link
Collaborator Author

@rbeckman-nextgen rbeckman-nextgen commented May 11, 2020

I created my own Custom Webservice Listener by extending the Mirth AcceptMessage class. Within this class, I created a raw message object with various destinations, a channelMap/sourceMap key/value pairs and sample message. I was able to dispatch the rawMessage object to the downstream listener channel without incident. I verified that my function correctly executed and processed the data and that the injected mapper variables showed up.

Imported Comment. Original Details:
Author: jaysenp
Created: 2014-09-15T17:22:40.000-0700

Copy link
Collaborator Author

@rbeckman-nextgen rbeckman-nextgen commented May 11, 2020

Here is sample code:

package com.custom.webservice;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

import com.mirth.connect.donkey.model.message.RawMessage;

// import com.mirth.connect.server.userutil.RawMessage;

public class CustomAcceptMessage extends AcceptMessage {
WebServiceReceiver receiver;

public CustomAcceptMessage(WebServiceReceiver webServiceReceiver) {
    receiver = webServiceReceiver;

@WebMethod(action = "sample_operation")
public String operation(@WebParam(name = "param_name") String param) {
    // implement the web service operation here
    return "THIS IS A TEST";

@WebMethod(action = "add")
public String add(@WebParam(name = "i") int i, @WebParam(name = "j") int j) {
    int k = i + j;

    String message = "Test " + k;
    Map<String, Object> sourceMap = new HashMap<String, Object>();
    sourceMap.put("testKey", "testValue");
    List destinations = new ArrayList<Integer>();

    RawMessage rawMessage = new RawMessage(message, destinations, sourceMap);

    try {
    } catch (Exception e) {

    return "test";


Imported Comment. Original Details:
Author: beverlys
Created: 2015-01-12T10:28:33.000-0800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.