Re: [jboss-user] [Beginner's Corner] - Desperate for some documentation...please?
by Ken Kopelson
Ken Kopelson [http://community.jboss.org/people/kenbkop] replied to the discussion
"Desperate for some documentation...please?"
To view the discussion, visit: http://community.jboss.org/message/535675#535675
--------------------------------------------------------------
Hi Peter,
Well today I was able to make a very simple Web Service work, at least for a while, but then it broke again. Basically, what I am after is as follows, since I do not yet believe that I have seen what I am really looking for, partly because I didn't even know how to ask the question properly until just today after spending more time wrestling with this thing.
What I really need is a comprehensive example of how to write a Web Service that accepts a SOAP message using Document/Literal, unwraps the XML payload and sends back a response. A discussion of the tradeoffs between using WRAPPED and BARE parameters would also be helpful. There are apparently several ways to pass the message to a service method, but to keep it portable I found a document that says it is recommended (I don't know by who) to use SOAPElement type, but then it says to use WSDL-to-Java method, which doesn't seem to work from Eclipse (top-down method), and it seems quite a bit messier from a code point of view, etc. The problem with all the tutorials and the books I've seen is that none of them provide a comprehensive reference of ALL possible configuration values, along with explanation of when a certain setting should be used. Apparently, you can send a SOAP message to the service as a Source, a String, or a SOAPElement, but the WSDL doesn't accept the SOAPElement type, and must have the type set to "anyType", but that gets converted to a Java "Object" type by the "consume.bat" utility and I don't know how to map the "anyType" to a SOAPElement type.
Perhaps I need a good book just on Web Services for JBoss.... is there such a thing?
Every single tutorial I have seen so far seems either too simplistic or it leaves something out, whether it is a configuration setting, a configuration file, an Annotation, or something else, and these bits that get left out are not easily known since the documentation online is always out-of-date. Also, when a configuration setting is shown, it is often not documented as to why that setting is used, or the other alternatives are not documented so that an informed decision can be made.
Generally, this seems way too difficult for what it actually does. Maybe it's not dificult for someone who already knows by memory all the config options, and how to use them all, but since many people (including me) are not in that boat, I think things could be a lot easier if only there was update-to-date, comprehensive examples for ALL the various ways that JBoss can be used, especially the most common ways like Web Services.
A comprehensive example of a full blown Web Service (all files needed) that accepts a SOAP Document from any kind of system, breaks it apart, does something with the data, and then constructs a return message, would be quite helpful.
Thank for very much for your help!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/535675#535675]
Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 7 months
[JBoss Web Services] - Web Services class not known in context
by Tim Eakins
Tim Eakins [http://community.jboss.org/people/teakins] created the discussion
"Web Services class not known in context"
To view the discussion, visit: http://community.jboss.org/message/535672#535672
--------------------------------------------------------------
This is probably a simple one, but I'm stuck. I call a new Web Service, queryByObject, which could return several different objects.
I have the below test case to return a User object. If I change the method signature to return a User, it works. If I leave it as an Object, I get 'javax.xml.bind.JAXBException: class pfcommon.data.User nor any of its super class is known to this context.' Even with the XmlSeeAlso, it just won't add User into the schema.
Any help really appreciated! I put in all the components that I felt were relevant. JBoss 5.1.0.
Also, if there's anything else wrong in my style, happy to take comments, this is my first attempt at expanding my working EJBs to also be Web Services.
Thanks,
Tim
*//Interface*
@WebService
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
@XmlSeeAlso({pfcommon.data.User.class})
public interface TestConnectionInterface {
...
/**
* Select back one value
*/
@WebMethod
public Object queryForObject(String queryName, HashMap<String, Object> criteria);
...
}
*//Remote*
@Remote
public interface TestConnectionInterfaceRemote extends TestConnectionInterface { }
*//Implementation*
@Stateless
@WebService(endpointInterface="pfcommon.ejb.library.connect.TestConnectionInterface")
@XmlSeeAlso({pfcommon.data.User.class})
public class TestConnection implements TestConnectionInterfaceRemote, TestConnectionInterfaceLocal, TestConnectionInterface {
...
@Override
public Object queryForObject(String queryName, HashMap<String, Object> criteria) {
l.info("queryName=" + queryName);
//Simplified sample of something that could happen here
User ret = new User();
l.info("queryForObject ret="+ret);
return ret;
}
...
}
*//Client*
public void testWebServiceTestConnectionQuery() throws Exception {
boolean successfulTest = true;
String endpointURI = "http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnectio...";
try {
URL wsdlURL = new URL(endpointURI);
QName serviceName = new QName("http://connect.ejb.pf/", "TestConnectionService");
Service service = Service.create(wsdlURL, serviceName);
TestConnectionInterface tc = service.getPort(TestConnectionInterface.class);
assertNotNull(tc);
HashMap<String, Object> filterCriteria = new HashMap<String, Object>();
filterCriteria.put("username", "bob");
l.info("Attempting to call dummy queryForObject method");
User ret = (User) tc.queryForObject(PFConsts.SELECT_USER_BY_ACTIVE, filterCriteria);
l.info("User = ["+ret+"]");
} catch (Exception e) {
e.printStackTrace();
successfulTest = false;
}
assertTrue(successfulTest);
}
http://192.168.1.7:6881/jbossws/services
Registered Service Endpoints
Endpoint Name jboss.ws:context=PersonalFinancier-PersonalFinancier,endpoint=TestConnection
Endpoint Address http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnectio... http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnectio...
http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnectio...
<definitions name="TestConnectionService" targetNamespace="http://connect.ejb.pf/">
<import location="http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnectio..." namespace="http://connect.library.ejb.pfcommon/"/>
<service name="TestConnectionService">
<port binding="ns1:TestConnectionInterfaceBinding" name="TestConnectionPort">
<soap:address location="http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection"/>
</port>
</service>
</definitions>
*//Server Exception*
...
00:40:14,236 INFO [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@33435a77{name=jboss.j2ee:ear=PersonalFinancier.ear,jar=PersonalFinancier.jar,name=TestConnection,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
00:40:14,329 INFO [SessionSpecContainer] Starting jboss.j2ee:ear=PersonalFinancier.ear,jar=PersonalFinancier.jar,name=TestConnection,service=EJB3
00:40:14,329 INFO [EJBContainer] STARTED EJB: pf.ejb.connect.TestConnection ejbName: TestConnection
00:40:14,365 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
PersonalFinancier/TestConnection/remote - EJB3.x Default Remote Business Interface
PersonalFinancier/TestConnection/remote-pfcommon.ejb.library.connect.TestConnectionInterfaceRemote - EJB3.x Remote Business Interface
PersonalFinancier/TestConnection/local - EJB3.x Default Local Business Interface
PersonalFinancier/TestConnection/local-pfcommon.ejb.library.connect.TestConnectionInterfaceLocal - EJB3.x Local Business Interface
...
00:40:14,670 INFO [DefaultEndpointRegistry] register: jboss.ws:context=PersonalFinancier-PersonalFinancier,endpoint=TestConnection
00:40:16,225 INFO [WSDLFilePublisher] WSDL published to: file:/usr/java/jboss-5.1.0.GA-dev/server/pfdev/data/wsdl/PersonalFinancier.ear/PersonalFinancier.jar/TestConnectionService1705653235957235278.wsdl
...
00:40:20,905 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
00:40:20,905 INFO [STDOUT] Parameter constructor!
00:40:20,905 INFO [TestConnection] Successful basic connection. Now returning value [id=null fieldValue=Remote Simple Test].
00:40:20,905 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
00:40:26,754 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
00:40:26,755 INFO [TestConnection] queryName=selectUserByActive
00:40:26,770 INFO [TestConnection] queryForObject ret=
00:40:26,770 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
00:40:26,776 ERROR [RequestHandlerImpl] Error processing web service request
org.jboss.ws.WSException: javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException
- with linked exception:
[javax.xml.bind.JAXBException: class pfcommon.data.User nor any of its super class is known to this context.]
at org.jboss.ws.WSException.rethrow(WSException.java:68)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:336)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)
at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
...
Thanks again!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/535672#535672]
Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 7 months
[jBPM] - Is the simple fork/join with async execution paths broken in jBPM 4.0
by Manjunath Somashekar
Manjunath Somashekar [http://community.jboss.org/people/manjuss] created the discussion
"Is the simple fork/join with async execution paths broken in jBPM 4.0"
To view the discussion, visit: http://community.jboss.org/message/535670#535670
--------------------------------------------------------------
hi All,
We are exploring the simple fork/join construct for an usecase where in the execution path of each of the fork's branch has to be asynchronous. I have provided all the necessary details below, please do let me know if i am missing some thing very fundamental. This seems like a very fundamental usecase and may be we are missing just some very fundamental, please do let us know.
+*Issue faced:*+
The fork node starts the execution of both the branches in parallel by using inbuilt jBPM messaging. We have observed that the job executor picks up both the jobs and starts executing them concurrently. However the workflow never enters the join state.
+*Environment:*+
OS: Linux/Windows
Java: 1.5.0_22
jBPM: latest stable 4.0 release from sourceforge.
Executed as a simple JUnit testcase.
+*Problem definition:*+
We have a bunch of very long running processes that we want to execute in parallel. Once all these parallel processes are done we would like to continue with the workflow. We are trying to model this using fork/join and async continuation.
We are trying to execute the test cases provided in jBPM 4.0 with some minor modifications. For the prototype we are simulating long running processes as simple java nodes. The workflow definition is as follows:
+*process.jpdl.xml:*+
<?xml version="1.0" encoding="UTF-8"?>
<process name="AsyncFork" xmlns=" http://jbpm.org/4.0/jpdl http://jbpm.org/4.0/jpdl">
<start g="22,69,80,40">
<transition to="fork1" />
</start>
<fork g="99,68,80,40" name="fork1">
<transition g="122,41:" to="ship goods" />
<transition g="123,142:" to="send bill" />
</fork>
<java class="org.jbpm.examples.async.fork.Application" g="159,17,98,50"
method="shipGoods" name="ship goods" continue="async">
<transition g="297,42:" to="join" />
</java>
<java class="org.jbpm.examples.async.fork.Application" g="159,117,98,50"
method="sendBill" name="send bill" continue="async">
<transition g="297,141:" to="join" />
</java>
<join g="274,66,80,40" name="join">
<transition to="print join" />
</join>
<java g="159,117,98,50"
method="printjoin" name="print join">
<transition g="297,141:" to="end" />
</java>
<end g="353,67,48,48" name="end" />
</process>
+*Application.java: (Note: We have just modified the given java file)*+
package org.jbpm.examples.async.fork;
import java.io.Serializable;
/**
* @author Tom Baeyens
*/
public class Application implements Serializable {
private static final long serialVersionUID = 1L;
public void shipGoods() {
// assume automatic calculations here
for (int i = 10; i > 0; i--) {
System.out.println("Shipping goods");
sleep();
}
}
public void printjoin() {
System.out.println("Joining both the forked execution paths");
}
private void sleep() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void sendBill() {
// assume automatic calculations here
for (int i = 10; i > 0; i--) {
System.out.println("New:Sending bill");
sleep();
}
}
}
+*AsyncForkTest.java:+*(Note: We have just modified the given java file)*+*+
package org.jbpm.examples.async.fork;
import java.util.Date;
import java.util.List;
import org.jbpm.api.Execution;
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.job.Job;
import org.jbpm.test.JbpmTestCase;
/**
* @author Tom Baeyens
*/
public class AsyncForkTest extends JbpmTestCase {
String deploymentId;
protected void setUp() throws Exception {
super.setUp();
deploymentId = repositoryService.createDeployment()
.addResourceFromClasspath("org/jbpm/examples/async/fork/process.jpdl.xml")
.deploy();
}
protected void tearDown() throws Exception {
// repositoryService.deleteDeploymentCascade(deploymentId);
// super.tearDown();
}
public void testAsyncFork() {
ProcessInstance processInstance = executionService.startProcessInstanceByKey("AsyncFork");
String processInstanceId = processInstance.getId();
System.out.println("processInstanceId: " + processInstanceId);
while (true) {
}
// List<Job> jobs = managementService.createJobQuery()
// .processInstanceId(processInstanceId)
// .list();
//
// assertEquals(2, jobs.size());
//
// Job job = jobs.get(0);
//
// managementService.executeJob(job.getId());
//
// job = jobs.get(1);
//
// managementService.executeJob(job.getId());
//
// Date endTime = historyService
// .createHistoryProcessInstanceQuery()
// .processInstanceId(processInstance.getId())
// .uniqueResult()
// .getEndTime();
//
// assertNotNull(endTime);
}
}
+*jbpm.cfg.xml: We have enabled jobexecutor.*+
<?xml version="1.0" encoding="UTF-8"?>
<jbpm-configuration>
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.tx.hibernate.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
<!-- Job executor is excluded for running the example test cases. -->
<!-- To enable timers and messages in production use, this should be included. -->
<import resource="jbpm.jobexecutor.cfg.xml" />
<import resource="jbpm.mail.templates.examples.xml" />
</jbpm-configuration>
+*Our Observations and Analysis:*+
* 2 jobs gets created in the JBPM4_JOB table one each for the async execution path
* Job executor picks up both these jobs concurrently and starts executing the java action
* With debugger on what i have noticed is that each of the job executor threads loads up the ExecutionImpl object into the hibernate session at the start of the execution and rarely hits the DB back for obvious performance reasons.
* ExecutionImpl object is loaded at the start of thread execution, any of the state changes made by other job executor thread is not visible in the current thread unless the hibernate object is reloaded and this never happens as its a separate hibernate session and thread of execution.
* Each of the execution paths tries to execute the JoinActivity
* In the JoinActivity there is a check to see if all the branches have completed - this test fails always, hence workflow is in an indefinite wait state kind of a thing.
* Join is not executed.
Thanks
Manju
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/535670#535670]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 7 months