web stats
custom web service listener source - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 05-04-2015, 08:43 AM
tmcdevitt tmcdevitt is offline
OBX.3 Kenobi
 
Join Date: Oct 2014
Posts: 125
tmcdevitt is on a distinguished road
Exclamation 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);
}

Last edited by tmcdevitt; 05-04-2015 at 08:49 AM.
Reply With Quote
  #2  
Old 05-04-2015, 08:51 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

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.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 05-04-2015, 09:27 AM
tmcdevitt tmcdevitt is offline
OBX.3 Kenobi
 
Join Date: Oct 2014
Posts: 125
tmcdevitt is on a distinguished road
Exclamation

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";


}
}

Last edited by tmcdevitt; 05-04-2015 at 09:47 AM.
Reply With Quote
  #4  
Old 05-05-2015, 04:45 AM
tmcdevitt tmcdevitt is offline
OBX.3 Kenobi
 
Join Date: Oct 2014
Posts: 125
tmcdevitt is on a distinguished road
Exclamation

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)
Reply With Quote
  #5  
Old 05-05-2015, 07:21 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

It's still possible that the JAR was created incorrectly.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #6  
Old 05-05-2015, 07:51 AM
tmcdevitt tmcdevitt is offline
OBX.3 Kenobi
 
Join Date: Oct 2014
Posts: 125
tmcdevitt is on a distinguished road
Exclamation

I use the command jar cfn CustomAcceptMessage.jar manifest.txt CustomAcceptMessage.class. Can it be the manifest file I just have Main-class:CustomAcceptMessage?
Reply With Quote
  #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
  #8  
Old 05-06-2015, 07:15 AM
tmcdevitt tmcdevitt is offline
OBX.3 Kenobi
 
Join Date: Oct 2014
Posts: 125
tmcdevitt is on a distinguished road
Exclamation

I tested the wsdl using SoapUI, and I am getting the default page.
Reply With Quote
  #9  
Old 05-06-2015, 07:32 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

Post the JAR you're using; likely something's wrong with it.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #10  
Old 05-06-2015, 07:52 AM
tmcdevitt tmcdevitt is offline
OBX.3 Kenobi
 
Join Date: Oct 2014
Posts: 125
tmcdevitt is on a distinguished road
Default

JAR Files are Posted
Attached Files
File Type: jar MyWsTest.jar (692 Bytes, 52 views)
File Type: jar CustomAcceptMessage.jar (1.3 KB, 56 views)
Reply With Quote
Reply

Tags
webservice, webservice listener

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 08:05 PM.


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