del.icio.us Digg DZone Reddit StumbleUpon
Web Services with Spring 2.5 and Apache CXF 2.0 - Willie Wheeler
« Previous | 1 | 2 | 3 | 4 | Next »

Let's Write a Simple Web Service

Let's go basic but realistic and implement a "contact us" web service. The idea is that lots of different applications and/or web sites need to have a web-based form to allow end users to contact an admin team (business, tech support, development, whatever) responsible for monitoring such communications. We'll implement a web service so that multiple applications can share it easily. There will be two operations:

  • View the list of submitted messages: This allows the admin team to see what the end users are saying.
  • Post a message: This allows end users to ask a question, tell us how great we are, demand their money back, etc.

Create the object model

As we want to explore more than the barest "Hello, World" functionality, let's create a Message class that we can pass to the service and that we can get from the service. This will allow us to play a bit with Java/XML databindings.

Here's the Message class:

package contactus;

import org.apache.cxf.aegis.type.java5.IgnoreProperty;

public final class Message {
    private String firstName;
    private String lastName;
    private String email;
    private String text;
    
    public Message() {
    }
    
    public Message(String firstName, String lastName, String email, String text) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.email = email;
        this.text = text;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
    
    @IgnoreProperty
    public String getLastNameFirstName() {
        return lastName + ", " + firstName;
    }
    
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
}

