2

I am trying to consume a JAX-WS webservice written by me. I always get nullPointerException for spring autowired annotated beans. However, everything works fine within serverSide over web, but accessing beans through JAX-WS webservice.

I have tried by extending SpringBeanAutowiringSupport, but still no luck. How can I do this.

regards, Rohit

rohit
  • 602
  • 4
  • 11
  • 24
  • Do you get null objects inside your webService class while autowiring them? Or you get null for webservice, autowired somewhere else? – BraginiNI Apr 11 '12 at 18:47

1 Answers1

1

I had no experience extending SpringBeanAutowiringSupport but had successfuly used this approach:

  1. Annotate webService class such a way :

    @Component("yourWebService")  
    @WebService(endpointInterface ="your.package.YourServicePort")
    
  2. Create new spring-context xml for webService and define JAX-WS endpoint :

    <jaxws:endpoint
        id="yourServiceEndpoint"
        implementor="#yourWebService"
        address="${yourWebService.wsdl.url}"> //load url from properties file
    </jaxws:endpoint>       
    
  3. I suppose you know how to use props in spring, but will explain just in case. You should also create yourWebService.properties file and define it in spring context to use this construction ${yourWebService.wsdl.url} :

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
       <property name="locations">
          <list>
              <value>yourWebService.properties</value>
          </list>
       </property>
    

Using this approach I had successfuly used JAX with Spring

BraginiNI
  • 576
  • 1
  • 16
  • 30
  • I'm facing the same issue. I already have and I gave @Component("TransactionImpl") @WebService public interface Transaction { – Yakhoob Nov 20 '17 at 05:49