Skip to main content
Announcements
New: No-code data prep in Qlik Cloud Analytics™ TAKE A TOUR
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

camel-example-cxf-blueprint example service in ESB 5.0 RC2

Can anyone provide a zip of a working version of:
camel-example-cxf-blueprint
for talend-esb-se-5.0.0-RC2?
I'm really bad at getting a simple SOAP service to run inside the ESB as an OSGi bundle and this seems like the perfect example.
When I install it using Maven and then try to install it using Karaf, I get this error:
osgi:install -s mvn0683p000009MA5A.pngrg.apache.camel/camel-example-cxf-blueprint
org.osgi.framework.BundleException: The bundle "camel-example-cxf-blueprint_2.9.0.SNAPSHOT " could not be resolved. Reason: Missing Constraint: Import-Package: org.apache.camel; version="[2.9.0,3.0.0)"
I know 5.0 is going to eventually use camel 2.9.0 but for now it seems it is using 2.8.2.
When I package this and drop it in the deploy directory, I get this error:
WARN Could not find endpoint/port for {http://reportincident.example.camel.apache.org}ReportIncidentEndpointPort in wsdl. Using {http://reportincident.example.camel.apache.org}ReportIncidentService.
There does not seem to be a similar example in Talend ESB 4.2.1, which is currently our production ESB, so I tried out 5.0.
Karaf version 2.2.4
Karaf home /Users/rpoindex/apps/talend-esb-se-5.0.0-RC2/container
Karaf base /Users/rpoindex/apps/talend-esb-se-5.0.0-RC2/container
OSGi Framework org.eclipse.osgi - 3.6.2.R36x_v20110210
miles

Labels (2)
10 Replies
Anonymous
Not applicable
Author

You seem to use the camel-example-cxf-blueprint example from trunk and therefore you have as dependency camel-*-2.9.0- SNAPSHOT. Currently our 5.0 Talend Runtime includes camel 2.8.2 and will for the release. Camel 2.9.0 is simply not yet released. I would therefore suggest to take the camel-example-cxf-blueprint sample from the released 2.8.2 package and run this one. It works out of the box.
Cheers,
Zsolt
Anonymous
Not applicable
Author

Thank you zsolt,
so I grabbed the apache-camel-2.8.2 release and tried installing two examples:
camel-example-cxf-osgi and camel-example-cxf-blueprint
The services say they are active, but there is nothing listing to port 8181 it seems when I try to get the wsdl.
I also downloaded apache-servicemix-4.3.0 and installed the cxf-osgi example following their README and was able to see the wsdl running in ServiceMix.
The same bundle does not run in Talend ESB 5.0 due to missing dependencies that are probably missing for a good reason . . .
Apache ServiceMix :: Features :: Examples :: CXF OSGi (4.3.0)
karaf@trun> osgi:start 204
org.osgi.framework.BundleException: The bundle "cxf-osgi_4.3.0 " could not be resolved. Reason: Missing Constraint: Import-Package: org.apache.cxf.transport.http_osgi; version="0.0.0"
Any my question is, is there a way to manually remove the files that Maven creates in .m2/repository ? when I run mvn install?
I looked under org/apache/camel and cannot find where the camel-example-cxf-osgi bundle is installed?
miles
Anonymous
Not applicable
Author

OK, I'm going to try to get the camel-example-cxf-blueprint running on Talend-esb-se-5.0RC2
In the README.txt for this example, it says to:
For Karaf 2.2 : edit the file jre.properties to add the following packages to be exported
jre-1.6=, \
com.sun.org.apache.xerces.internal.dom, \
com.sun.org.apache.xerces.internal.jaxp, \
I tried to add these pkgs to ext/jre.properties, but when I did that Karaf would not start up. (I waited about two minutes of it to start up)
After commenting out the pkg. additions, Karaf would still not start.
So I unzipped a fresh new RC2 and now I can start up again.
I guess its NOT a good idea to use pkgs marked "internal" by Sun/Oracle but not sure if this is the reason the who example does not work for me?
miles
Anonymous
Not applicable
Author

Trying to get the camel-example-cxf-blueprint example working:
mvn install completes successfully.
But where did it install the files?
Cannot find them in .m2/repository
Tried this but it breaks Karaf (Will not start up)
For Karaf 2.2 : edit the file jre.properties to add the following packages to be exported
jre-1.6=, \
com.sun.org.apache.xerces.internal.dom, \
com.sun.org.apache.xerces.internal.jaxp, \

Add feature:
2) Add features required
features:addUrl mvn 0683p000009MA5A.pngrg.apache.camel.karaf/apache-camel/2.8.2/xml/features
features:install war
features:install cxf
features:install camel-jaxb
features:install camel-blueprint
features:install camel-cxf
DONE. Many of these features are already installed in 5.0

