Announcement

Collapse
No announcement yet.

custom web service listener source

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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, 08:49 AM.

  • #2
    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.

    Comment


    • #3
      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, 09:47 AM.

      Comment


      • #4
        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)

        Comment


        • #5
          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.

          Comment


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

            Comment


            • #7
              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)

              Comment


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

                Comment


                • #9
                  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.

                  Comment


                  • #10
                    JAR Files are Posted
                    Attached Files

                    Comment


                    • #11
                      Yes, those JARs do not appear to be archived correctly. They need to be archived with the correct package structure. Plus, your MyWsTest JAR doesn't even have a compiled class in it, just the original .java source code.
                      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.

                      Comment


                      • #12
                        Here's an example of a correctly packaged JAR (attached).
                        Attached Files
                        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.

                        Comment

                        Working...
                        X