In real life I might have a bunch of Hibernate annotations in there (I'm a fan of annotation-based configuration), and I would create a DAO. But as this is a tutorial, we'll keep it simple.

If you look carefully, however, you can see that I did in fact include an annotation. The @IgnoreProperty annotation is part of the Aegis databinding mechanism, which comes with CXF but is not the default. (JAXB is the default.) I ended up using Aegis instead of JAXB because JAXB was giving me trouble when I tried to return complex data types like Message from a web service. Maybe it works and maybe it doesn't—I don't know—but when I plugged Aegis in it worked immediately and now I intend to use Aegis. (More on JAXB/Aegis a little later.) Anyway, @IgnoreProperty tells Aegis that I don't want getLastNameFirstName() to show up in the auto-generated WSDL. It's just a read-only convenience method.

Create the service interface

Now we define a service interface.

package contactus;

import java.util.List;

import javax.jws.WebParam;
import javax.jws.WebService;

@WebService
public interface ContactUsService {
    
    List<Message> getMessages();
    
    void postMessage(@WebParam(name = "message") Message message);
}

The @WebService and @WebParam are JAX-WS annotations. The first indicates that the interface defines a web service interface (we'll use it to autogenerate a WSDL) and the second allows us to use an HTTP parameter called "message" to reference the operation's argument instead of having to call it "arg0", which is the default.

Create the service implementation

Here's our simple implementation of the ContactUsService interface.

package contactus;

import java.util.ArrayList;
import java.util.List;

import javax.jws.WebService;

@WebService(endpointInterface = "contactus.ContactUsService")
public final class ContactUsServiceImpl implements ContactUsService {

    @Override
    public List<Message> getMessages() {
        List<Message> messages = new ArrayList<Message>();
        messages.add(new Message(
                "Willie", "Wheeler", "willie.wheeler@xyz.com", "Great job"));
        messages.add(new Message(
                "Dardy", "Chen", "dardy.chen@xyz.com", "I want my money back"));
        return messages;
    }

    @Override
    public void postMessage(Message message) {
        System.out.println(message);
    }
}

Here the @WebService annotation is marking this class as a web service implementation, and also specifying that the WSDL should be generated using the ContactUsService interface.

With that, we have the Java backend for the web service. Let's move on to configuration.

Social bookmarks: del.icio.us Digg DZone Reddit StumbleUpon
« Previous | 1 | 2 | 3 | 4 | Next »

Comments (82)

Great tutorial -- Used NB 6.0.1 and deployed into Glassfish V2 aok

Thank you
By Roger on Mar 12, 2008 at 11:55 AM PDT
Tutorial is ok but quite shallow information. Besides, it does not run with cfx-2.0.4 and spring-2.5.2 (known issue in cxf, solved in 2.0.5 snapshots).

Thank you.
By Cristian Caprar on Mar 21, 2008 at 7:29 AM PDT
Thanks for the feedback guys, and @Cristian, thanks for the heads-up about Spring 2.5.2.
By Willie Wheeler on Mar 22, 2008 at 10:49 AM PDT
Awesome tutorial, had it working and debugging with Eclipse3.3, CXF2.0.5,Spring 2.5.2 with Tomcat5.5

Thank you
By Makarand on Apr 4, 2008 at 12:13 PM PDT
This is great stuff/Good article.
Thank You
By Rajesh Pollepalli on Apr 18, 2008 at 11:32 AM PDT
The attribute default-autowire="byName" caused this example to fail for me.
By Richard on Apr 23, 2008 at 1:13 AM PDT
Hi!

Note: I am a beginner for CXF and Spring.

What I would like to know how one should start the webservice?

If using just CXF, there is a class with main method (e. g. here: http://svn.apache.org/repos/asf/incubator/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/src/demo/hw/server/Server.java)

What is the case here?
What choices do I have?

thanks
By Gergely Kontra on Apr 24, 2008 at 8:21 AM PDT
Hi Willie,
this is my first web service application example in Java & I like the way you have put the tutorial in simple terms so that a beginner like me can understand it clearly as well.

I have a doubt though, can I pass parameters to postMessage method & if so how?
Please provide me the way to pass parameters in the URL.
Thanks
Cheers
prasannarupan
By Prasannarupan on Apr 24, 2008 at 8:21 AM PDT
Hi Willie,
I also noticed the use of @overide annotation.
What is the purpose of it?.Is it a typo?
I also got a warning from Eclipse & I couldnt access the getMessages method when @override annotation was used when I deployed the application on JBoss AS 4.2.2GA.
I removed the annoation & the application is working fine now.


Thanks
prasanna
By Prasannarupan on Apr 24, 2008 at 8:30 AM PDT
@Makarand and Rajesh: Thanks!

@Richard: Not sure why that is happening for you. If you provide more information I might be able to help. At any rate the autowiring part is optional. If you are having problems with that you can always manually wire the beans.

@Gergely: In my article, the web service is just part of a web application, so you would start it in your web container (e.g. Tomcat). As to the example you reference, that uses the JAX-WS Endpoint API to publish the web service. The idea is that it starts up a lightweight web server to host your web service. Here is a link for you:

http://weblogs.java.net/blog/jitu/archive/2006/01/web_service_end.html

@Prasannarupan: Glad you found the tutorial useful. As far as passing parameters to postMessage(), I'm not sure I'm following your meaning. We are in fact passing an argument to postMessage--namely, the Message object itself. The client doesn't know that ContactUsService is backed by a web service and in particular it doesn't know that HTTP parameters are involved at all (if that's what you're asking). Can you describe more generally what you are trying to do?

As far as @Override goes, it wasn't a typo, but you are right to remove it. @Override tells the compiler that the method is supposed to override a method in an interface or a base class. (So if the compiler doesn't find the overridden method, it complains. This helps avoid cases where you think you overrode a method but you really didn't, like if you implement hashcode() instead of hashCode(), etc.) In Java 5 you can't use @Override when the method in question is an interface method; it works only for methods defined in a base class. In Java 6 you can use @Override in either situation. I am using Java 6 in the article and I neglected to say anything about that. Thanks for highlighting this.
By Willie Wheeler on Apr 24, 2008 at 1:11 PM PDT
Hi Willie!

Thanks for the quick reply.

Ok, the article shows how to do a web server, but spring is still not involved...
Since it may take up just a few lines of code, is it possible to complete the tutorial to a fully working example, or I'm just the only one who needs this extra.
By Gergely Kontra on Apr 25, 2008 at 1:44 AM PDT
Hi Gergely. The tutorial's example should be a fully working example :-) though the downloads are in my other Spring/CXF article (the second in the series) at

http://wheelersoftware.com/articles/spring-cxf-consuming-web-services-4.html

One of the links under Resources is the web service (i.e. the example in this article) and the other is the client code. You'll need to grab the dependencies yourself but those are listed in the article itself. Let me know if you aren't able to get the example to run.
By Willie Wheeler on Apr 25, 2008 at 1:49 AM PDT
By the way, Gergely, I may be misunderstanding you when you say "spring is still not involved", but in my article, Spring is very much involved. We're using Spring to wire up the beans and (importantly) to abstract the service implementation, among other things. Then we're taking the resulting web app (well, web services in this case, but bundled in a WAR) and dropping that into Tomcat or whatever servlet container you like.

The nice thing about Spring + CXF here is that as far as your application is concerned, it's just working with service beans. It has no knowledge that the service beans are actually web service proxies. You can very easily replace web service remoting with some other remoting mechanism (e.g. RMI, Hessian, Burlap, HttpInvoker) and you don't have to change the app at all--just the Spring config.

The app doesn't even know that the service beans are making remote calls, so you can replace the web service proxies with the actual web service implementation bean and the app doesn't know. In fact I did exactly that when I wrote the code for the comment service on this very web site. Originally I was making web service calls to a CommentService I wrote, and then I decided that there was no point and simply replaced the web service calls with a local service bean. Worked perfectly. :-)
By Willie Wheeler on Apr 25, 2008 at 2:02 AM PDT
Hi!

Well, the problem for me is (maybe just for me...): who will know web.xml must be read and parsed, and where is this piece of information in the code?

ui: I said I'm a beginner in this area.

By the way, with using a Server.java, which is here:
[http://pastebin.com/m5204fe28]

The output of the program looks like this (exception at startup):
[http://pastebin.com/m6366ff96]
By Gergely Kontra on Apr 25, 2008 at 5:33 AM PDT
Hi Gergely. It looks like you are trying to use the approach at

http://cwiki.apache.org/CXF20DOC/a-simple-jax-ws-service.html

which does not involve Spring or even a WAR. (So there is no web.xml involved with that.) That approach is not directly related to my article.

You might take a look at

http://cwiki.apache.org/CXF20DOC/writing-a-service-with-spring.html

instead, which is one of the other CXF 2.0 howtos (and it happens the one on which my article is based).
By Willie Wheeler on Apr 25, 2008 at 10:59 AM PDT
Hi,

it seems very usefull tutorial but when i try to do what you did, i got following exception

14:16:30.292 INFO [main] org.apache.cxf.aegis.type.XMLTypeCreator.<clinit>(XMLTypeCreator.java:125) >46> Parser doesn't support setSchema. Not validating.
java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null"
at javax.xml.parsers.DocumentBuilderFactory.setSchema(DocumentBuilderFactory.java:489)

i could not get rid of this problem.
By alperen on May 6, 2008 at 4:46 AM PDT
When using Spring 2.4, Tomcat 6 and CXF 2.1 you need to add jaxen library to you classpath ortherwise AegisDatabinding bean won't be created.
By Alex Khvatov on May 9, 2008 at 12:36 PM PDT
Man you saved my life... at least my work life. I've been working with CXF for a month without getting any test running well but simple services which return basic data types. When I've read your post I've realized about the JAXB problem with complex types and then I've took all necessary beans and Aegis configurations from your tutorial and my little service has worked!
Thanks a lot. Greetings from Argentina

PS: sorry about my english, it's quite poor yet ;)
By Federico A. Ocampo on May 14, 2008 at 11:45 AM PDT
@Federico: Really happy to hear that the article helped you. And your English is fine. A lot better than my Spanish. :-D
By Willie Wheeler on May 15, 2008 at 12:08 AM PDT
Thanks for putting this tutorial together. Was very helpful.
By Scott on May 24, 2008 at 6:27 AM PDT
I was just reading through the article and the bottom of page 3 mentions a validation annoyance in Eclipse. I checked to see whether the CXF team had yet posted the core and jaxws schemas to the specified schema locations and the answer is yes. So the validation annoyance I mentioned should not be a problem anymore. (Maybe it will still come up if you aren't on the Internet but other than that...)
By Willie Wheeler on May 24, 2008 at 6:28 AM PDT
Willie, although CXF have posted those schemas to the sites, it still causes an issue if the machine that CXF + Spring 2.5 is behind a proxy with no access to the outside world. I do have a solution that I have used for Spring 2.5 in the past for other Schemas, and once I have tested that it works with this, I will post the answer here and on my blog.
By Willie on Jun 5, 2008 at 1:28 AM PDT
I am using netbeans 6.0.1 added the jar files in the libraray and also using glassfish V2 server , and got the following errors while running the application .

Deployment error:
The module has not been deployed.
See the server log for details.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:163)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor106.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)
By yelena on Jul 28, 2008 at 3:23 AM PDT
nice doc .. thanks ..
running into a problem after deploying app on tomcat.

Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'cxf:bus'

The declarations inside my spring-beans.xml are 100% correct.

Error occurs on both, the ctx suffix as well as the jaxw suffix.

Using spring 2.5.5 and cxf 2.1 (tried older versions as well).
Manually added jdom 1.0 to maven build.

Was wondering if anyone stepped into same problems before .. thanks
By tmaus on Jul 29, 2008 at 2:19 AM PDT
Hi Willie,
Can you provide a specific example of the following?:

[path to CXFServlet]/contactus/postMessage?message=... - postMessage operation
By Alex on Aug 4, 2008 at 8:50 AM PDT
@Alex: The specific examples are listed at the top of page 4. Basically you just need to include the URL up to and including the servlet name, so that would include your servlet context and the servlet name just like with any servlet.
By Willie Wheeler on Aug 4, 2008 at 7:48 PM PDT
I am unable to get it working :( Can you please help?

My war is named cxfwheeler.war

So I access: http://localhost:8080/cxfwheeler/contactus?wsdl

I get a HTTP 404 error, requested resource not found :( :(
By Kasturi on Sep 8, 2008 at 2:20 PM PDT
I now understand that my context wasn't being loaded due to Tomcat listenerStart error.

I get Tomcat listenerStart while deploying my webapp. Moreover, this deployment error is not predictable, in the sense that I do not get it every time I start Tomcat, may be 50-50 chances of getting the error or not.

INFO: Deploying web application archive insuranceApp.war
Sep 8, 2008 10:09:23 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Sep 8, 2008 10:09:23 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/insuranceApp] startup failed due to previous errors

I am using Tomcat 6.0.14 with Spring 2.5.

What can be the reason? I saw there were 2 other threads in the Spring forum related to the exact same error, but they were being answered by newbies alike trying to guess the reason and thus not much useful.

As a workaround, I am now using the ContextLoaderServlet and commented out ContextLoaderListener. But I would still like to know the reason why.

<!-- <listener>
<listener-class>
org.springframework.web.context.ContextLoaderListe ner
</listener-class>
</listener> -->

<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoade rServlet</servlet-class>
</servlet>
By Kasturi on Sep 8, 2008 at 3:19 PM PDT
I am now able to hit my context correctly, but I do not get any services listed.

Rather I get the following message at the url - http://localhost:8080/cxfwheeler/contactus?wsdl :
"No service was found."

I am sorry for bothering you so much.
By Kasturi on Sep 8, 2008 at 3:23 PM PDT
Hi Kasturi. No need to apologize; it's no bother at all. :-)

The "No service was found" message comes from the CXFServlet, so at least your request is finding its way to the servlet itself. But somehow the contactus service isn't being registered.

Can you take a look at your appContext.xml file and make sure your <jaxws:endpoint .../> definition matches the one on page 3 of my article? In particular you will need to make sure it says address="/contactus". (Check the case as well.)

That's just a guess, but again the request is hitting the servlet, so it's probably something in your appContext.xml. You might try just downloading the sample code if you haven't already done so.

Let me know if you remain stuck.
By Willie Wheeler on Sep 8, 2008 at 9:37 PM PDT
Great tutorial Willie - thanks much!

I also had the "No service was found." issue that Kasturi as well. It seemed to be fixed after I got rid of the implementorClass attribute in the jaxws endpoint, as just the implementor reference to the service bean was sufficient.

Thanks again!
By Craig on Sep 12, 2008 at 1:23 PM PDT
I am using CXF to test getMessages and it almost work expect for following namespace issue:

Here is getMessagesResponse SOAP message sent from Jboss to the CXF client:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:getMessagesResponse xmlns:ns1="http:// service.texas.mycompany.com /"><return><ns2:Message xmlns:ns2="http:// service.texas.mycompany.com "><ns2:email>willie.wheeler@xyz.com</ns2:email><ns2:firstName>Willie</ns2:firstName><ns2:lastName>Wheeler</ns2:lastName><ns2:text>Great job</ns2:text></ns2:Message><ns2:Message xmlns:ns2="http:// service.texas.mycompany.com "><ns2:email>dardy.chen@xyz.com</ns2:email><ns2:firstName>Dardy</ns2:firstName><ns2:lastName>Chen</ns2:lastName><ns2:text>I want my money back</ns2:text></ns2:Message></return></ns1:getMessagesResponse></soap:Body></soap:Envelope>

Here is and warning on client side:

Sep 16, 2008 6:08:10 PM org.apache.cxf.aegis.type.TypeUtil getReadType
WARNING: xsi:type absent, and no type available for {http://service.texas.mycompany.com}email
Sep 16, 2008 6:08:10 PM org.apache.cxf.aegis.type.TypeUtil getReadType
WARNING: xsi:type absent, and no type available for {http://service. texas. mycompany.com}firstName

It seems like problem is in the fact that it is :
xmlns:ns2="http:// service.texas.mycompany.com

My wsdl is available on the ip: http://localhost:8080/root/webservices/contactus?wsdl

How to fix this xmlns:ns2="http:// service.texas.mycompany.com properly?
By Amit on Sep 16, 2008 at 8:26 AM PDT
Great tutorial !!
I implemented it and its working.

Thanks for everything
By Vivek on Sep 22, 2008 at 9:14 PM PDT
I am getting this error message ... jars used are cxf-2.1.2.jar, jdom-1.1.jar (These two jar are of diferent version as listed)... All other jar are same as you mentioned... Did I miss something

13:32:58,024 INFO [STDOUT] 13:32:58,024 INFO [SettingsFactory] Named query checking : enabled
13:32:58,102 INFO [STDOUT] 13:32:58,102 INFO [SessionFactoryImpl] building session factory
13:32:58,446 INFO [STDOUT] 13:32:58,446 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
13:32:59,977 INFO [STDOUT] 13:32:59,977 INFO [DefaultListableBeanFactory] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2df: defining beans [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.transport.servlet.ServletTransportFactory,dataSource,mySessionFactory,myTransactionManager,contactUsServiceImpl,aegisBean,jaxws-and-aegis-service-factory,orderService,orderTarget,orderDAO,contactUsService]; root of factory hierarchy
13:33:00,008 INFO [STDOUT] 13:33:00,008 INFO [LocalSessionFactoryBean] Closing Hibernate SessionFactory
13:33:00,008 INFO [STDOUT] 13:33:00,008 INFO [SessionFactoryImpl] closing
13:33:00,008 INFO [STDOUT] 13:33:00,008 ERROR [ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactUsService': Cannot resolve reference to bean 'jaxws-and-aegis-service-factory' while setting bean property 'serviceFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jaxws-and-aegis-service-factory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'aegisBean' while setting bean property 'dataBinding'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'aegisBean' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.aegis.databinding.AegisDatabinding]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/jdom/Parent
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3854)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4359)
By yogesh on Sep 29, 2008 at 10:37 AM PDT
List of jars (I think this would be helpful to u)

ant-contrib.jar
antlr-2.7.6.jar
aopalliance.jar
aspectjrt.jar
aspectjtools.jar
c3p0-0.9.1-pre6.jar
commons-beanutils.jar
commons-collections.jar
commons-collections-3.1.jar
commons-digester.jar
commons-fileupload.jar
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
commons-lang.jar
commons-logging.jar
commons-validator.jar
cxf-2.1.2.jar
dom4j-1.6.1.jar
freemarker-2.3.12.jar
geronimo-activation_1.1_spec-1.0.2.jar
geronimo-annotation_1.0_spec-1.1.1.jar
geronimo-javamail_1.4_spec-1.3.jar
geronimo-servlet_2.5_spec-1.2.jar
geronimo-stax-api_1.0_spec-1.0.1.jar
geronimo-ws-metadata_2.0_spec-1.1.2.jar
hibernate3.jar
jakarta-oro.jar
javassist-3.4.GA.jar
jaxb-api-2.1.jar
jaxb-impl-2.1.7.jar
jaxws-api-2.0.jar
jboss-common-jdbc-wrapper.jar
jdbc2_0-stdext.jar
jdom-1.1.jar
jta-1.1.jar
jta-spec1_0_1.jar
junit.jar
log4j-1.2.9.jar
neethi-2.0.2.jar
ognl-2.6.11.jar
saaj-api-1.3.jar
saaj-impl-1.3.jar
slf4j-api-1.5.3.jar
slf4j-jcl-1.5.3.jar
slf4j-jdk14-1.5.3.jar
slf4j-log4j12-1.5.3.jar
slf4j-migrator-1.5.3.jar
slf4j-nop-1.5.3.jar
slf4j-simple-1.5.3.jar
spring-agent.jar
spring-aop.jar
spring-aspects.jar
spring-beans.jar
spring-context.jar
spring-context-support.jar
spring-core.jar
spring-hibernate3.jar
spring-jdbc.jar
spring-jms.jar
spring-orm.jar
spring-test.jar
spring-tomcat-weaver.jar
spring-tx.jar
spring-web.jar
spring-webmvc.jar
spring-webmvc-portlet.jar
spring-webmvc-struts.jar
struts.jar
struts2-core-2.1.2.jar
struts2-spring-plugin-2.0.6.jar
struts-legacy.jar
wsdl4j-1.6.2.jar
wstx-asl-3.2.4.jar
xml-resolver-1.2.jar
XmlSchema-1.4.2.jar
xwork-2.1.1.jar
By yogesh on Sep 29, 2008 at 10:55 AM PDT
Its a jar version problem

refering to http://www.apache.org/dist/geronimo/2.1.2/RELEASE_NOTES-2.1.2.txt

it doesnot support org/jdom/Parent know issue

I used cxf.2.0.8 jar and it worked
By yogesh on Sep 29, 2008 at 11:39 AM PDT
hello,

I found this article to be very helpful, many thanks.

I am using latest CXF 2.1.2 and Spring 2.5.4 and the WS works just fine.

The issue I have with running the JUnit, I get the following error:


Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactUsServiceClient' defined in class path resource [contactus/spring-test.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.Object org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create()] threw exception; nested exception is java.lang.VerifyError: (class: org/apache/cxf/aegis/type/basic/ObjectType, method: writeSchema signature: (Lorg/jdom/Element;)V) Incompatible argument to function
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:396)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:936)


Any ideas,

Sam
By Sam Smith on Oct 5, 2008 at 7:46 AM PDT
I have jaxen-1.1.jar in my classpath on Tomcat 6, but I am still getting the following:
Oct 11, 2008 12:45:36 PM org.apache.cxf.aegis.type.XMLTypeCreator <clinit>
INFO: Parser doesn't support setSchema. Not validating.
java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null"

What should I do ?
By len on Oct 11, 2008 at 3:22 PM PDT
@len: Yeah, alperen above said the same thing (May 6). I'm not sure what it is. If you're adventurous, you might try cracking open the XMLTypeCreator (line 125) and DocumentBuilderFactory (line 489) source.

It's hard to tell from the limited error message but my best guess would be that you either haven't specified a default namespace or else you haven't specified a schema location for that namespace. Can you post the namespace declarations you're using here? (Don't need the whole config file; just the namespace declarations at the top.)
By Willie Wheeler on Oct 11, 2008 at 3:38 PM PDT
Willie,

I used the code you have provided. I did not change anything in it, except the web application name under which I deployed the services.

The possible clue may be is it that I used CXF 2.1 ( instead of your example referring to 2.0.4) nad CXF web site states that there are significant changes regarding the use of Aeges 2.1 ( which is currently used by CXF 2.1).

But I would not like to go over source code.

May be you already know,what should be done in case of using CXF 2.1 and Aeges 2.1 ?

Thanks.
By len on Oct 13, 2008 at 5:43 AM PDT
Hi Len. I didn't already know, as I haven't used CXF 2.1 yet, but I wouldn't be surprised if that were the issue. Thanks for writing back and letting us know about this.
By Willie Wheeler on Oct 13, 2008 at 8:10 PM PDT
Awesome tutorial, had it working and debugging with Eclipse Ganymede, CXF 2.1.3, Spring 2.5.5 with Tomcat5.5

Attention:
CXF 2.1.3 with Java 6 requires jaxb-api-2.1.jar (you will need to download it since it doesn't come with CXF 2.1.3 distribuition)

Thank you
By Marcos de Sousa on Oct 24, 2008 at 7:18 AM PDT
First off, great tutorial. I almost have my web services setup. I am running into a mapping/binding snag.

The service methods that take as a parameter or return a java.util.Set are having an issue. I attempted to reconfigure to Aegis as this tutorial suggests. I still encountered the issue. Below is a partial stacktrace when configured to use Aegis. Any suggestions greatly appreciated!

<Oct 27, 2008 10:14:09 PM EDT> <Warning> <HTTP> <BEA-101162> <User defined liste
ner org.springframework.web.context.ContextLoaderListener failed: org.springfram
ework.beans.factory.BeanCreationException: Error creating bean with name 'Busine
ssUnitQueryService': Invocation of init method failed; nested exception is javax
.xml.ws.WebServiceException: org.apache.cxf.aegis.DatabindingException: Error in
itializing parameters for operation {http://my.gfs.com/200810/IBusinessUnitQuery
}findBusinessUnitsByCompany: Cannot create mapping for java.util.Set, unspecifi
ed component type for method findBusinessUnitsByCompany parameter -1.
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'BusinessUnitQueryService': Invocation of init method failed; nested exce
ption is javax.xml.ws.WebServiceException: org.apache.cxf.aegis.DatabindingExcep
tion: Error initializing parameters for operation {http://my.gfs.com/200810/IBus
inessUnitQuery}findBusinessUnitsByCompany: Cannot create mapping for java.util.
Set, unspecified component type for method findBusinessUnitsByCompany parameter
-1
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1170)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:427)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:249)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:155)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:246)
Truncated. see log file for complete stacktrace
javax.xml.ws.WebServiceException: org.apache.cxf.aegis.DatabindingException: Err
or initializing parameters for operation {http://my.gfs.com/200810/IBusinessUnit
Query}findBusinessUnitsByCompany: Cannot create mapping for java.util.Set, unsp
ecified component type for method findBusinessUnitsByCompany parameter -1
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:267)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:201)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:394)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
...

