How to create SOAPAdater using IBM worklight 6.2? - soap

I am trying to create Soap Adapter using IBM Work light but I am not able to get web services methods to work light projects Services folder. When I am running my project after deployment of adapter it will not showing proper output. Let me know if anyone had made demo or some good Links related to it.

Your explanation does not provide the steps you have actually taken nor the expected output, the service you are using, the error you're getting, etc... so it is somewhat difficult to understand/recreate the issue... Also, please do mention the build number of the Worklight Studio 6.2 installation you're using.
There is no such thing as a "SOAP adapter" per-se. What you are referring to is "HTTP adapter" that is generated by providing a WSDL scheme location.
For example, WebServiceX.net provides a global weather service.
In order to generate an adapter from the above:
Create a new project
In the project structure, right-click on the Services folder and select "Discover back-end services"
From the "Service type" dropdown, select "Web Service Definition Language (WSDL)"
In the "URL" field paste "http://www.webservicex.net/globalweather.asmx?WSDL" and click on "Go"
From the "Select Service" table, select a service and click on "Finish"
The end result is a new HTTP adapter in the adapters folder called "SoapAdapter1", containing an auto-generated XML and -impl.js file ready to use.
You can read more about it, here:
HTTP adapters training module, slide #16
Generating adapters with the services discovery wizard user documentation topic
I also suggest using the very latest iFix available for the 6.2.0.1 release, as it contains some WSDL-related fixes, so best to be up-to-date.
It can be downloaded from either IBM Fix Central or from the Eclipse Marketplace (Eclipse > Help > Marketplace).

Finally I have successfully consume weather Soap service.
Below given is main function which should call after successful connection.
function loadContactSuccess(result){
WL.Logger.debug("Device is connected to WL server");
WL.Logger.info("Inside loadContactSuccess" );
var list = result.invocationResult.Envelope.Body.GetWeatherInformationResponse.GetWeatherInformationResult.WeatherDescription;
console.log("list detail ..." + list);
sessionStorage.setItem("WeatherDescription", JSON.stringify(result.invocationResult.Envelope.Body.GetWeatherInformationResponse.GetWeatherInformationResult.WeatherDescription));
WL.Logger.debug("WeatherDescription list :: ", JSON.parse(sessionStorage.getItem("WeatherDescription")));
var tempValue = JSON.parse(sessionStorage.getItem("WeatherDescription"));
console.log("Inside loadContactSuccess ..." + tempValue.length);
text = "";
var i;
for (i = 0; i < tempValue.length; i++) {
text += tempValue[i].WeatherID +" "+"<img src="+ tempValue[i].PictureURL +">" + "<br>";
}
document.getElementById("demo").innerHTML = text ;
}
You can also download demo example create by me from URL.Click Here

Related

Cannot install dymo web services

I have been trying to install the dymo web services for the last 2 hours on my Windows 10. I have tried everything. I tried regular installation. I tried custom installation selection dymo web service. I cannot locate the DYMO.DLS.Printing.Host.exe in my computer. I do have DYMO.WebApi.Win.Host.exe on my computer. The app says that the dymo connect service is running on port 41951.
I even have this icon:
But when i click diagnose I do not see this:
All I see is this:
When I go to this
https://127.0.0.1:41951/DYMO/DLS/Printing/Check
url to check my print service
I get:
No HTTP resource was found that matches the request
URI 'https://127.0.0.1:41951/DYMO/DLS/Printing/Check'.
No route data was found for this
request.
a bit late but I just had the same issue. These are the endpoints I have found, according to the latest js framework, below. You could use https://127.0.0.1:41951/DYMO/DLS/Printing/StatusConnected to test connectivity.
WS_CMD_STATUS = "StatusConnected",
WS_CMD_GET_PRINTERS = "GetPrinters",
WS_CMD_OPEN_LABEL = "OpenLabelFile",
WS_CMD_PRINT_LABEL = "PrintLabel",
WS_CMD_PRINT_LABEL2 = "PrintLabel2",
WS_CMD_RENDER_LABEL = "RenderLabel",
WS_CMD_LOAD_IMAGE = "LoadImageAsPngBase64",
WS_CMD_GET_JOB_STATUS = "GetJobStatus";
Hope that helps you or someone else. The documentation is not very good.

How to test JMS request without creating SOAP or REST project in SOAPUI

