0 Replies Latest reply on Nov 10, 2006 8:43 AM by alesj

    Call properties

    alesj

      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);
      
      }