Spring – Values from property file not loaded

I consume a web service in spring and get values. To do that I use GenericHandler Class to set headers for web service XML, to fill up credentials and other links in the XML I use property file and load them. However, I am not able to load values into the variables. Here are my code,

Class WSAuthentication extends GenericHandler
    private String consumerIdString;

    public QName[] getHeaders()
        return null;

    public boolean handleRequest(MessageContext context)
        .... // SOAP Message context codes
        // the above line Prints null 


Web Service Handler class as follows:

import javax.xml.rpc.handler.HandlerInfo;
import javax.xml.rpc.handler.HandlerRegistry;
import javax.xml.rpc.ServiceException;

public class WSHandler
    public StubClass addHandlerToGetInfo()
        ....// Web Service stub codes
        HandlerRegistry handlerRegistryObject = locatorStubObject.getHandlerRegistry();
        List chain = handlerRegistryObject.getHandlerChain((QName)locatorStubObject.getPorts().next());
        HandlerInfo handlerInfoObject = new HandlerInfo();
       return stubObject;


In another class I use this web service to get the code, I invoke this code in a method annotated as @PostProcess of another bean,

....// Consuming  code goes here
WSHandler wsHandlerObj = new WSHandler();
StubClass stubObj = wsHandlerObj.addHandlerToGetInfo();
// Invoking WS Stub methods to get values
WSResponseClass responseObj = stubObj.getProfile(id);

Here I am not able to get consumerIdString object from properties, on the other hand I am able to hard code the value in the WSAuthentication class and it goes good when I try executing that way. Loading from property file gives a null object when I tried to access that member variable.

My questions:

  • Will an instance of class WSAuthentication be created by
  • Does the HandlerInfo gets the web service header
    through Class instance of WSAuthentication?
  • Is there any other way
    to do this?

Please help me out, Thank you!

Source: java

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.