I am trying to automate some testing for TIBCO BW project (version 5.7 cannot migrate to newer) I found that SOAPUI can be used for testing JMS. However, it requires that I create a REST or SOAP project and supply it with wsdl. I don't want to test SOAP over JMS but plain JMS communications. Is there any way to do it in SOAPUI? If not, can you recommend any other tool that can be used for unit testing automation of TIBCO Business Works project? I cannot afford BWUnit. I did a lot of research and can't find any other tutorials or solutions. All solutions are about testing SOAP over JMS
For your use case, you can give a try to JMSToolBox and its "script" feature, combined with the "templates" and "variables" features
(FYI, I'm the author of JMSToolBox)
I will restrict my answer to SOAP UI as that is the original question.
The only way I have found in SoapUI to perform pure JMS testing, is to use a "Groovy Script" as a Test Step in a Test Case - basically, one must define a JMS session/connection information in HermesJMS and use that session in a "Groovy Script" to publish/browse/receive JMS messages.
Below, I will describe the steps to setup a JMS Session in HermesJMS to TIBCO EMS and also the steps to setup a simple SoapUI project (non-SOAP, non-REST) to use a Groovy Script step in a Test Case, to publish messages to an EMS queue and browse messages from the same queue. This concept can then be extended to achieve various complex test scenarios, assertions for verification of data, load tests for performance testing etc.
Disclaimer: I have only tested this concept for a simple use-case in SoapUI free version, so I am not sure what are the limitations of using a groovy script; One obvious limitation which comes to mind is the fact that one will need to write actual code to perform all the tests, instead of using a no-code approach provided by SoapUI, but there may be other limitations as well.
So, here are the steps:
1. Setup and Install: When installing SoapUI ensure to select "install Hermes JMS". I am using SoapUI 5.5.0 free version and I chose to install HermesJMS as part of the default SoapUI installation, as shown in the screenshot below.
2. Launch HermesJMS: Start SoapUI and Launch HermesJMS from within SoapUI.
Select Project > Start HermesJMS. On the screen which will pop-up (shown below), click OK. This will launch HermesJMS.
3. Create a new session. Click on "Create Session" button as shown below.
4. Enter a name for the session: Use session name as tibemslocal. click Apply and then OK. Session is now available in the sessions panel and ready to be configured.
5. Add a provider: Click the Providers tab at the bottom. Right-click in the classpath groups area and select "Add Group".
Assign a group name: Assign the name as TIBCOEMS-8.4 and click OK.
Add JAR files: Right click on library and select "Add JAR" and then select the JARs to be added and click Open, as shown in second screenshot below. A new window will pop-up, which will require you to choose whether to scan the jars or not, as shown in screenshot 3 below -- select Scan. This will scan the jars and add them to the library. Now, add all the Jars as shown in the fourth screenshot below and click Apply. This will add the provider. Click OK and restart HermesJMS for the configuration to take effect.
6. Setup Connection Factory: After HermesJMS has been restarted, from the sessions menu, select tibemslocal, right-click and select edit. In the connection factory section, select TIBCOEMS-8.4 as the loader (provider which we created in the previous step) and select class as "com.tibco.tibjms.TibjmsConnectionFactory", as shown in screenshot below. click Apply.
7. Connection Factory Property Setup: Now, in the same session editor window, setup properties for Connection Factory, as shown in the screenshot below. Click Apply.
8. Plug-in Property Setup: Now, in the same session editor window, select Plug In value as "TIBCO EMS" instead of "Default" and setup properties for Plug in, as shown in the screenshot below. Click Apply and OK.
9. Verify Session: TIBCO EMS Server used in the setup above must be running. To verify correctness of the JMS session setup, right-click on the "tibemslocal" session and click on Discover, as shown in the first screenshot below. If the setup is correct, it should discover the queues and topics, as shown in the second screenshot below. Close HermesJMS.
10. Setup SoapUI Project:
Create Empty Project: Click on Empty Project button on the left and rename the project to JMSTester, as shown in the screenshot below.
Add New Test Suite: Add a new TestSuite and call it SimpleJMSTests.
Add A New Test Case: Add a new test case and call it "SendToAndBrowseQueue".
Add A New Test Step: Add a new Test Step as "Groovy Script" and add the following code to it. Ensure the TIBCO EMS instance has a queue named "test" created on it.
import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSConnectionHolder
import com.eviware.soapui.impl.wsdl.submit.transports.jms.util.HermesUtils
import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSEndpoint
import hermes.Hermes
import javax.jms.*
def date1 = new Date()
def milli = date1.getTime()
log.info "Start Groovy Script Execution: " + date1
log.info "Unique Partial CorrelationID (cid) value for this session is: " + milli
def jmsEndpoint = new JMSEndpoint("jms://tibemslocal::queue_test::queue_test");
def hermes = HermesUtils.getHermes(context.testCase.testSuite.project, jmsEndpoint.sessionName)
def jmsConnectionHolder = new JMSConnectionHolder(jmsEndpoint, hermes, false, null, null, null);
Session queueSession = jmsConnectionHolder.getSession();
Queue queueSend = jmsConnectionHolder.getQueue(jmsConnectionHolder.getJmsEndpoint().getSend());
Queue queueBrowse = jmsConnectionHolder.getQueue(jmsConnectionHolder.getJmsEndpoint().getReceive());
MessageProducer messageProducer = queueSession.createProducer(queueSend);
TextMessage textMessageSend = queueSession.createTextMessage();
textMessageSend.setText("1 - jms message from groovy");
textMessageSend.setStringProperty("cid", "Msg:1:" + milli);
messageProducer.send(textMessageSend);
textMessageSend.setText("2 - another jms message from groovy");
textMessageSend.setStringProperty("cid", "Msg:2:" + milli);
messageProducer.send(textMessageSend);
QueueBrowser qb = queueSession.createBrowser(queueBrowse);
Enumeration en = qb.getEnumeration();
if (en.hasMoreElements()) {
log.info "There are messages to process from the queue."
}
while (en.hasMoreElements())
{
Message msg = en.nextElement();
TextMessage tm = (TextMessage) msg;
def cid = tm.getStringProperty("cid");
if (cid != null) {
if (cid.contains(milli.toString())) {
log.info "Message From This Session --> " + tm.getText()
log.info "cid = " + cid
} else {
log.debug "Message Not from This session --> " + tm.getText()
log.debug "cid = " + cid
}
} else
log.info "CorrelationGUID is null"
}//ENDS - while
jmsConnectionHolder.closeAll() // don't forget to close session and connection
log.info "done"
Execute Groovy Step: Execute the groovy step and it should produce the following output, as shown in the screenshot below.
In these steps, we configured HermesJMS with TIBCO EMS and then used the HermesJMS session to create a connection to TIBCO EMS using Groovy script from SoapUI and invoked the Groovy Script as a test step to publish two messages to a EMS queue and browsed the same messages. This confirms the capability to publish/browse messages.
I believe this functionality can be extended to receive messages from queues/topics, test content/property values with assertion etc., which is left for the reader/OP to implement and test.
Hope this will be helpful. If there are any questions please let me know.
References
Groovy Script Sample: The aforementioned groovy script has been copied from the SoapUI tutorial and modified for the need of this demonstration. Original Source is available here - SoapUI Sample Groovy code
SoapUI and HermesJMS: See this article on SoapUI website - SoapUI and HermesJMS Setup

Agile Classes.jar file

I am using Agile PLM Version: 9.3.0.2 (Build 20). I am on the client side. I'm trying to use Eclipse to interact with Agile's API features. According to the Agile SDK Developer Guide I need both:
AgileAPI.jar
agileclasses.jar
I have the AgileAPI.jar file, but I don't have the agileclasses.jar file.
Any suggestions/links/ methods in which I can obtain this file!
AgileAPI.jar, contains the factories and interfaces used by the Agile EJB on server side.
If you have an Agile instance on a server, you don't need to have agileclasses.jar (unofficial API) but creating an IAgileSession using AgileSessionFactory, all the implementation of interfaces (IChange, IPrograms, IItem. etc) are retrieved using it.
session.getObject(IChange.OBJECT_TYPE, "ChangeNumber123");
where did you find that agileclasses.jar is required?
However, you can find them in the Weblogic Server shared lib folder.
EDIT
Eclipse interacts with an Agile Server using AgileAPI.jar.
String server = "http://myServer:7001/Agile";
HashMap<Integer,String> params = new HashMap<Integer, String>();
AgileSessionFactory instance = AgileSessionFactory.getInstance(server);
params.put(AgileSessionFactory.USERNAME, "myUsername");
params.put(AgileSessionFactory.PASSWORD, "myPassword");
IAgileSession session=instance.createSession(params);
IItem item = (IItem) session.getObject(IItem.OBJECT_TYPE, "ITEMID1234");
item.setValue("Page Two.MYFIELD", "Value");
The example above, connect to an instance of Agile (server) already started up and get the item with number ITEMID1234. Then it sets the value of a field (MYFIELD) with "Value"

Upgrading from DeploymentService to ProfileService in JBoss 5.1.0 GA

In Jboss 5.1 the Profile Service does what the Deployment Service was doing in Jboss 4.x.In Jboss 4.x I was using the Deployment Service to create a datasource "on-the-fly" and I was wondering if I could do the same thing using the Profile Service (since Deployment Service doesn't exist any more in Jboss 5.x).
Does anyone know a practical guid on using ProfileService?
Thank you ,
Regards.
I don't know of any guide but I can provide you with my experience using the Profile Service and a few links to JBoss wiki pages on this topic. I'd like to post more links but the spam protection doesn't allow me to post more than two, but you should easily find the other pages in the wiki on the ProfileService. Don't be suprised in case you don't find much, there isn't more.
ProfileService ManagementView
http://community.jboss.org/wiki/ProfileServiceManagementView
ProfileService DeploymentTemplates
http://community.jboss.org/wiki/ProfileServiceDeploymentTemplates
There you'll find usefull information about the ProfileService but no detailed information is available in the jboss wiki as far as I can tell.
In order to create Datasources on the fly you can use the DeploymentTemplates (also for creating message queues and topics) The last link provides you with information on how to use the templates but not with all the template names and their properties. You can list them programatically though.
// Get all Templates
for(String template : mgtView.getTemplateNames())
{
System.out.println("=========================================");
System.out.println("Listing properties for template: "+template);
DeploymentTemplateInfo info = mgtView.getTemplate(template);
for(String prop : info.getProperties().keySet())
System.out.println("- "+prop);
}
In order to get the ManagementView (mgtView) from an external java programm you can use something similiar to this:
// set security policy
System.setProperty("java.security.policy", "<path_to_policy_file>");
System.setSecurityManager( new RMISecurityManager() ) ;
// set initial context properties
Hashtable<String, String> env = new Hashtable<String, String>();
env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.put("java.naming.provider.url","jnp://localhost:1099");
env.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
ctx = new InitialContext(env);
// login to JBoss
SecurityClient client = SecurityClientFactory.getSecurityClient();
client.setSimple("admin", "admin");
client.login();
// get ProfileService and ViewManager
ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
mgtView = ps.getViewManager();
What you want to get is the Java Naming Conext (InitialContext). In order to do that you'll need a security policy (you can use the java.policy file which is located in JBOSS_HOME/server/SERVER_DIR/conf/),security manager and environment properties to get the context. The java.naming.provider.url specifies the location of the JBoss naming service (default port is 1099).
Usually you would have to authenticate at this point which is done with the SecurityClient.
Finally you can use the context to grap the ProfileService.
At this point most of the anoying stuff is done und you can start playing around.
getViewManager() returns the ViewManager with which you can create datasources on the fly and getDeploymentManager() will give you the DeploymentManager with which you can deploy, undeploy, start, stop applications and other deployments.
The libraries you'll need to do that are located in
JBOSS_HOME/client
JBOSS_HOME/lib
JBOSS_HOME/common/lib
I've read several times that including the jbossall-client.jar in the client directory should be enough but that's actually not true. You need libraries from all three directories as far as I can tell (couldn't do it without referencing all of them at least). I haven't figured out which exact jars you need though...
IMPORTANT: The ProfileService in Jboss 5 Community Edition has some bugs though which got fixed in JBoss 6. I'd either suggest using a newer JBoss version or the Enterprise Edition.

COM+ application deployment using command-line

I need to deploy my COM dll as a COM+ application. I used to do that from Component Services manager (dcomcnfg.exe). But my requirement is to deploy it from command-line. Is there a command to do that?
Update: And how to uninstall the same?
Thanks.
Here are a couple of scripts that dump a COM+ application's settings to an XML file, as well as installs applications from and XML file. It provided me a good framework for doing something similar a while back. It contains example code of how to create and remove COM+ applications using the COM+ administration API.
This vbscript snippet creates an application and installs a component:
Dim catalog
Dim applications
Dim application
Set catalog = CreateObject("COMAdmin.COMAdminCatalog")
Set applications = catalog.GetCollection("Applications")
Call applications.Populate
Set application = applications.Add()
' ID is an arbitrary GUID, that you can create using uuidgen
application.Value("ID") = "{da2d72e3-f402-4f98-a415-66d21dafc0a9}"
application.Value("Name") = "SampleApp"
application.Value("Activation") = 0' COMAdmin.COMAdminActivationOptions.COMAdminActivationLocal
application.Value("ApplicationAccessChecksEnabled") = 0 'COMAdmin.COMAdminAccessChecksLevelOptions.COMAdminAccessChecksApplicationComponentLevel
application.Value("Description") = "Sample Application"
'application.Value("Identity") = "machine\administrator"
'application.Value("Password") = "YourPassword"
application.Value("RunForever") = True
Call applications.SaveChanges
catalog.InstallComponent "SampleApp", "C:\Documents and Settings\me\My Documents\Test\MyTestProj.dll", "", ""
Set application = Nothing
Set applications = Nothing
Set catalog = Nothing
This is running on Windows XP -- other OS's may have different behavior. And it does seem to be pretty temperamental. If it doesn't work the errors are really vague and unhelpful.
To delete I think you will have to iterate over the the components in the application and remove from the list as per this example. I think a similar approach would be required to remove the entire application.
References
See Configurating COM+ for a good easy to understand article (but is not in script). MSDN has a good reference on Automating COM+ Administration and also the complete COM+ Administration Reference.