The service interface for IBusinessUnitQuery.findBusinessUnitsByCompany looks like this...

public Set findBusinessUnitsByCompany(Integer companyNumber);

I am using Spring 2.0.7 and have tried cxf 2.0.6 & 2.1.2.

Thanks
By Paul VanderWall on Oct 28, 2008 at 4:42 AM PDT
I resolved my previous post/question by adding generics to the interface and implementation class.

So, my interface now looks like this...

public Set<BusinessUnitDO> findBusinessUnitsByCompany(@WebParam(name="companyNumber") Integer companyNumber);
By Paul VanderWall on Oct 29, 2008 at 4:32 AM PDT
I've also had the same problem @len and @alperen reported

java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null"

and fixed it by making the application use Xerces-2.9.1's DocumentBuilderFactory implementation.
By Gerson Galang on Nov 6, 2008 at 7:51 PM PST
A pretty useful article for beginners!
By VAIBHAV on Nov 19, 2008 at 10:12 AM PST
Thank you !
By Benjamin on Dec 3, 2008 at 6:07 PM PST
I tried your example and it worked. Good job. I cam accross one issue when I attempted to validate the out going and incoming SOAP messages. I added the following piece to the appContext.xml file:

<jaxws:endpoint id="contactUsService" ......

<jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
................
</jaxws:endpoint>

