Service Virtualization

Expand all | Collapse all

Creating MQ Service using RR pairs by API

Jump to Best Answer
  • 1.  Creating MQ Service using RR pairs by API

     
    Posted 01-24-2018 12:13 PM

    Hi all, 

     

    Does anyone have a serviceProperties.xml file that I can use as an example to create a MQ service using API? 

     

    Regards,

    Francis



  • 2.  Re: Creating MQ Service using RR pairs by API

     
    Posted 02-01-2018 08:19 AM

    Is it possible to create a MQ service by Req/Resp files using the API? 

     

    Thanks,

    Francis



  • 3.  Re: Creating MQ Service using RR pairs by API

    Posted 02-02-2018 11:29 AM

    The product documentation for the relevant API (here) has this section 

     

    Configuring How the Virtual Service Is Created and Deployed

    When creating a virtual service from request/response pairs, the following assumptions are made:

    • The name for the virtual service is a generated name with the "AutoGenService-" prefix, followed by a GUID.
    • The virtual service is created using the HTTP protocol handler to import the request/response pairs
    • Each request/response pair is treated as text.
    • The virtual service listens on a randomly available port that the VSE server assigns
    • The base path of the service is set to "/"

    So, officially no.

    You can obtain more control if you use a VRS file, however. The same area of the document contains 

    Virtual Recording Session (VRS) File

    In addition to the serviceProperties.xml configuration, a Virtual Recording Session (VRS) file can be included to configure the protocol handler to use when importing request/response pairs. This file must have a .vrs extension.

     

    You can create a VRS file from the service recorder in Workstation.

    If you still have trouble getting the API to do what you want, there is also the ServiceImageManager command line utility in the "bin" folder of your installation. Here you can set transport protocols:


    -t protocol, --transport=protocol
          Specifies the transport protocol to use during an import
          operation. Valid protocols are:
                   TCP
                   CICS LINK (DPL), DTP (MRO, LU6.1, LU6.2)
                   HTTP/S
                   Opaque Data Processing
                   IBM MQ Native
                   IBM MQ Series (Deprecated)
                   JMS
                   Standard JMS (Deprecated)
                   RabbitMQ
                   Java
                   JDBC (Driver based)
                   CICS Transaction Gateway (ECI)
                   DRDA
                   IMS Connect
                   SAP RFC via JCo
                   JCo IDoc Protocol

    This may be a way to achieve what you need 



  • 4.  Re: Creating MQ Service using RR pairs by API

     
    Posted 02-02-2018 02:39 PM

    Dave, 

     

    I tryed by command line:

    ServiceImageManager.exe -t "IBM MQ Native" -r "SWIFT Data Protocol" -R "SWIFT Data Protocol" -s mq1.vsi -m mq1.vsm -v "c:\francis\mq_example.vrs" -i "C:\francis\MT202.TXT" -C "C:\francis\project.config"

     

    The error presents: 

    2018-02-02 19:12:57,471Z (17:12) [main] ERROR System.err - An error occurred processing the command.
    2018-02-02 19:12:57,472Z (17:12) [main] ERROR System.err - java.lang.RuntimeException: An error occurred trying to perform the import operation.
    2018-02-02 19:12:57,472Z (17:12) [main] ERROR System.err - at com.itko.lisa.vse.stateful.ServiceImageManager.doImport(ServiceImageManager.java:432)
    2018-02-02 19:12:57,473Z (17:12) [main] ERROR System.err - at com.itko.lisa.vse.stateful.ServiceImageManager.main(ServiceImageManager.java:151)
    2018-02-02 19:12:57,473Z (17:12) [main] ERROR System.err - at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2018-02-02 19:12:57,474Z (17:12) [main] ERROR System.err - at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    2018-02-02 19:12:57,474Z (17:12) [main] ERROR System.err - at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    2018-02-02 19:12:57,475Z (17:12) [main] ERROR System.err - at java.lang.reflect.Method.invoke(Method.java:498)
    2018-02-02 19:12:57,475Z (17:12) [main] ERROR System.err - at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
    2018-02-02 19:12:57,476Z (17:12) [main] ERROR System.err - at com.exe4j.runtime.WinLauncher.main(Unknown Source)
    2018-02-02 19:12:57,477Z (17:12) [main] ERROR System.err - at com.install4j.runtime.launcher.WinLauncher.main(Unknown Source)
    2018-02-02 19:12:57,477Z (17:12) [main] ERROR System.err - Caused by: java.lang.RuntimeException: An error occurred trying to perform the import operation.
    2018-02-02 19:12:57,477Z (17:12) [main] ERROR System.err - at com.itko.lisa.vse.stateful.ServiceImageManager.doImport(ServiceImageManager.java:505)
    2018-02-02 19:12:57,478Z (17:12) [main] ERROR System.err - at com.itko.lisa.vse.stateful.ServiceImageManager.doImport(ServiceImageManager.java:429)
    2018-02-02 19:12:57,479Z (17:12) [main] ERROR System.err - ... 8 more
    2018-02-02 19:12:57,479Z (17:12) [main] ERROR System.err - Caused by: java.lang.IllegalArgumentException: Unsupported import tag, <null>, specified.
    2018-02-02 19:12:57,479Z (17:12) [main] ERROR System.err - at com.itko.lisa.vse.stateful.recorder.DefaultRecordingSession.importTransactions(DefaultRecordingSession.java:579)
    2018-02-02 19:12:57,480Z (17:12) [main] ERROR System.err - at com.itko.lisa.vse.stateful.recorder.RecordingSession.importTransactions(RecordingSession.java:424)
    2018-02-02 19:12:57,480Z (17:12) [main] ERROR System.err - at com.itko.lisa.vse.stateful.ServiceImageManager.doImport(ServiceImageManager.java:495)
    2018-02-02 19:12:57,481Z (17:12) [main] ERROR System.err - ... 9 more

     

    Sending attached the files that I used and my svcimgmgr.log file. 

     

    Do you have any idea for this error? 

     

    Regards,

    Francis

    Attachment(s)

    zip
    francis.zip   1K 1 version
    zip
    svcimgmgr.log.zip   40K 1 version


  • 5.  Re: Creating MQ Service using RR pairs by API

    Posted 02-05-2018 04:48 AM

    As per Kevin's response, the newer MQ steps aren't supported when using a vrs. The older steps will be, but are deprecated - so there would be very limited support available should you encounter difficulties. 



  • 6.  Re: Creating MQ Service using RR pairs by API

    Posted 02-02-2018 02:05 PM

    Hi Francis,

     

    I tried MQ RR pairs with a serviceProperties.xml file which I created and it didn't work for me. I got the below error in Postman when I tried the POST URL as http://localhost:1505/api/Dcm/VSEs/VSE/actions/createService

     

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><Error xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ca.com/lisa/invoke/v2.0 Error.xsd" type="application/vnd.ca.lisaInvoke.error+xml" xmlns="http://www.ca.com/lisa/invoke/v2.0"><Id>1009</Id><Message>Unsupported Media Type (Please, check Content-Type header.)</Message></Error>

     

    As far as I know in Invoke API V2, don't think we support MQ protocol as Portal doesn't support it. I am not sure is there a way, we can do it.

     

    I am attaching the sample zip file I tested.

    https://communities.ca.com/docs/DOC-231179934-rrzip



  • 7.  Re: Creating MQ Service using RR pairs by API
    Best Answer

    Posted 02-02-2018 02:26 PM

    What are you setting for the 'Content-Type' HTTP header?  That error looks like a basic HTTP header verification issue, probably unrelated to whether you're using a supported transport protocol for your VS.

     

    To answer your original question:  You can create a VS with the *old* 'IBM MQ Series' transport protocol through the portal.  It requires to to first generate your VS once using Workstation and save the .vrs recording session file at the end of that process.  Then you can use that .vrs file to generate more VSs with the same parameters through the portal.

     

    I haven't tried doing that with the API, but it should work the same way.

     

    We basically don't yet support this with the newer 'IBM MQ Native' protocol, as its .vrs is not self-contained.



  • 8.  Re: Creating MQ Service using RR pairs by API

     
    Posted 02-02-2018 02:40 PM

    Prema and Kevin, 

     

    Thanks for the answer. I will try by command line using the vrs. I let you know the results.

     

    Regards,

    Francis 



  • 9.  Re: Creating MQ Service using RR pairs by API

     
    Posted 02-05-2018 06:48 AM

    I tried using VRS and the service was generated. I will verify if the OLD MQ is sufficient for the customer. 

     

    Regards!

    Francis 



  • 10.  Re: Creating MQ Service using RR pairs by API

     
    Posted 02-15-2018 01:48 PM

    Kevin 

     

    The service is been created in VSE, but present some errors after that: 

    Asset not found config://queue-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

     

    I think those errors occurred because I need to send the assets inside the zip file. Is it possible to send the project.config and the assets inside the zip file when generating the service by API? 

     

    Regards,

    Francis



  • 11.  Re: Creating MQ Service using RR pairs by API

    Posted 02-15-2018 02:50 PM

    Like I said, it's not really supported for the new 'IBM MQ Native' protocol, for exactly the reason you have discovered. 

     

    You need to be using the old 'IBM MQ Series' protocol, which does not depend on extra config being present.