wsdl-first web service: not invokable and malformed wsdl

One Star

wsdl-first web service: not invokable and malformed wsdl

Hello,
I am trying to deploy an OSGi-fied version of the CXF wsdl-first CustomerService example into TSF. I Build both, client and server, from wsdl, implemented some testing logic in the stubs and added the following Manifest and beans.xml to the server bundle:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.1
Created-By: 1.6.0_20-b02 (Sun Microsystems Inc.)
Main-Class: com.example.customerservice.CustomerService_CustomerServic
ePort_Server
Bundle-ManifestVersion: 2
Bundle-Name: CustomerServiceServer
Bundle-SymbolicName: CustomerServiceServer
Bundle-Version: 0.9.9.alpha
Require-Bundle: org.apache.cxf.bundle,org.springframework.bean

 



xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">






implementor="com.example.customerservice.CustomerServiceImpl"
address="/CustomerServicePort"/>


At first sight, the server bundle is deployable in karaf without any problems. But the wsdl accessible through the browser does not list any operators or something:




?



?

?

 




Trying to invoke some methods with the generated client ends up with some exceptions:

WARNUNG: Interceptor for {http://customerservice.example.com/}CustomerServiceService#{http://customerservice.example.com/}updateCustomer has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:487)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
at $Proxy41.updateCustomer(Unknown Source)
at com.example.customerservice.CustomerService_CustomerServicePort_Client.main(CustomerService_CustomerServicePort_Client.java:58)
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8080/services/CustomerServicePort
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1496)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1490)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1144)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2206)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2134)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1988)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:639)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
... 8 more
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8080/services/CustomerServicePort
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2165)
... 13 more
Exception in thread "main" javax.xml.ws.WebServiceException: Could not send Message.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
at $Proxy41.updateCustomer(Unknown Source)
at com.example.customerservice.CustomerService_CustomerServicePort_Client.main(CustomerService_CustomerServicePort_Client.java:58)
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8080/services/CustomerServicePort
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1496)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1490)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1144)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2206)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2134)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1988)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:639)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:487)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
... 2 more
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8080/services/CustomerServicePort
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2165)
... 13 more


And on Server side:

org.apache.cxf.interceptor.Fault: Message part {http://customerservice.example.com/}updateCustomer was not recognized.  (Does it exist in service WSDL?)
at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:194)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
at org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
at org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:336)
at org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:157)
at org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
at org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:68)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)


I can run the same bundle (just changed the required bundles in the manifest to package imports) an invoke methods in a plain equinox with various bundles (see http://cxf.547215.n5.nabble.com/Web-Service-in-OSGi-with-spring-dm-td3306001.html).
I also tried to force using the wsdl, coming up with this:


address="/CustomerServicePort"
xmlns:customer="http://customerservice.example.com/"
serviceName="customer:CustomerServiceService"
endpointName="customer:CustomerServicePort"
wsdlLocation="CustomerService.wsdl"
transportId="http://schemas.xmlsoap.org/wsdl/http/"
implementor="com.example.customerservice.CustomerServiceImpl"
implementorClass="com.example.customerservice.CustomerServiceImpl"
/>


With this, the correct wsdl is shown in the browser. But the exceptions mentioned above are still thrown.
Any ideas or hints what I am doing wrong?
Thank you in advance,
Markus

Employee

Re: wsdl-first web service: not invokable and malformed wsdl

I'm really not sure what would cause that.
I just converted the service part of the wsdl_first sample into an OSGi bundle and stuck the result at:
http://dankulp.com/talend/wsdl_first_osgi.tar.gz
If I install/start that bundle and then use "mvn -Pclient" in the normal wsdl_first directory to run the standard client, it seems to work fine. Can you take a look at that and maybe provide a clue as to what may be different between what I did and what you did?
Thanks!
Dan
One Star

Re: wsdl-first web service: not invokable and malformed wsdl

Dear Dan,
thanks for your help.
I needed to specify some packages to import, at least:
Import-Package: javax.annotation,javax.jws,javax.xml.bind,javax.xml.bind.ann
otation,javax.xml.bind.annotation.adapters,javax.xml.namespace,javax.
xml.ws,org.apache.cxf.endpoint,org.apache.cxf.interceptor,org.apache.
cxf.jaxws,org.apache.cxf.tools.common,org.springframework.context.sup
port;version="3.0"

I only looked at the pom.xml (not the generated manifest.mf) of the jaxws-jms-spec example and got the impression, that it was sufficient to declare org.apache.cxf.bundle and org.springframework.bean as requiered bundles. Since I wrote my manifest per hand, the needed imports were not added by some tool like the maven-bundle-plugin.
Best Regards,
Markus
Employee

Re: wsdl-first web service: not invokable and malformed wsdl

Thanks for the follow up. As a maven user, I keep forgetting people actually try and maintain MANIFEST entries by hand. :-)
Dan

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

An API-First Approach to Modernizing Applications

Learn how to use an API-First Approach to Modernize your Applications

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read