[jboss-user] [JBossWS] - Call properties

alesj do-not-reply at jboss.com
Fri Nov 10 08:43:21 EST 2006


Regarding (basic) authentication from annotated web client (@WebServiceClient) I added the following code:


  | JSR181ClientMetaDataBuilder.rebuildEndpointMetaData
  | 
  |       // Process @CallProperties
  |       if (wsClass.isAnnotationPresent(CallProperties.class))
  |          processCallProperties(epMetaData, wsClass);
  | 
  | JSR181MetaDataBuilder
  | 
  |    protected void processCallProperties(EndpointMetaData epMetaData, Class wsClass)
  |    {
  |       CallProperties callProperties = (CallProperties) wsClass.getAnnotation(CallProperties.class);
  | 
  |       int length = callProperties.keys().length;
  |       if (length > 0)
  |       {
  |          Properties properties = epMetaData.getProperties();
  |          if (properties == null)
  |          {
  |             epMetaData.setProperties(new Properties());
  |          }
  |       }
  | 
  |       if (length != callProperties.values().length)
  |       {
  |          throw new IllegalArgumentException("Different lenght of call properties: keys != values");
  |       }
  | 
  |       for(int i = 0; i < length; i++)
  |       {
  |          epMetaData.getProperties().setProperty(callProperties.keys(), callProperties.values());   
  |       }
  |    }
  | 

So that when we do SOAPConnectionImpl.getRemotingMetaData we actually get username / password call properties.

Example:


  | @WebService
  | @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
  | @CallProperties(
  |         keys = {"javax.xml.rpc.security.auth.username", "javax.xml.rpc.security.auth.password"}, 
  |         values = {"tomcat", "tomcat"}
  | )
  | public interface AccountService {
  | 
  |     @WebMethod
  |     @WebResult(name = "createAccountReturn")
  |     Account createAccount(String username);
  | 
  |     @WebMethod
  |     @Oneway
  |     void insertAccount(Account account);
  | 
  | }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984878#3984878

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984878



More information about the jboss-user mailing list