and I put the following annotations on the Message class method getFirstName.

@org.apache.cxf.aegis.type.java5.XmlType.XmlElement(nillable=false,minOccurs="1")
public String getFirstName() {
.....
}

Now when I call the postMessage method on the ContactUsService endpoint and didn't pass the first name value in the Message, nothing happened. Its completely ignored.
Another thing if I remove the aegis binding from the appContext.xml file and changed the annotations to @javax.xml.bind.annotation.XmlElement(required=true) on the getFirstName field it validates the soap message correctly and sent back the following SoapFault message:

javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'ns2:email'. One of '{email, firstName, lastName, text}' is expected.

Any idea how can I do the soap message validation using Aegis? Or is there any other way I can do this validation using aegis?
I would really appreciate any help in this regards.
By arslan on Dec 4, 2008 at 7:11 AM PST
To correct my last comment, when I removed the aegis binding from the appContext.xml file it still didnt validate the Soap Messages correctly, I am keep on getting the following soap fault message:
javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'ns2:email'. One of '{email, firstName, lastName, text}' is expected.
Any help?
By arslan on Dec 4, 2008 at 7:30 AM PST
Hi Willie,
The class and interface on a different package to generate wsdl incomplete data
By fanjinchang on Dec 15, 2008 at 8:45 PM PST
@fanjinchang: eh?
By Willie Wheeler on Dec 15, 2008 at 8:51 PM PST
The class and interfaces written in a different package to generate wsdl, only "Wsdl: binding", not (wsdl: message, wsdl: types, wsdl: portType),is not my configuration problems?
By fanjinchang on Dec 15, 2008 at 9:12 PM PST
Hi Willie,
The class and interfaces written in a different package to generate wsdl, only "Wsdl: binding", not (wsdl: message, wsdl: types, wsdl: portType),is not my configuration problems?
E-mail to tell me I made the case to your mailbox, please help me to see?
Thankyou!
By fanjinchang on Dec 15, 2008 at 9:56 PM PST
Hi Willie,
I tried your example and it worked. Good job.
After that I attempted to validate the SOAP Message. In order to do this I changed Message class and added the following aegis annotation on the getFirstName() method.

