Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   custom web service listener source (http://www.mirthcorp.com/community/forums/showthread.php?t=14156)

tmcdevitt 05-04-2015 08:43 AM

custom web service listener source
 
Support, I created a custom web service listener source and copied the jar file to custom-lib folder but I am getting the error ClassNotFoundException. Is this the correct location for the jar?


Err
[2015-05-04 12:36:20,378] ERROR (com.mirth.connect.connectors.ws.WebServiceReceive r:132): Custom web service class initialization failed
java.lang.ClassNotFoundException: com.custom.webservice.CustomAcceptMessage


Class
import com.mirth.connect.connectors.ws.AcceptMessage;
import com.mirth.connect.connectors.ws.WebServiceReceiver ;

@WebService
public class CustomAcceptMessage extends AcceptMessage {


public CustomAcceptMessage(WebServiceReceiver webServiceReceiver){
super(webServiceReceiver);
}

narupley 05-04-2015 08:51 AM

Is the class actually in that "com.custom.webservice" package? I don't see it declared in the class you posted. It's also possible that you didn't correctly create the JAR.

Since you did not specify, I'll assume you're working with the latest version (3.2.1). After adding the JAR to custom-lib, go to the Resources tab and reload the default resource (which, by default, points to custom-lib). Or, you can put the JAR in a separate folder and create a new resource specifically for it. Then make sure your resource is checked for the source connector on the Set Libraries dialog in the channel.

tmcdevitt 05-04-2015 09:27 AM

Sorry I am using Mirth 3.2.1.7650 below is the class, I am want to call AvaibleOrder WebMethod. The resource is set for the default resource. directory is custom-lib and the loaded libraries are listed. I also checked the channel library resources are set for the default resource. Below is the class did I not create the jar correct?

package com.custom.webservice;

import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import java.util.ArrayList;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;

import com.mirth.connect.connectors.ws.AcceptMessage;
import com.mirth.connect.connectors.ws.WebServiceReceiver ;




@WebService
public class CustomAcceptMessage extends AcceptMessage {


public CustomAcceptMessage(WebServiceReceiver webServiceReceiver){
super(webServiceReceiver);
}


@WebMethod(operationName = "hello")
public String hello(@WebParam(name = "name") String txt) {
return "dHello " + txt + " !";
}
@WebMethod(operationName = "CheckOrders")
public String AvaibleOrder(@WebParam(name = "OrderID")Integer OrderID,@WebParam(name = "ArrDoc")ArrayList ArrDoc){
return "S";


}
}

tmcdevitt 05-05-2015 04:45 AM

I am still getting Class not found exception, is there anything else that needs me to me done for Mirth to find this jar. Do I need to add the class to Mirth?

[2015-05-05 08:36:09,156] ERROR (com.mirth.connect.connectors.ws.WebServiceReceive r:132): Custom web service class initialization failed
java.lang.ClassNotFoundException: CustomAcceptMessage
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$DeployTask.doDeploy(DonkeyEngineControll er.java:1274)
at com.mirth.connect.server.controllers.DonkeyEngineC ontroller$DeployTask.execute(DonkeyEngineControlle r.java:1171)
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)

narupley 05-05-2015 07:21 AM

It's still possible that the JAR was created incorrectly.

tmcdevitt 05-05-2015 07:51 AM

I use the command jar cfn CustomAcceptMessage.jar manifest.txt CustomAcceptMessage.class. Can it be the manifest file I just have Main-class:CustomAcceptMessage?

tmcdevitt 05-06-2015 05:08 AM

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)

tmcdevitt 05-06-2015 07:15 AM

I tested the wsdl using SoapUI, and I am getting the default page.

narupley 05-06-2015 07:32 AM

Post the JAR you're using; likely something's wrong with it.

tmcdevitt 05-06-2015 07:52 AM

2 Attachment(s)
JAR Files are Posted


All times are GMT -8. The time now is 01:40 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation