-
1. Re: how to develop web service from scratch?
kurtstam Oct 29, 2007 1:21 PM (in response to fabianw)1.At JBoss we have our own WS implementation call JBossWS (we don't use axis/axis2). The easiest way to bring up a webservice is to use annotations on a POJO or EJB3 bean. For info on that see:
http://jbws.dyndns.org/mediawiki/index.php?title=JBossWS
2. Depending on what you want to do with jBPM ai would suggest you check out some of the jBPM quickstarts where JBossESB - jBPM integration is demonstrated. This why you can build jBPM services that can be approached over any protocol on the bus.
Hope this helps.
--Kurt -
2. Re: how to develop web service from scratch?
fabianw Oct 29, 2007 1:37 PM (in response to fabianw)Oh yes, I completely forgot JBossWS. I was irritated about these Axis settings in RHDS.
I know that I can use these annotations. I already created a litte POJO with annotations just like in the webservice_consumer1 quickstart. I just want to know how I can deploy this. Is it possible to deploy the service directly from inside of RHDS? And what else do I need for deployment? How can I generate the WSDL?
I will take a look at the link you posted but every hint helps!
And I'm not yet at the point of orchestration. First I have to get my services working, then I'm gonna think about jBPM :) (but i already took a look at the quickstarts) -
3. Re: how to develop web service from scratch?
kurtstam Oct 29, 2007 1:44 PM (in response to fabianw)Great :).
I'm not sure about deployment from within RHDS. Maybe someone else can comment on that, but to you can see your WSDL simply by going to http://localhost:8080/jbossws/ and clicking on the service you want to see.
--Kurt -
4. Re: how to develop web service from scratch?
fabianw Oct 29, 2007 1:48 PM (in response to fabianw)But my service only shows up on this page after I deployed it. So I still need to know how to deploy my service. Deployment from RHDS would be nice, but of course every other method is ok, too.
-
5. Re: how to develop web service from scratch?
kurtstam Oct 29, 2007 1:50 PM (in response to fabianw)Oh and I forgot to mention one thing. We integrated jBPM "bidirectional", so you can have the jBPM flow direct the ESB process flow (orchestration), or you can drop messages on a plain jBPM workflow (including human processing) and if you want the ESB can be used to send jBPM notifications.
--Kurt -
6. Re: how to develop web service from scratch?
fabianw Oct 29, 2007 1:51 PM (in response to fabianw)I'll come back to this topic after I got my services deployed :)
-
7. Re: how to develop web service from scratch?
fabianw Oct 30, 2007 8:18 AM (in response to fabianw)I still can't get it to work.
I tried two ways:
1) I copied the webservice_consumer1 directory and replaced war/src/ with my service-pojo and changed the web.xml.
If I try to run 'ant makewar -v' I get the following output:Apache Ant version 1.7.0 compiled on December 13 2006 Buildfile: build.xml Detected Java version: 1.5 in: c:\programme\java\jdk1.5.0_06\jre Detected OS: Windows XP parsing buildfile C:\jbossesb-server-4.2GA\samples\quickstarts\webservice_consumer4\build.xml with URI = file:/C:/jbossesb-server-4.2GA/samples/quickstarts/webservice_consumer4/build.xml Project base dir set to: C:\jbossesb-server-4.2GA\samples\quickstarts\webservice_consumer4 [antlib:org.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found. Importing file C:\jbossesb-server-4.2GA\samples\quickstarts\conf\base-build.xml from C:\jbossesb-server-4.2GA\samples\quickstarts\webservice_consumer4\build.xml parsing buildfile C:\jbossesb-server-4.2GA\samples\quickstarts\conf\base-build.xml with URI = file:/C:/jbossesb-server-4.2GA/samples/quickstarts/conf/base-build.xml Already defined in main or a previous import, ignore quickstart-specific-assemblies [property] Loading C:\jbossesb-server-4.2GA\samples\quickstarts\conf\quickstarts.properties [available] Unable to find C:\jbossesb-server-4.2GA\build-distr.xml [available] Found: C:\jbossesb-server-4.2GA\JBossORG-EULA.txt [available] Found: C:\jbossesb-server-4.2GA\server\default [available] Found: C:\jbossesb-server-4.2GA\JBossORG-EULA.txt [available] Found: C:\jbossesb-server-4.2GA\server\default [available] Found: lib Build sequence for target(s) `makewar' is [makewar] Complete build sequence is [makewar, assert-ejb3-available, check-jbossesb-dist, qslib-dependencies, non-qslib-dependencies, jbossesb-dependencies, jbossesb-server-dependencies, messaging-config, messaging-dependencies, jbossmq-dependencies, quickstart-specific-dependencies, dependencies, echoCP, check-exploded, base-build.quickstart-specific-clean, deploy-exploded-esb, base-build.deploy-esb, base-build.jbossesb-server-dependencies, quickstart-specific-clean, base-build.help, base-build.assert-ejb3-available, base-build.undeploy-messaging, display-instructions, base-build.quickstart-specific-undeploys, undeploy-war, deploy-messaging, base-build.help-quickstarts, base-build.echoCP, base-build.echoPaths, undeploy-messaging, quickstart-specific-undeploys, base-build.undeploy, base-build.compile, base-build.non-qslib-dependencies, base-build.jbossesb-dependencies, base-build.deploy-jms-dests, assert-ftp-config, package-deployment, assert-ws-available, base-build.dependencies, base-build.check-jbossesb-dist, help, compile, config, copy-metainf, quickstart-specific-assemblies, prepare-deployment, deploy-esb, quickstart-specific-deploys, deploy, base-build.deploy-exploded-esb, base-build.check-exploded, undeploy, undeploy-jms-dests, base-build.quickstart-specific-deploys, base-build.jbossmq-dependencies, base-build.quickstart-specific-assemblies, base-build.clean, base-build.qslib-dependencies, base-build.package-deployment, echoPaths, clean, base-build.assert-ws-available, help-quickstarts, base-build.assert-ftp-config, base-build.deploy, base-build.display-instructions, base-build.undeploy-jms-dests, deploy-jms-dests, base-build.run, runtest, base-build.quickstart-specific-dependencies, base-build.prepare-deployment, base-build.messaging-dependencies, run, base-build.config, deploy-war, base-build.deploy-messaging, base-build.copy-metainf, base-build.messaging-config, ] makewar: [mkdir] Skipping C:\jbossesb-server-4.2GA\samples\quickstarts\webservice_consumer4\build\war\classes because it already exists. [javac] rechnung\bearbeitung\RechnungCheck.java added as rechnung\bearbeitung\RechnungCheck.class doesn't exist. [javac] Compiling 1 source file to C:\jbossesb-server-4.2GA\samples\quickstarts\webservice_consumer4\build\war\classes [javac] Using modern compiler Warning: Reference compile-classpath has not been set at runtime, but was found during build file parsing, attempting to resolve. Future versions of Ant may support referencing ids defined in non-executed targets. Property "org.jboss.esb.server.home" has not been set Property "org.jboss.esb.server.home" has not been set Warning: Reference quickstart-dependencies-classpath has not been set at runtime , but was found during build file parsing, attempting to resolve. Future versions of Ant may support referencing ids defined in non-executed targets. Warning: Reference quickstart-lib-classpath has not been set at runtime, but was found during build file parsing, attempting to resolve. Future versions of Ant may support referencing ids defined in non-executed targets. Warning: Reference deployment-classpath has not been set at runtime, but was fou nd during build file parsing, attempting to resolve. Future versions of Ant may support referencing ids defined in non-executed targets. BUILD FAILED C:\jbossesb-server-4.2GA\samples\quickstarts\webservice_consumer4\build.xml:18: C:\jbossesb-server-4.2GA\samples\quickstarts\webservice_consumer4${org.jboss.esb.server.home}\client not found. at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:422) at org.apache.tools.ant.types.FileSet.iterator(FileSet.java:69) at org.apache.tools.ant.types.resources.Union.getCollection(Union.java:105) at org.apache.tools.ant.types.resources.Union.getCollection(Union.java:88) at org.apache.tools.ant.types.resources.BaseResourceCollectionContainer.cacheCollection(BaseResourceCollectionContainer.java:244) at org.apache.tools.ant.types.resources.BaseResourceCollectionContainer.iterator(BaseResourceCollectionContainer.java:120) at org.apache.tools.ant.types.Path.iterator(Path.java:687) at org.apache.tools.ant.types.Path.iterator(Path.java:684) at org.apache.tools.ant.types.resources.Union.getCollection(Union.java:105) at org.apache.tools.ant.types.resources.Union.getCollection(Union.java:88) at org.apache.tools.ant.types.resources.BaseResourceCollectionContainer.cacheCollection(BaseResourceCollectionContainer.java:244) at org.apache.tools.ant.types.resources.BaseResourceCollectionContainer.iterator(BaseResourceCollectionContainer.java:120) at org.apache.tools.ant.types.Path.iterator(Path.java:687) at org.apache.tools.ant.types.resources.Union.getCollection(Union.java:105) at org.apache.tools.ant.types.resources.Union.list(Union.java:67) at org.apache.tools.ant.types.Path.list(Path.java:356) at org.apache.tools.ant.types.Path.addExisting(Path.java:327) at org.apache.tools.ant.types.Path.addExisting(Path.java:315) at org.apache.tools.ant.types.Path.concatSpecialPath(Path.java:560) at org.apache.tools.ant.types.Path.concatSystemClasspath(Path.java:512) at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.getCompileClasspath(DefaultCompilerAdapter.java:152) at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.setupJ avacCommandlineSwitches(DefaultCompilerAdapter.java:182) at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.setupModernJavacCommandlineSwitches(DefaultCompilerAdapter.java:320) at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.setupModernJavacCommand(DefaultCompilerAdapter.java:367) at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:48) at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:997) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:820) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) at org.apache.tools.ant.Project.executeTarget(Project.java:1298) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1181) at org.apache.tools.ant.Main.runBuild(Main.java:698) at org.apache.tools.ant.Main.startAnt(Main.java:199) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Even if I simply rename the webservice_consumer1 directory I get these errors. I guess I have to change the name also in some xml file, but I can't find where this could be.
What's the problem here? Why does it try to access C:\jbossesb-server-4.2GA\samples\quickstarts\webservice_consumer4${org.jboss.esb.server.home}\client ?
${org.jboss.esb.server.home} is "C:\jbossesb-server-4.2GA"
2) I cannot even simply compile my annotated class or the HelloWorldWS.java
I simply tried: javac -classpath . org\jboss\soa\esb\samples\quickstart\webservice_consumer1\HelloWorldWS.java
but then it says: "package javax.jws does not exist" and can't compile of course...
I'm starting to get frustrated. Do you really have to be a Java-professional just to get a simple web service working? -
8. Re: how to develop web service from scratch?
fabianw Oct 30, 2007 10:15 AM (in response to fabianw)OK, after I included the jbossws-client.jar in the classpath I could compile my service-class. I created a war-file, but I can't deploy it. I've also run 'ant makewar' on the webservice_consumer1 quickstart and tried to deploy the resulting war-file to the esb-server.
I get the same error message for both WARs:15:14:53,078 ERROR [MainDeployer] Could not create deployment: file:/C:/jbossesb-server-4.2GA/server/default/deploy/test.war java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:406) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:270) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:103) at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:89) at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:100) at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder.createJAXBContext(JAXWSMetaDataBuilder.java:917) at org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder.buildWebServiceMetaData(JAXWSWebServiceMetaDataBuilder.java:142) at org.jboss.ws.metadata.builder.jaxws.JAXWSServerMetaDataBuilder.setupProviderOrWebService(JAXWSServerMetaDataBuilder.java:50) at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE.buildMetaData(JAXWSMetaDataBuilderJSE.java:69) at org.jboss.wsf.stack.jbws.UnifiedMetaDataDeployer.create(UnifiedMetaDataDeployer.java:67) at org.jboss.wsf.spi.deployment.BasicDeployerManager.deploy(BasicDeployerManager.java:69) at org.jboss.wsf.container.jboss42.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:97) at org.jboss.wsf.container.jboss42.DeployerInterceptor.create(DeployerInterceptor.java:79) at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180) at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210) at $Proxy34.create(Unknown Source) at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782) at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210) at $Proxy9.deploy(Unknown Source) at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421) at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
What am I doing wrong? -
9. Re: how to develop web service from scratch?
kurtstam Oct 30, 2007 10:17 AM (in response to fabianw)If you want to use the build scripts of the quickstarts, then you have to execute them in the in quickstarts directory. Can you get an an altered webservice_consumer1 quickstart to run?
--K -
10. Re: how to develop web service from scratch?
kconner Oct 30, 2007 11:01 AM (in response to fabianw)You should be able to run the scripts anywhere as long as you change the import in the build.xml file to point to the appropriate quickstarts conf location.
If this is not the case then we have an issue in the scripts. -
11. Re: how to develop web service from scratch?
fabianw Oct 30, 2007 11:38 AM (in response to fabianw)Well, I simply copied C:\jbossesb-server-4.2GA\samples\quickstarts\webservice_consumer1\ to C:\jbossesb-server-4.2GA\samples\quickstarts\webservice_consumer3\
and 'ant makewar' stopped working.
What do else do I have to be aware of?
I just tried to alter the webservice_consumer1 quickstart. I simply changed the output string of the HelloWorldWS. Seems to work fine, at least the makewar target. On 'ant runtest' I get this error now (worked in the past):16:12:42,156 ERROR [SOAPFaultHelperJAXWS] SOAP request exception java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage at javax.xml.soap.SOAPMessage.setProperty(Unknown Source) ..........
So what's this now?
But I also have some good news! After I emptied the tmp directory and restarted the ESB-server, I can deploy the war files. This is nice, but I'm not sure if that is enough to use these services in jBPM?
So what do I have to do, to use the build-scripts of the webservice_consumer1 quickstart?? -
12. Re: how to develop web service from scratch?
fabianw Oct 31, 2007 8:18 AM (in response to fabianw)OK, I think I'm making progress now.
two questions:
1) What is the difference between SOAPClient and SOAPProcessor?
2) In the webservice_consumer1 quickstart are two classes (MyRequestAction, MyResponseAction). The MyRequestAction extracts the necessary parameters from the message-object and puts them in a request-map and the MyResponeAction vice versa. Do I have to write such a wrapper for every single method I want to expose as a web service? SOAPProcessor doesn't seem to need this? -
13. Re: how to develop web service from scratch?
burrsutter Oct 31, 2007 6:04 PM (in response to fabianw)SOAPProcessor is specifically for exposing JBossWS endpoints through the ESB.
SOAPClient is more focused on pulling external WS endpoints (e.g. .NET, Ruby, BEA, etc) into the ESB.
SOAPClient won't give you a WSDL. SOAPProcessor will.
http://localhost:8080/contract (in 4.2.1) will show you the ESB services and link to the WSDLs associated with SOAPProcessor-based endpoints.
Burr -
14. Re: how to develop web service from scratch?
fabianw Nov 1, 2007 1:23 PM (in response to fabianw)With JBossWS endpoints you are talking about ESB-aware endpoints, right?
As I understood the docs the service which is used through SOAPProcessor has to be ESB-aware. But what I dont understand: why would you use a web service for this? Every ESB-aware POJO could do the same and without converting the Message to a SOAP-message and vice versa.
Am I missing something?
Now I've modified the webservice_consumer1 to my needs. But as soon as I deploy the package I get the following errors:12:07:00,718 ERROR [URLDeploymentScanner] Incomplete Deployment listing: --- MBeans waiting for other MBeans --- ObjectName: jboss.esb:deployment=Rechnungskontrolle.esb State: FAILED Reason: java.lang.RuntimeException: java.io.CharConversionException: Malformed UTF-8 character: 0xf6 0x67 0x6c 0x69 I Depend On: jboss.esb:deployment=soap.esb jboss.esb:service=SoapUIClientService jboss.esb.rechnung.destination:service=Queue,name=rechnung_bearbeiten_esb jboss.esb.rechnung.destination:service=Queue,name=rechnung_bearbeiten_esb_reply --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM --- ObjectName: jboss.esb:deployment=Rechnungskontrolle.esb State: FAILED Reason: java.lang.RuntimeException: java.io.CharConversionException: Malformed UTF-8 character: 0xf6 0x67 0x6c 0x69 I Depend On: jboss.esb:deployment=soap.esb jboss.esb:service=SoapUIClientService jboss.esb.rechnung.destination:service=Queue,name=rechnung_bearbeiten_esb jboss.esb.rechnung.destination:service=Queue,name=rechnung_bearbeiten_esb_reply
The web services run fine (invoked them through soapUI), but they doesn't seem to work over the ESB.
I also modified the SendESBMessage class to my needs. But when I invoke it through 'ant runtest' I get the following error from ant:runtest: [echo] Send ESB message that triggers webservice call [java] Exception in thread "main" org.jboss.soa.esb.listeners.message.Messa geDeliverException: Failed to deliver message to Service [RechnungBearbeiten:UeberweiseRechnung]. Check for errors. [java] at org.jboss.soa.esb.client.ServiceInvoker.post(ServiceInvoker.java:262) [java] at org.jboss.soa.esb.client.ServiceInvoker.deliverSync(ServiceInvoker.java:159) [java] at rechnung.kontrolle.test.TesteRechnung.sendMessage(TesteRechnung.java:44) [java] at rechnung.kontrolle.test.TesteRechnung.main(TesteRechnung.java :51) BUILD FAILED
and in the esb-server log file:2007-11-01 12:23:36,234 DEBUG [org.jboss.jms.server.remoting.ServerSocketWrapper] cannot write CLOSING byte java.net.SocketException: Connection reset by peer: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(Unknown Source) at java.net.SocketOutputStream.write(Unknown Source) at java.io.BufferedOutputStream.flushBuffer(Unknown Source) at java.io.BufferedOutputStream.flush(Unknown Source) at java.io.DataOutputStream.flush(Unknown Source) at org.jboss.jms.server.remoting.ServerSocketWrapper.close(ServerSocketWrapper.java:74) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:481) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
I've no idea what is causing this. Any help would be appreciated.