@org.apache.cxf.aegis.type.java5.XmlType.XmlElement(nillable=false,minOccurs="1")
public String getFirstName() {
.....
}

Also I added the following piece to the appContext.xml file:

<jaxws:endpoint id="contactUsService" ......

<jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
................
</jaxws:endpoint>


Now when I call the postMessage method on the ContactUsService endpoint and didn't pass the first name value in the Message, nothing happened. Its completely ignored.

Another thing if I remove the aegis binding from the appContext.xml file and removed the aegis annotation from the getFirstName() method and replaced the annotations to @javax.xml.bind.annotation.XmlElement(required=true) on the getFirstName field it validates the soap message correctly and sent back the following SoapFault message:

javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'ns2:email'. One of '{email, firstName, lastName, text}' is expected.

Any idea how can I do the soap message validation using Aegis? Or is there any other way I can do this validation using aegis?
I would appreciate if anyone can tell me the way to validate SOAP message using aegis.
Regads,
arslan ali
By arslan on Dec 22, 2008 at 12:47 PM PST

Hi,

Great article! Hoping you can answer a question for me. Someone in our group is trying to deploy a client web service within JBoss 4.2.3. They are getting a NoSuchMethodException somewhere in the JAXB Data binding jar/implementation. This sounds like a classloader issue to me and I pointed them in that direction but I am wondering if you encountered anything like this and how you would approach it?

