Announcement Announcement Module
No announcement yet.
Tutorial Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tutorial

    I've finally had the time to finish writing the tutorial for Spring-WS. It starts at (old stuff), an continues at (new stuff).

    Let me know what you think!

  • #2
    Thanks Arjen - it fills a gap. Martin.


    • #3
      Thanks Arjen. It saves some time. I would update this page so others can find it.


      • #4
        Thanks, updated the site.


        • #5

          Hi Arjan,

          I am new to use all this stuff. I am just moving forward by reading the spring-ws tutorial. I am using Jaxb2Marshaller for marshalling and unmarshalling. All that I want to do is just Marshalling and Unmarshalling. I don't want to go through webservice stuff and all. Please see below what I have done so far.

          1. Downloaded JWSDP2.0 pack, which contains Jaxb2.0 and am added the jars (jaxb1-impl.jar,jaxb-api.jar,jaxb-impl.jar,jaxb-xjc.jar and the jars coming with spring-ws-1.0.1 release) into class path.
          2. Ran Jaxb Schemangen.bat against java file ( bean) for generating XSD file.
          3. After XSD generated, then I ran xjc.bat (Jaxb compiler) against this XSD file.
          4. Then it has generated two files: and in generated folder.
          5. Configured Jaxb2Marshaller in applicationContext as specified below.

          <bean id="application" class="testing.Application">
          <property name="marshaller" ref="jaxb2Marshaller" />
          <property name="unmarshaller" ref="jaxb2Marshaller" />

          <bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">

          <property name="contextPath" value="generated">

          Here, "generated" folder contains the java files and generated xjc compiler.

          6. Then I ran into two exceptions one after the other
          i. java.lang.NoClassDefFoundError: javax.activation.DataSource - I have added Activation.jar into class path to resolve this problem.
          ii. java.lang.NoClassDefFoundError: - I have added jsr173_1.0_api.jar into class path to resolve this problem.

          7. Now I am getting the following exception when it calls marshall method.
          org.springframework.oxm.jaxb.JaxbSystemException: Settings nor any of its super class is known to this context; nested exception is
          javax.xml.bind.JAXBException: Settings nor any of its super class is known to this context

          As I am spending lot of time so far in resolving the above exception, I thought of letting you know about this. I would be very happy if you can provide any clues/suggestions for resolving this error. Also, point me if am doing anything wrong here.



          • #6
            If you're just interested in Marshalling, refer to the corresponding chapter in the reference docs:

            In general, you need to configure JAXB with a contextPath. This is not the folder to which you generated the classes, but rather the Java package which contains the ObjectFactory and other files. Or you can set the classesToBeBound property (to Settings in your case).


            • #7
              Marshalling and unMarshalling using Jaxb2Marshaller

              Thanks. Marshalling and unMarshalling using Jaxb2Marshaller works fine for me


              • #8
                This is a great tutorial.. thanks for the work.


                • #9
                  Tutorial Help

                  I have a problem in following the spring web service tutorial in the spring website (

                  I could not execute the command in maven2
                  > mvn archetype:create \
                  -DarchetypeArtifactId=spring-ws-archetype \
                  -DarchetypeVersion=1.0-rc1-SNAPSHOT \

                  It returns an error “plugin … does not exist”

                  C:\>mvn archetype:create -DarchetypeArtifactId=spring-ws-archetype -DarchetypeVersion=1.0-rc1-SNAPSHOT -DartifactId=holidayService
                  [INFO] Scanning for projects...
                  [INFO] Searching repository for plugin with prefix: 'archetype'.
                  [INFO] ------------------------------------------------------------------------
                  [ERROR] BUILD ERROR
                  [INFO] ------------------------------------------------------------------------
                  [INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found
                  [INFO] ------------------------------------------------------------------------
                  [INFO] For more information, run Maven with the -e switch
                  [INFO] ------------------------------------------------------------------------
                  [INFO] Total time: < 1 second
                  [INFO] Finished at: Mon Oct 22 18:46:43 SGT 2007

                  I already deployed the maven 2.0.7; extracting the to . .. \Program Files\Apache Software Foundation\maven-2.0.7 ( and updated my system variables.

                  I also downloaded maven-archetype-plugin-1.0-alpha-7.jar from the ( and copied it to my maven2\bin directory

                  I’m wondering if you could help me in using maven2 so that I could follow the tutorial.
                  or do you have a detailed walkthrough in how to install maven2? or another tutorial on how to start a spring web service project?



                  • #10
                    You might have a corrupted local repository. Remove ${HOME}/.m2/repository, and see it that works.


                    • #11
                      Tutorial Help

                      Thanks Arjen , i was able to finish the spring ws tutorial

                      Here are the steps i did for those who have the same problem.
                      (“plugin … does not exist” error, maven could not download the files from the repo)

                      1. removed the ${HOME}/.m2/repository
                      2. edited my maven2 settings.xml, i added my proxy settings (wer using web proxy at the office)
                      3. executed "maven install" with error:
                      [ERROR] BUILD ERROR
                      [INFO] Failed to resolve artifact.
                      1) javax.activation:activation:jar:1.0.2

                      4. downloaded activation jar version 1.0.2 and manually installed it
                      5. executed "maven install" again and the command created a new maven project

                      I have a new question though: HOW could i IMPORT the genereated project to ECLIPSE IDE?


                      • #12
                        Just run mvn eclipse:eclipse, that will create a project for you, which you can import into your workspace. See


                        • #13

                          Hi There,

                          After following

                          I managed to get http://localhost:8080/holidayService/holiday.wsdl generated. But inside the binding, soapAction=""
                          <?xml version="1.0" encoding="UTF-8" ?> 
                          - <wsdl:definitions xmlns:schema="" xmlns:soap="" xmlns:tns="" xmlns:wsdl="" targetNamespace="">
                          - <wsdl:types>
                          - <xs:schema xmlns:hr="" xmlns:xs="" elementFormDefault="qualified" targetNamespace="">
                          - <xs:element name="HolidayRequest">
                          - <xs:complexType>
                          - <xs:all>
                            <xs:element name="Holiday" type="hr:HolidayType" /> 
                            <xs:element name="Employee" type="hr:EmployeeType" /> 
                          - <xs:complexType name="HolidayType">
                          - <xs:sequence>
                            <xs:element name="StartDate" type="xs:date" /> 
                            <xs:element name="EndDate" type="xs:date" /> 
                          - <xs:complexType name="EmployeeType">
                          - <xs:sequence>
                            <xs:element name="Number" type="xs:integer" /> 
                            <xs:element name="FirstName" type="xs:string" /> 
                            <xs:element name="LastName" type="xs:string" /> 
                          - <wsdl:message name="HolidayRequest">
                            <wsdl:part element="schema:HolidayRequest" name="HolidayRequest" /> 
                          - <wsdl:portType name="HumanResource">
                          - <wsdl:operation name="Holiday">
                            <wsdl:input message="tns:HolidayRequest" name="HolidayRequest" /> 
                          - <wsdl:binding name="HumanResourceBinding" type="tns:HumanResource">
                            <soap:binding style="document" transport="" /> 
                          - <wsdl:operation name="Holiday">
                            <soap:operation soapAction="" /> - <wsdl:input name="HolidayRequest">
                            <soap:body use="literal" /> 
                          - <wsdl:service name="HumanResourceService">
                          - <wsdl:port binding="tns:HumanResourceBinding" name="HumanResourcePort">
                            <soap:address location="http://localhost:8080/holidayService/" /> 
                          Here is the hr.xsd
                          <xs:schema xmlns:xs=""
                              <xs:element name="HolidayRequest">
                                          <xs:element name="Holiday" type="hr:HolidayType"/>
                                          <xs:element name="Employee" type="hr:EmployeeType"/>
                              <xs:complexType name="HolidayType">
                                      <xs:element name="StartDate" type="xs:date"/>
                                      <xs:element name="EndDate" type="xs:date"/>
                              <xs:complexType name="EmployeeType">
                                      <xs:element name="Number" type="xs:integer"/>
                                      <xs:element name="FirstName" type="xs:string"/>
                                      <xs:element name="LastName" type="xs:string"/>
                          Here is the servlet xml
                          <?xml version="1.0" encoding="UTF-8"?>
                          <beans xmlns="" xmlns:xsi=""
                                  <bean id="hrService" class=""/>
                          	<bean id="holidayEndpoint" class="" init-method="init">
                          	    <constructor-arg ref="hrService"/>
                          	<bean class="">
                          	    <property name="mappings">
                          	    	    <prop key="{}HolidayRequest">holidayEndpoint</prop>
                          	    <property name="interceptors">
                          	        <bean class=""/>
                          	<bean id="holiday" class="">
                          	    <property name="builder">
                          	        <bean class="">
                          	            <property name="schema" value="/WEB-INF/hr.xsd"/>
                          	            <property name="portTypeName" value="HumanResource"/>
                          	            <property name="locationUri" value="http://localhost:8080/holidayService/"/>
                          	            <property name="targetNamespace" value=""/>
                          Any idea what could be missed?

                          Last edited by jstone; Nov 19th, 2007, 11:25 PM.


                          • #14
                            re soap=&quot;&quot;

                            hey jstone,

                            i have the same wsdl as you do and it is working just fine with me

                            <soap:operation soapAction=""/>
                            <wsdl:input name="HolidayRequest">
                            <soap:body use="literal"/>
                            have you tried testing it? log the name, age, date, etc and try using soapUI v1.7.6 as a sample client to consume your web service

                            or are you referring to the sample wsdl that is in the tutorial?, then yes it is different and i dont know y it still works.


                            • #15
                              Hey Opinioag,

                              Thanks for the heads-up. Yeah, I was expecting
                              <soap:operation soapAction=""/>
                              to show up as being described in Chapter 3

                              I tried soapUI and it works well with another sample code (echoservice) that I was playing around. But it seems to have type problem with "date" in holiday service. I fed in
                              <soapenv:Envelope xmlns:soapenv="" xmlns:sch="">
                              And I saw the error in soapUI reads like
                              <SOAP-ENV:Envelope xmlns:SOAP-ENV="">
                                       <faultstring xml:lang="en">Unparseable date: ""</faultstring>      </SOAP-ENV:Fault>
                              Any idea how to fix it?

                              Thanks in advance!