cancel
Showing results for 
Search instead for 
Did you mean: 

calling a Webservice

arno1
Champ in-the-making
Champ in-the-making
Hello,

I'm trying to call a simple webservice by using an Activiti servicetask.
It simply doesn't work.
Here's the code of my WS:

HelloWorldService.java:

package serverside.service;

import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

@WebService
@SOAPBinding(style=Style.RPC)

public class HelloWorldService{
   
   public String showMessage(){
      return "Hello, here's the WebService!";
   }
}



HelloWorldServiceServer.java:

package serverside.service;

import javax.xml.ws.Endpoint;


public class HelloWorldServiceServer {

   /**
    * @param args
    */
   public static void main(String[] args) {
      HelloWorldService server = new HelloWorldService();
      Endpoint endpoint = Endpoint.publish("http://localhost:8029/helloworld", server);
   }

}


So, the WS itself is okay, I can see the wsdl file if I'm calling http://localhost:8029/helloworld?wsdl.

But I've tried to call the method of this simple service by deploying and calling the accordant process definition (see one of the screenshots).
I get an exception which tells me that no processes are deployed by my used processId.
So there must be a problem with the deployment or not? I really have no idea since I'm not an Activiti expert….

I supported three screenshots (one of my bpmn20.xml file which contains my process definition, one of the java code where I want to deploy and to work with the definition and one of the exception).

So, can anybody help me to correct the failure? I just want to call my showMessage method from the WS by using an webservice task from Activiti and want to see the string result in my console output of my calling java program.

I hope somebody is able to help me…
Thanks!
6 REPLIES 6

bluerain
Champ in-the-making
Champ in-the-making
The problem that I see with your code is that
The process is not getting deployed , you need to add to the class path (example below )and you can jus specify the realtive path in your case
"diagrams/myDiagram.bpmn20.xml"

// Deploy the process definition
  repositoryService.createDeployment()
    .addClasspathResource("FinancialReportProcess.bpmn20.xml")
    .deploy();
// Start a process instance
  runtimeService.startProcessInstanceByKey("financialReport");

Try it out…

cheers
Blue

arno1
Champ in-the-making
Champ in-the-making
Thanks for the answer but I'm working with the addInputStream method, not with the addClasspathResource method.
I know that the tutorial code is working with the addInputStream method if you use it instead of the addClasspathResource - i've tried it out (see this thread: http://forums.activiti.org/en/viewtopic.php?f=6&t=1438&p=6005#p6005 ). And since I'm using the same method in my above stated problem I'd like to know why there no deployment (or whatever) happens…

frederikherema1
Star Contributor
Star Contributor
Strange… If the file doesn't exist, the FileinputStream will throw an exception -> not the case here. Can you check if the resources are present in your DB and the deployment actually contains the resource?

Looks like the BPMNDeployer isnn't picking up the processes in the xml… Maybe something with namespaces?

arno1
Champ in-the-making
Champ in-the-making
everything is there where it should be. it doesn't even work if I try it out with an empty process without any functionality…

peterwanschou
Champ in-the-making
Champ in-the-making
I have the same problem arno.

If i call the addClasspathResource(xxx) the workflow will get a correct deployment. If i use the method addInputStream() the deployment is not correct.

After deployment with addClasspathResource() the following log will be generated:
26.04.2011 22:23:50 org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource main/resources/diagrams/SimpleSendReceive@pA.bpmn20.xml
26.04.2011 22:23:51 org.activiti.engine.impl.bpmn.parser.BpmnParse parseDefinitionsAttributes
INFO: XMLSchema currently not supported as typeLanguage
26.04.2011 22:23:51 org.activiti.engine.impl.bpmn.parser.BpmnParse parseDefinitionsAttributes
INFO: XPath currently not supported as expressionLanguage


After deployment with addInputStream() the following log will be generated:
26.04.2011 22:13:21 org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource SimpleSendReceive@pB


In ActivitProbe i see also a difference:
With addClasspathResource() i see my deployment at the DEPLOYMENT tab and my added process.
But with addInputStream() i see only my deployment and no process.

The funny thing is, that the method addClasspathResource calls implicit the method addInputStream(). The only difference is the name of the resource.

solution:
The name of the resource must end with "bpmn20.xml". When i import a resource than points to an existing file it have always the ending .bpmn20.xml, but i must also use the notation if i will use addString or addInputStream from the deployment service.

@frederikheremans: Inside the deployment service must be an hard query to the resource name. Why?

peterwanschou
Champ in-the-making
Champ in-the-making
ok i think it is clear why … because i can add different resouced with the method addClasspathResource (png etc.)