Thanks!

By Mike Miller on Jan 13, 2009 at 9:23 PM PST

@Mike: Haven't run into it, but to me it sounds like a JAR incompatibility issue, or else using an old JRE possibly. Can you post the stacktrace along with the JAR versions and JRE version?

By Willie Wheeler on Jan 13, 2009 at 9:26 PM PST

Hi , I want to replace the axis web services with CFX . Currently my application which using Axis and spring frame work is deployed in tomcat 6.0 .

Can some body please tell me what are the configurations files i need to modify/create? . also to migrate from axis to CFX is there any regression issue ? I dont want to change any java code . Please suggest and let me know what are changes i need to do .?

Thanks in Advance . Best Regards, amitava

By Amitava on Jan 14, 2009 at 7:44 AM PST

Hi Willie,

Thanks for the wonderful example. Im new to this CFX+Spring Webservice and so please forgive my ignorance. I was trying to deploy your example and Im getting the below error which Im not able to resolve it.

ERROR [STDERR] Feb 6, 2009 11:19:42 AM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass INFO: Creating Service {http://contactus/}ContactUsServiceService from class contactus.ContactUsService 2009-02-06 11:19:43,706 ERROR [STDERR] Feb 6, 2009 11:19:43 AM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass INFO: {http://contactus/}return part element name {http://contactus/}return references element {http://contactus/}return {http://contactus/}message part element name {http://contactus/}message references element {http://contactus/}message

Please help in solving this.

By Aruna on Feb 5, 2009 at 10:40 PM PST

Im trying to deploy the service in jboss 4.3.0.. Please suggest me the method of deploying the service in jboss.

By Aruna on Feb 6, 2009 at 2:02 AM PST

Hi Willie Tried your example and it works fine thanks. But I need to use restful webservices instead of SOAP. Somebody tell me what are the changes that needs to be done for restful..

Thanks in advance.

By Catherine on Feb 9, 2009 at 12:50 AM PST

with respect to the question on postMessage; would you give a specific example to of what to put on the command line to pass in a Message? how to pass an instance of Message in detail.

By hanasaki on Mar 10, 2009 at 10:30 PM PDT

Hi Willie I write a service following ur example and it ran successfully, then I tried to write a client to access this service, for this when I inspect the wsdl it has missing portType element and hence the XXXXport class is not generating, I am using clientgen of weblogic 9.

By Sachin on Apr 30, 2009 at 2:40 AM PDT

Hi Willie, When I am deploying an application as the same like the one in the tutorial but returning a simple java object which is binded using default JAXB I am getting a response with a return tag in it. How to avoid or remove the return tag in the response.

By Saravanan on Aug 27, 2009 at 2:00 AM PDT

I am trying to create a simple application using RAD 7.5 (WAS 6.1 test server, Servlet 2.4) with CXF 2.2.3 and Spring 2.5.

I have placed all the jar files that come from CXF 2.2.3 download in the web-inf/lib directory.

I am using your example as is for learning purposes.

When I start the WebSphere test server 6.1 (that comes bundled with RAD 7.5), the server starts, but shows the following errors:

 [9/18/09 10:58:07:668 EDT] 00000030 WorkSpaceMast E   WKSP0012E: Exception while extracting cells/TSD-108078Node01Cell/applications/IBMUTC.ear/deployments/IBMUTC/deployment.xml from ConfigRepository--com.ibm.websphere.management.exception.DocumentNotFoundException: cells/TSD-108078Node01Cell/applications/IBMUTC.ear/deployments/IBMUTC/deployment.xml
    at com.ibm.ws.management.repository.FileRepository.extractInternal 
 [9/18/09 10:59:24:335 EDT] 00000025 ContextLoader E org.springframework.web.context.ContextLoader initWebApplicationContext Context initialization failed
                                 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactUsService': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: Service endpoint interface does not have a @WebService annotation.
Caused by: javax.xml.ws.WebServiceException: Service endpoint interface does not have a @WebService annotation.
    at org.apache.cxf.jaxws.support.JaxWsImplementorInfo.initialise(JaxWsImplementorInfo.java:284)
    at org.apache.cxf.jaxws.support.JaxWsImplementorInfo.
(JaxWsImplementorInfo.java:57)
    at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:251)
    at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:230) 