osgi:install -s mvn 0683p000009MA5A.pngrg.apache.camel/camel-example-cxf-blueprint/2.8.2
This completes and it says the bundle is "Active" and the blueprint is "Created"
In the logs there is this warning:
Creating Service {http://reportincident.example.camel.apache.org}ReportIncidentEndpointService from WSDL: META-INF/wsdl/report_incident.wsdl
2011-11-10 10:27:54,387 | WARN | rint Extender: 1 | AbstractWSDLBasedEndpointFactory | AbstractWSDLBasedEndpointFactory 141 | - - | Could not find endpoint/port for {http://reportincident.example.camel.apache.org}ReportIncidentEndpointPort in wsdl. Using {http://reportincident.example.camel.apache.org}ReportIncidentService.

Try the URL:
looking at: org.ops4j.pax.web.cfg
It seems the default HTTP port for 5.0 is 8040 (for non-conflict with older ESBs?) not 8181.
# Default port for the OSGI HTTP Service
#
org.osgi.service.http.port=8040
URL:
http://localhost:8040/cxf/camel-example-cxf-blueprint/webservices/incident?wsdl
Message from Jetty:
HTTP ERROR: 404
Problem accessing /cxf/camel-example-cxf-blueprint/webservices/incident. Reason: Not Found
I think this problem is related to the warning msg about the port not found? Does a "Warning" level msg signify that the whole service is not functioning? Shouldn't that be an "Error" level msg?
Any ideas what is wrong?
dkulp
Contributor
Contributor

Can you try:
http://localhost:8040/services/camel-example-cxf-blueprint/webservices/incident?wsdl

I think the org.apache.cxf.osgi.cfg file in the ESB sets the context to /services.

The warning is ignorable, but the sample should be fixed. It basically means that the @WebService annotation on the impl doesn't specify the portName attribute (or, if it does, it 's wrong) and thus it's trying to find a port in the WSDL but not finding it so it uses the only port there. The sample should have the annotation updated or add the endpointName/serviceName attributes to the blueprint xml file to specify them.
Anonymous
Not applicable
Author

Thanks Dan, I didn't catch that.
That URL is where the service is.
It throws this exception though:
/services/camel-example-cxf-blueprint/webservices/incident
java.lang.NullPointerException
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137)
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:126)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:70)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:517)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:937)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:116)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:871)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:72)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
at org.eclipse.jetty.server.Server.handle(Server.java:346)
at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:589)
at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1048)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:601)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:214)
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
at java.lang.Thread.run(Thread.java:680)
Anonymous
Not applicable
Author

In this example, the impl class is generated from the wsdl by CXF? I guess this is a WSDL-first example.
The service is defined like this in the wsdl:






I guess I could change the port name to: "ReportIncidentEndpointPort" and re-install. Or should I just add another port with the needed name and same address and binding?
The URL for the location attribute of soap:address is OK?
miles
Anonymous
Not applicable
Author

Restarting the ESB seems to have fixed things and I no longer see the exception posted above. The service is now working.
1. modified report_incident.wsdl to change the port name:






And this does silence the WARN msg in the logs. But the service works regardless of this fix.
Anyway, I now can see the wsdl when I go to the URL.
Anonymous
Not applicable
Author

I have a full CRUD service running now based on the example.
I have been using the WSDL to Java technique to build it.
So this is great but there is one roadblock I've hit.
I'm trying to add a 5th service which returns all of the accounts created.
The problem is this service needs to return an array.
Based on some examples I've seen, I've set up a new element like this:
<COMPLEXTYPE name="accounts">
<SEQUENCE>
<ELEMENT maxoccurs="unbounded" minoccurs="0" name="return" type="tns:account"></ELEMENT>
</SEQUENCE>
</COMPLEXTYPE>
<ELEMENT name="inputRetrieveSfAccounts">
<COMPLEXTYPE>
<ALL>
<ELEMENT name="amount" type="xs:int"></ELEMENT>
</ALL>
</COMPLEXTYPE>
</ELEMENT>
<ELEMENT name="outputRetrieveSfAccounts" type="tns:accounts"></ELEMENT>
But when I try to test the service, I get this error:
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1.1:java (default-cli) on project sf-account-soap: An exception occured while executing the Java class. null: InvocationTargetException: Marshalling Error: Instance of "com.cn.dsa.sfaccount.InputRetrieveSfAccounts" is substituting "java.lang.Object", but "com.cn.dsa.sfaccount.InputRetrieveSfAccounts" is bound to an anonymous type. ->
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1.1:java (default-cli) on project sf-account-soap: An exception occured while executing the Java class. null
If anyone has a fix for this let me know. I'll keep messing with it but I don't understand the error msg.
miles