web stats
Mirth Community - View Single Post - custom web service listener source
View Single Post
  #7  
Old 05-06-2015, 05:08 AM
tmcdevitt tmcdevitt is offline
OBX.3 Kenobi
 
Join Date: Oct 2014
Posts: 125
tmcdevitt is on a distinguished road
Exclamation Creating a custom webservice Initialization failed

Hi Support

I am struggling to create my own web service in Mirth 3.2.1.7650

What I did
package com.mycompany.mirthws;

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

import com.mirth.connect.connectors.ws.AcceptMessage;
import com.mirth.connect.connectors.ws.WebServiceMessageR eceiver;

@WebService
public class MyWsTest extends AcceptMessage {

public MyWsTest(WebServiceMessageReceiver webServiceMessageReceiver) {
super(webServiceMessageReceiver);
}

@WebMethod
public String sayHello(String name) {
return "Hello" + name + ".";
}
}

I run JavaC and created the class then jarfile with jar cf MyWsTest.jar *.class
then I placed the jar file in my custom-lib folder and restarted Mirth

My Channel Config

Connector Type Web Service Listener

Port: 8081
Custom service checked
Service class name: com.mycompany.MyWsTest
Service name: MyWsTest

I get the following WSDL URL: http://localhost:8081/services/MyWsTest?wsdl

What I need to do is to access my sayHello method but I cannot figure out how. Is there a step I am missing?

I am quite new to Mirth so any help here would be highly appreciated.


The server log error
[2015-05-06 08:53:18,628] ERROR (com.mirth.connect.connectors.ws.WebServiceReceive r:132): Custom web service class initialization failed
java.lang.ClassNotFoundException: MyWsTest
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.mirth.connect.connectors.ws.WebServiceReceiver .onStart(WebServiceReceiver.java:114)
at com.mirth.connect.donkey.server.channel.SourceConn ector.start(SourceConnector.java:103)
at com.mirth.connect.donkey.server.channel.Channel.st art(Channel.java:671)
at com.mirth.connect.server.controllers.DonkeyEngineC ontroller$ChannelStatusTask.execute(DonkeyEngineCo ntroller.java:1381)
at com.mirth.connect.server.channel.ChannelTask.call( ChannelTask.java:59)
at com.mirth.connect.server.channel.ChannelTask.call( ChannelTask.java:16)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
at java.lang.Thread.run(Unknown Source)
Reply With Quote