My web.xml looks like:

   
 MyCxfWebService
 and the rest is code from this web site 

appContext.xml is the same as yours. Java class files are also the same as yours with the same package structure. I only commented out @override annotation.

The 2.2.3 download of CXF does not have jaxws-api-2.0.jar in it. I added it with not result.

I also get the following error as:

 Publishing failed
  Deploying AocExampleWebService
    Deployment from com.ibm.ast.ws.jaxws.deployer.JAXWSDeployer had errors:  

      Tools for WebSphere V6.1 must be installed in order to generate WebSphere V6.1 compliant code. 

Any suggestion will be appreciated.

By Sam on Sep 18, 2009 at 8:37 AM PDT

Hi I tried to model my web service along this tutorial. I can't acess the ws

When I try to hit the url http://localhost:8080/security/ws/calculatorWsService I get the following message.

WARNING: Can't find the request for http://localhost:8080/security/ws/calculatorWsService's Observer

Tomcat startup logs show no errors

INFO: Initializing Spring FrameworkServlet 'calculator-http' Sep 23, 2009 6:46:24 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
INFO: Creating Service {http://remoting.spring.ajtetris.com/}SimpleCalculatorService from class com.ajtetris.spring.remoting.SimpleCalculator Sep 23, 2009 6:46:24 PM org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be /ws/calculatorWsService
.
.
INFO: Starting Coyote HTTP/1.1 on http-8080 Sep 23, 2009 6:47:34 PM org.apache.cxf.transport.servlet.CXFServlet updateContext
INFO: Load the bus with application context
Sep 23, 2009 6:47:34 PM org.apache.cxf.bus.spring.BusApplicationContext getConfigResources
INFO: No cxf.xml configuration file detected, relying on defaults. Sep 23, 2009 6:47:35 PM org.apache.cxf.transport.servlet.AbstractCXFServlet replaceDestinationFactory
INFO: Replaced the http destination factory with servlet transport factory
.
.

Hitting the CXF url http://localhost:8080/security/ws/ says 'No services have been found.'

There were some discussions about this problem in the earlier comments but i didn't find any solution. Can you please help me debug this issue?

FYI I am using spring-3.0.0.M3 jars.

By Jugash on Sep 23, 2009 at 6:29 AM PDT

Found out the problem. I was initially using DispatcherServlet in my web.xml and when I replaced it with the CXF servlet I didn't add the myApp-servlet.xml file to the contextConfigLocation(DispatcherServlet loads it automatically). My bad

By jugash on Sep 23, 2009 at 8:50 AM PDT

RE: validation annoyance in Eclipse

This is a strange error. I get this error on Eclipse Gallileo using the Spring beans validator and found that it can be eliminated by turning the validation off, hitting OK and then turning it back on. This appears to work fine but is still unsettling. - Trip

By Terry Trippany on Oct 8, 2009 at 12:26 PM PDT

Good simple tutorial, I followed it to build something similar.

However I'm getting an error when my WS tries to return its response object.

The object contains a Set (using a TreeSet implementation) of HistorySummary (a custom POJO class) objects.

When the service implementation class tries to add HistorySummary instances to the Set (which will then be inserted into the response object). I get the following error:

org.apache.cxf.interceptor.Fault: Couldn't instantiate class. com.artifact software.portal.history.messages.retrieve.HistorySummary. Nested exception is java.lang.InstantiationException: com.artifactsoftware.portal.history.messages.retrieve.HistorySummary (I'll spare you the full stacktrace).

Oddly enough, if I instantiate the HistorySummary object but never add it to the TreeSet the error doesn't occur, although then of course, I have an empty Set.

Any ideas what might be causing this?

By David Dyer on Nov 7, 2009 at 8:44 AM PST

great article, thanks...

By Zaim AKINÖZ on Dec 5, 2009 at 1:37 AM PST

Hi, I tired the sample project given here. It's not working completely. I could access the webservice through the url http://localhost:9083/CXF/contactus/getMessages and get the soap response back. When i tiy accessign the wsdl file. i get the following exception on server console. ( I am using websphere 6.1, CXF 2.2.5 and spring 2.5)

[12/5/09 16:38:36:371 IST] 00000022 ServletWrappe E SRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: CXFServlet. Exception thrown : java.lang.IncompatibleClassChangeError at org.apache.cxf.wsdl11.ServiceWSDLBuilder.addExtensibilityElements(ServiceWSDLBuilder.java:229) at org.apache.cxf.wsdl11.ServiceWSDLBuilder.buildBindingInput(ServiceWSDLBuilder.java:355) at org.apache.cxf.wsdl11.ServiceWSDLBuilder.buildBindingOperation(ServiceWSDLBuilder.java:324) at org.apache.cxf.wsdl11.ServiceWSDLBuilder.buildBinding(ServiceWSDLBuilder.java:305) at org.apache.cxf.wsdl11.ServiceWSDLBuilder.build(ServiceWSDLBuilder.java:193) at org.apache.cxf.wsdl11.ServiceWSDLBuilder.build(ServiceWSDLBuilder.java:148) at org.apache.cxf.transport.http.WSDLQueryHandler.writeResponse(WSDLQueryHandler.java:146) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:156) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108) at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478) at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811) at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213) at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)

