Announcement Announcement Module
Collapse
No announcement yet.
Problems With Spring WS 1.5 Samples Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems With Spring WS 1.5 Samples

    I've been trying to get all six of the samples that ship with Spring 1.5 web services work.

    I'm running Sun's JDK 1.6.0_04, Tomcat 5.5.26, Spring 2.5.2, Spring WS 1.5, and IntelliJ 7.0.3 on Windows XP SP2.

    The three that don't require Maven appear to be fine - tutorial, echo, and pox. (Just need to write a tutorial client to be sure.)

    The three that do require Maven - airline, stockquote, and mtom - have issues.

    For example, when I run Maven for stockquote I get a stack trace with the following root cause:

    Code:
    Caused by: java.lang.NoClassDefFoundError: javax/xml/soap/SOAPException
    I know this class is in the saaj.jar, but I don't know how to modify the pom.xml to include this dependency. Can anyone tell me? Thanks.

    %

  • #2
    Added this to the pom.xml:

    Code:
    <dependency> 
    <groupId>javax.xml.soap</groupId> 
    <artifactId>saaj-api</artifactId> 
    <version>1.3</version>
    </dependency>
    Still no joy.

    %

    Comment


    • #3
      Where does the Stock class come from in the stockquote example? It's not part of the code generated by XJC.

      %

      Comment


      • #4
        More explanation for stockquote, airline, and mtom examples would be most helpful. There's a LOT going on there that would be worth knowing, and Maven isn't cutting it for me. I will admit that Maven has become a huge black box.

        I'm finding that web services are a huge, complex overhead with very little benefit, IMO. I hope Spring can help as it did with EJBs, but so far no joys.

        %

        Comment


        • #5
          Originally posted by duffymo View Post
          Where does the Stock class come from in the stockquote example? It's not part of the code generated by XJC.
          Some progress, but not there yet.

          It dawned on me that IntelliJ allows me to import an existing project using Maven. I did that for stockquote, and my life improved.

          However, the Main class for the JAX-WS client has three problems:

          Only a default ctor for StockService; at Main line 41:

          Code:
                      service = new StockService(new URL(args[0]), serviceName);
          "cannot find symbol class Stock" - not part of the XJC-generated code; at Main line 43:

          Code:
                  Stock stock = service.getStockSoap11();
          "cannot find symbol method getStockSoap11()"; at Main line 43:

          Code:
                  StockQuoteResponse response = stock.stockQuote(request);

          Comment


          • #6
            duffymo, did you fix your NoClassDefFoundError SOAPException problem? I'm having the same problem and I don't know which jar I need.

            Comment


            • #7
              I have had the same problem with the NoClassDefFoundError SOAPException using the Spring WS 1.5 examples. I tried maven clean install, but that did not help. The problem happens on all examples.

              I think we all need to see inside the blackbox known as Maven and understand the required jar dependencies here.

              Comment


              • #8
                Originally posted by jonesy View Post
                duffymo, did you fix your NoClassDefFoundError SOAPException problem? I'm having the same problem and I don't know which jar I need.
                I'm not sure if it's fair to say that I did, because my solution was to ask IntelliJ to import the Maven project. I believe it has the appropriate JAR in the CLASSPATH, because my issues changed.

                I went to http://www.whatjar.co.uk/whatjar/welcome.htm and typed the name of the missing class into the search engine. It comes back with a list of JARs that contain that class.

                Now - how to add that to the Maven CLASSPATH when you run? There's the rub...

                Good Lord, I hate Maven.

                %

                Comment


                • #9
                  Originally posted by duffymo View Post
                  Some progress, but not there yet.

                  It dawned on me that IntelliJ allows me to import an existing project using Maven. I did that for stockquote, and my life improved.

                  However, the Main class for the JAX-WS client has three problems:

                  Only a default ctor for StockService; at Main line 41:

                  Code:
                              service = new StockService(new URL(args[0]), serviceName);
                  "cannot find symbol class Stock" - not part of the XJC-generated code; at Main line 43:

                  Code:
                          Stock stock = service.getStockSoap11();
                  "cannot find symbol method getStockSoap11()"; at Main line 43:

                  Code:
                          StockQuoteResponse response = stock.stockQuote(request);
                  So no joy? No one has any idea where these classes come from or why I'm missing them?

                  I wonder if all the samples work in the previous version of Spring WS? Maybe I'll try that today.

                  %

                  Comment


                  • #10
                    in the saaj-api jar sir

                    Comment


                    • #11
                      Yes, that was settled a while ago.

                      I've been making some progress. I've found that the instructions for the airline sample were far better in the 1.0.4 version download. (That doesn't mean that the pom.xml is better, just that the instructions seemed more sensible to me.)

                      I've got the database built and loaded in MySQL; I've set up my JPA instance and validated it all in IntelliJ. I re-ran the code generation goal in Maven and added the results to my source paths. The airline sample code is now built and deployed on Tomcat 5.5.26.

                      Next step: try out the different clients to make sure that they're all working. I'm especially interested in the .NET client.

                      I'll go back to the 1.5 version and retry the airline sample again. Knowing what I know now, perhaps I can manage it.

                      %

                      Comment


                      • #12
                        airline clients are not happening for me. each one has build issues. gotta be missing something else.

                        %

                        Comment


                        • #13
                          Must be truthful the airline sample has been a bugger for me to install as well, i cant get the pom run either something about the jaxb2 plugin not working, so i have built my own little sample and am trying out my own clients on that, its good practice and yeilds a lot more understanding, now i have a step by step for the security stuff i reckon i can make it happen, i switched out of maven as well and run ant for my own builds - at least it actually works, ok you have to specify and have the jars

                          Comment


                          • #14
                            Still No Joy With Airline Sample

                            The title says it all.

                            I changed the applicationContext-jpa.xml, because after glancing through it I realized that the dataSource properties were still set to the default values for HSQLDB. (I'm using MySQL.)

                            After changing the properties to point to my database I started getting exceptions on startup. Some of them have to do with referential integrity. If I look at the database, I can see that there's already data in the tables. If I open jpa/applicationContext-jpa.xml, I can see that the DatabaseInitializer bean is the likely culprit, so I commented that out.

                            I also found two problems with the configuration:

                            1. No default ctor for flightController in mvc-servlet.xml; added a reference to airlineService.
                            2. No default ctor for airlineService in service/applicationContext.xml; added references to flightDao and ticketDao.

                            At last I'm able to bring up the JSP that shows flights. Gotta start working with the clients one by one to see what's up with those.

                            It might help some other people to modify the /samples for the 1.5.0 download to match the readme.txt documentation that came with the 1.0.4 download; add the bit about modifying the jpa/applicationContext-jpa.xml if you aren't using HSQLDBC; and correct the two bean configs that I noted above. Thanks.

                            %

                            Comment


                            • #15
                              Security

                              All i still cannot get security to happen on the samples.

                              I am trying to set up the Wss4j example

                              have the following on the client side

                              Code:
                                     <bean id="messagFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
                              
                                     </bean>
                                     
                                     <bean id="client1" class="Client1">
                                     		<constructor-arg ref="messagFactory"/>
                                     		<property name="defaultUri" value="http://localhost:8080/testWS/searchService"/>
                              			<property name="interceptors">
                              				<list>
                              					<ref local="wsInterceptor"/>
                              				</list>
                              			</property> 
                                     </bean>
                                     <bean id="wsInterceptor" class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
                                     		<property name="securementActions" value="UsernameToken"/>
                                     		<property name="securementUsername" value="Ian"/>
                                     		<property name="securementPassword" value="password"/>
                                     </bean>
                              this on the server

                              Code:
                                  <bean id="securityInterceptor" class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
                                  	<property name="validationActions" value="UsernameToken"/>
                                  	<property name="validationCallbackHandler" ref="callbackHandler"/>
                                  </bean>
                                  
                                  <bean id="callbackHandler" class="org.springframework.ws.soap.security.wss4j.callback.SimplePasswordValidationCallbackHandler">
                                  	<property name="users">
                                  		<props>
                                  			<prop key="Ian">password</prop>
                                  		</props>
                                  	</property>
                                  </bean>
                              and i added the interceptor to the PayloadRoot, now when i call the service through eclipse europa web service explorer everything happens, i get a response - but surely i should not as there should be a security failure.

                              When i try to run the client as described above i get the following exception

                              Code:
                              Exception in thread "main" org.springframework.ws.soap.client.SoapFaultClientException: One or more mandatory SOAP header blocks not understood
                              	at org.springframework.ws.soap.client.core.SoapFaultMessageResolver.resolveFault(SoapFaultMessageResolver.java:37)
                              	at org.springframework.ws.client.core.WebServiceTemplate.handleFault(WebServiceTemplate.java:668)
                              	at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:502)
                              	at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:440)
                              	at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:395)
                              	at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:341)
                              	at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:332)
                              	at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:322)
                              	at Client1.getData(Client1.java:31)
                              	at Client1.main(Client1.java:19)
                              Anyone got any more clues as to what i may have missed in trying to get this to go, it is fairly urgent for a POC i am working on

                              Comment

                              Working...
                              X