In Camunda BPM designer, I couldn't find activity and for invoking a REST or SOAP based webservices. Is it only possible to invoke through wiring code? How do I pass payload to the code if it needs to be written using java code.
Regards,
Phani
You can invoke a Webservice inside a bpmn.
You can create a Task of type Service, and choose in Properties/Details/Implementation: Connector.
Next you configure Connector properties, setting:
Connector Id: http-connector (for rest json webservices) and
Input Parameters:
url (e.g. http://localhost:8080/client?id=12
method GET/POST
headers type MAP: Accept application/json...
You receive the webservice response as Process Variables, configuring the Output parameters as follows :
response, type text, value ${response}
returnCode, type text, value ${statusCode}
Hope this helps you
For start: please note that camundas claim is "developer friendly". It's never been the goal of camunda components to just "click together" a working process. If you are looking for such a solution, you should a) have a look at the zero coding myth and b) maybe choose another tool.
That being said, check out the camunda-connect framework, introduced with 7.2, it should do what you need (though it involves xml coding).
For all but the most simple SOAP / REST calls, you'll need to go through java code. This takes a little getting used to when moving from other BPM platforms with extensive built-in webservice support. But trust me, java code is the way to go - import of transform / WSDL in the process definiton becomes such a holy mess.
I've written two CXF-based examples: soap-cxf-service and soap-cxf-server-start which will get you started.
I recommend creating a maven artifact per webservice and just adding the required services as standard maven dependencies for your process project.
Related
Is there any way to call a web service in a ssis package in order to insert some data into a table within SQL Server? How? any sample or guidance please?
I assume by your question, you are referring to using a web service as a destination for a data flow? I inherited a series of packages that integrate with our MS CRM site. As designed, these packages are a horrible fit for the SSIS paradigm but that's my burden to bear...
These packages generally fit the form of Source (OLE DB or Flat File) fed to a Script Task (destination). I don't know that providing all the code of a particular task would be enlightening. It's simply invokes the web service for each row sent into it. RBAR is not what SSIS or set based languages are made for but you can certainly do it.
The Script transformation will have a web reference (ours is named CrmSdk) to the service.
Declare an instance of the service as a member of ScriptMain.
Instantiate that service in your script, passing credentials as needed. Most likely in your PreExecute method
Make calls to the web service in your Input0_ProcessInputRow method using the Row.Column1 notation. Do be aware of nulls and how the web service handles them. Our code uses service.CompanyName = Row.CompanyName_IsNull ? string.Empty : Row.CompanyName;
If your intention is to use a web service at the Control Flow level, be aware that the default Task has a hard coded 5 minute timeout. Not sure if that's still the case, but in the 2005 package I was dealing with, we had to use a straight Script Task to communicate with our webservice (it was cleansing millions of rows of address data in batch fashion) to bypass the timeout issue. Reference to timeout property
I would like to use a WorkManager to schedule some parallel jobs on a WebLogic 10.3 app server.
http://java.sun.com/javaee/5/docs/api/javax/resource/spi/work/WorkManager.html
I'm finding the Oracle/BEA documentation a bit fragmented and hard to follow and it does not have good examples for using WorkManagers from EJB 3.0.
Specifically, I'd like to know:
1) What exactly, if anything, do I need to put in my deployment descriptors (ejb-jar.xml and friends)?
2) I'd like to use the #Resource annotation to inject the WorkManager into my EJB 3 session bean. What "name" do I use for the resource?
3) How do I configure the number of threads and other parameters for the WorkManager.
My understanding is that the underlying implementation on WebLogic is CommonJ, but I'd prefer to use a non-proprietary approach if possible.
First, you'll find the documentation of CommonJ, an implementation of the Timer and Work Manager API developed by BEA Oracle and IBM, in Timer and Work Manager API (CommonJ) Programmer’s Guide. They provide a Work Manager Example but it's not injected in this document.
1) What exactly, if anything, do I need to put in my deployment descriptors (ejb-jar.xml and friends)?
According to the Work Manager Deployment section:
Work Managers are defined at the
server level via a resource-ref in the
appropriate deployment descriptor.
This can be web.xml or ejb-jar.xml
among others.
The following deployment descriptor
fragment demonstrates how to configure
a WorkManager:
...
<resource-ref>
<res-ref-name>wm/MyWorkManager</res-ref-name>
<res-type>commonj.work.WorkManager</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
...
Note: The recommended prefix for the JNDI namespace for WorkManager
objects is java:comp/env/wm.
Check the WorkManager javadocs for more details (e.g. "The res-auth and res-sharing scopes are ignored in this version of the specification. The EJB or servlet can then use the WorkManager as it needs to.").
2) I'd like to use the #Resource annotation to inject the WorkManager into my EJB 3 session bean. What "name" do I use for the resource?
I'd say something like this (not tested):
#ResourceRef(jndiName="java:comp/env/wm/MyWorkManager",
auth=ResourceRef.Auth.CONTAINER,
type="commonj.work.WorkManager",
name="MyWorkManager")
3) How do I configure the number of threads and other parameters for the WorkManager.
See the description of the <work-manager> element and Using Work Managers to Optimize Scheduled Work for detailed information on Work Managers
My understanding is that the underlying implementation on WebLogic is CommonJ, but I'd prefer to use a non-proprietary approach if possible.
I don't have any other suggestion (and, as long as this implementation follows the standards, I wouldn't mind using it).
The Weblogic documentation will answer your questions.
Using Work Managers to Optimize Scheduled Work
My company uses a lot of different web services on daily bases. I find that I repeat same steps over and over again on daily bases.
For example, when I start a new project, I perform the following actions:
Create a new client & project in Liquid Planner.
Create a new client Freshbooks
Create a project in Github or Codebasehq
Developers to Codebasehq or Github who are going to be working on this project
Create tasks in Ticketing system on Codebasehq and tasks in Liquid Planner
This is just when starting new projects. When I have to track tasks, it gets even trickier because I have to monitor tasks in 2 different systems.
So my question is, is there a tool that I can use to create a web service that will automate some of these interactions? Ideally, it would be something that would allow me to graphically work with the web service API and produce an executable that I can run on a server.
I don't want to build it from scratch. I know, I can do it with Python or RoR, but I don't want to get that low level.
I would like to add my sources and pass data around from one service to another. What could I use? Any suggestions?
Progress DataXtend Semantic Integrator lets you build WebServices through an Eclipse based GUI.
It is a commercial product, and I happen to work for the company that makes it. In some respects I think it might be overkill for you, as it's really an enterprise-level data mapping tool for mapping disparate data sources (web services, databases, xml files, COBOL) to a common model, as opposed to a simple web services builder, and it doesn't really support your github bits, anymore than normal Eclipse plugins would.
That said, I do believe there are Mantis plugins for github to do task tracking, and I know there's a git plugin for Eclipse that works really well (jgit).
Couldn't you simply use Selenium to execute some of this tasks for you? Basically as long as you can do something from the browser, Selenium will also be able to do. Selenium comes with a language called "selenese", so you can even use it to programmatically create an "API" with your tasks.
I know this is a different approach to what you're originally looking for, but I've been using selenium for a number of tasks, and found it's even good to execute ANT tasks or unit tests.
Hope this helps you
What about Apache Camel?
Camel lets you create the Enterprise Integration Patterns to implement routing and mediation rules in either a Java based Domain Specific Language (or Fluent API), via Spring based Xml Configuration files or via the Scala DSL. This means you get smart completion of routing rules in your IDE whether in your Java, Scala or XML editor.
Apache Camel uses URIs so that it can easily work directly with any kind of Transport or messaging model such as HTTP, ActiveMQ, JMS, JBI, SCA, MINA or CXF Bus API together with working with pluggable Data Format options.
Are there any web services which will allow me to provide a file extension and it would return a list of possible MIME types?
For example:
http://mimetype.com/getMime/doc
Which could return:
application/msword,application/docappl/text,application/vnd.msword,application/vnd.ms-word,application/winword,application/word,application/x-msw6,application/x-msword
I don't want to use Urlmon.dll and I would prefer not having to keep my own list up-to-date.
Thanks
I just created this as part of my mimetype <-> icon service
http://stdicon.com/
For example :
http://stdicon.com/ext/html
It runs on appengine so it should have high availability.
The only thing I could imagine would be parsing the list which comes with the apache server
mime.types. The list is maintained by The Apache Software Foundation and depends on www.iana.org
Though its not exactly what you are asking for, this information is available via search by format in the PRONOM registry. The result is more fine-grained than MIME types, but you can get MIME info if available for the results (e.g. here, in the 'identifiers' section). There is also the DROID tool available to access this information via GUI, Java API or command line interface.
Sorry that I don't have a webservice for the task on hand, but you could use the fileext page and maybe parse the response if you can query the extension programmatically. Maybe a first step in the right direction.
This webservice could be very simple, a small DB / in memory store which could be as simple as a Dictionary<String, String> and just do a key lookup and return the result.
The first dataset could be (for example) based on http://www.webmaster-toolkit.com/mime-types.shtml.
The problem would probably be the hosting of such a webservice.
I don't know if there is a web service that would do this, but the libmagic library (http://en.wikipedia.org/wiki/Libmagic) is used for identifying filetypes and might be helpful for you.
The only thing that comes to mind is to parse output from http://www.file-extensions.org/
It won't give you the MIME type, but the good olde' Microsoft File Association Web Service could still help you. You access it this way:
http://shell.windows.com/fileassoc/0409/xml/redir.asp?Ext=xls
where 0409 means English (US) and xls is the file extension. On the plus side, it will be there and constantly updated... well, until Microsoft decides to pull the plug. Which can happen any time.
I have an application that sends messages to an external web service. I build and deploy this application using MSBuild and Cruisecontrol.NET. As CCNET build and deploys the app it also runs a set of test using NUnit. I'd now like to test the web service communication as well.
My idea is that as part of the build process a web service should be generated (based on the external web services WSDL) and deployed to the build servers local web server. All the web service should do is to receive the message and place it on the file system so I then can check it using ordinary NUnit for example. This would also make development easier as new developers would only have to run the build script and be up and running (not have to spend time to set up a connection to the third party service).
Are there any existing utilities out there that easily mock a web service based on a WSDL? Anyone done something similar using MSBuild?
Are there other ways of testing this scenario?
I just started looking into http://www.soapui.org/ and it seems like it will work nicely for testing web services.
Also, maybe look at adding an abstraction layer in your web service, each service call would directly call a testable method (outside of the web scope)? I just did this with a bigger project I'm working on, and it's testability is working nicely.
In general, a very good way to test things like this is to use mock objects.
At work, we use the product TypeMock to test things like Web Service communication and other outside dependencies. It costs money, so for that reason it may not be suitable for your needs, but I think it's a fantastic product. I can tell you from personal experience that it integrates very well with NUnit and CCNet.
It's got a really simple syntax where you basically say "when this method/property is called, I want you to return this value instead." It's great for testing things like network failures, files not being present, and of course, web services.
Take a look at NMock2. It's a open-source mocking product and allows you to create "virtual" implementations for interfaces that support rich and deep interaction.
For example, if your WS interface is called IService and has a Data GetData() method, you can create a mock that requires the method to be called once and returns a new Data object:
var testService = mockery.NewMock<IService>();
Expect
.Once
.On(testService)
.Method("GetService")
.WithNoArguments()
.Will(
Return.Value(new Data());
At the end of the test, call mockery.VerifyAllExpectationsHaveBeenMet() to assure that the GetData method was actually called.
P.S.: don't confuse the "NMock2" project with the "NMock RC2", which is also called "nmock2" on sourceforge. NMock2-the-project seems to have superseded NMock.
This might also be something - MockingBird. Look useful.
At my work place we are using Typemock and nUnit for our unit testing.