Please help me in this regard.

P.S : I tried the 2 fixes for Websphere given in CXF site. Still no use. I get the same excpetion.

Thanks and Regards, --Vivek--

By Vivek Pandian on Dec 5, 2009 at 3:12 AM PST

Nice post,

This is a great tutorial,

It was very easy to follow and the results are pretty outstanding...

Keep up the good work

By Software companies UK on Jan 4, 2010 at 6:33 AM PST

Hi Willie,

Thanks for your wonderful tutorial. It is written in great manner.

I have a problem while running the webservice. The jars which I am using are as follows

  1. commons-logging-1.1.jar
  2. geronimo-activation 1.1spec-1.0-M1.jar
  3. geronimo-annotation 1.0spec-1.1.jar (JSR 250)
  4. geronimo-javamail 1.4spec-1.0-M1.jar
  5. geronimo-servlet 2.5spec-1.1-M1.jar
  6. geronimo-stax-api 1.0spec-1.0.jar
  7. geronimo-ws-metadata 2.0spec-1.1.1.jar (JSR 181)
  8. jaxb-api-2.0.jar
  9. jaxb-impl-2.0.5.jar
  10. jaxws-api-2.0.jar
  11. neethi-2.0.2.jar
  12. saaj-api-1.3.jar
  13. saaj-impl-1.3.jar wsdl4j-1.6.1.jar
  14. wstx-asl-3.2.1.jar
  15. XmlSchema-1.3.2.jar
  16. xml-resolver-1.2.jar

Spring jars are as follows

1) spring-aop-2.5.6.jar 2) spring-beans-2.5.6.jar 3) spring-context-2.5.6.jar 4) spring-core-2.5.6.jar 5) spring-jdbc-2.5.6.jar 6) spring-jms-2.5.6.jar 7) spring-orm-2.5.6.jar 8) spring-tx-2.5.6.jar 9) spring-web-2.5.6.jar 10)spring-webmvc-2.5.6.jar

I am getting following error while I am accessing the WSDL file through URL

java.lang.IncompatibleClassChangeError: Expected static method org.apache.ws.commons.schema.XmlSchemaSerializer.serializeSchema(Lorg/apache/ws/commons/schema/XmlSchema;Z)[Lorg/w3c/dom/Document; at org.apache.cxf.wsdl11.ServiceWSDLBuilder.buildTypes(ServiceWSDLBuilder.java:197) at org.apache.cxf.wsdl11.ServiceWSDLBuilder.build(ServiceWSDLBuilder.java:135) at org.apache.cxf.wsdl11.ServiceWSDLBuilder.build(ServiceWSDLBuilder.java:105) at org.apache.cxf.transport.http.WSDLQueryHandler.writeResponse(WSDLQueryHandler.java:128) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:127) at org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:261) at org.apache.cxf.transport.servlet.CXFServlet.doGet(CXFServlet.java:243) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) 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.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) at java.lang.Thread.run(Thread.java:619)

Please help me to resolve this error.

Thanks, Vasav

By Vasav Shah on Feb 11, 2010 at 12:47 AM PST

I don't guess that each single student in the world has a passion of critical essay creating! However, people ,which don't have writing skillfulness have to take an assistance of great media essay service and be happy with a success.

By EVIEIA on Feb 18, 2010 at 3:20 PM PST

Even thesis writing service can not perform more nice dissertation international just about this post or maybe, you work especially for buy dissertation service. In that case I will buy a dissertation from your corporation instantly.

By CLARISSACastro25 on Feb 27, 2010 at 1:16 PM PST

It's not so simply to bring a excellent essay paper, essentially if you are booked. I advise you to define buy essays and to be void from scruple that your work will be done by essay writing services

By KathleenFerrell18 on Feb 27, 2010 at 2:24 PM PST

I will give old college try to create an theme on how fantastic school is and perhaps some resources were scholars can pursue their dreams and get great essays online.

By Olga33Logan on Mar 3, 2010 at 4:10 PM PST

The business loans are important for people, which are willing to start their company. As a fact, that's easy to get a student loan.

By Sheila34Melendez on Mar 3, 2010 at 7:47 PM PST

University life is really various and always don?t have time to work or relax! Thus, we can assist you with your custom papers. If you want to be happy, be. Best of luck!

By ColonTracey27 on Mar 5, 2010 at 2:31 AM PST

If you want some rules on how you can speed up the getting process with regards to research paper help then you shouldn't miss comprehending this article.

By KarenFISCHER32 on Mar 5, 2010 at 4:21 AM PST

Have difficulties with your critical essay completing assignment? Do not worry, explore and detect professional essay service to ease your writing issues and feel happy.

By Christa26Graham on Mar 9, 2010 at 8:40 AM PST

All is very well in your research activity if some guys detect the good custom essay writing firm to purchase essay at. Thence it is achievable to get term papers.

By PaulDina23 on Mar 9, 2010 at 8:41 AM PST

Properly accomplished customized essay can bring students an opportunity to reach a success. Nonetheless, custom term papers performing can use your free time. So that could be workable to buy papers to prevent this.

By HeatherMccoy on Mar 9, 2010 at 9:26 AM PST

Post a comment

Your name:
Your e-mail address (won't be displayed):
Your web site (optional):
example: www.xyz.com
Your comment:
Preview:
By You
Please help us reduce comment spam:
Spring Annotations RefCard
Check out the new DZone Spring Annotations Refcard by Craig Walls!

What's New?

2009-08-30 - Check out my two-part series on DZone: Spring Integration: A Hands-On Tutorial.
2009-03-25 - My new article Getting Started with Spring Batch 2.0 is available on DZone.
Home | Consulting | Tech Articles | Mailing List | Contact | Spring Blog
Copyright © 2008 Wheeler Software, LLC.