Announcement Announcement Module
No announcement yet.
Spring 2.5.5 and JAX-WS HTTP Authentication Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 2.5.5 and JAX-WS HTTP Authentication

    I'm trying to invoke a webservice from a standa alone program after generating the client stubs using JAX-WS RI , using the JaxWsPortProxyFactoryBean.

    Everytime I execute the code it is giving the error: Server returned HTTP response code: 401 for URL

    I've mentioned the user name and password within the applicationContext.xml

    <?xml version="1.0" encoding="UTF-8"?>

    <bean id = "CLLIManagerImpl" class = " pl">
    <property name="service" ref="CLLIWebserviceProxy" />


    <!-- Proxy Implementation Class -->
    <bean id="CLLIManagerBean"
    class="org.springframework.aop.framework.ProxyFact oryBean" >

    <property name="proxyInterfaces">
    <value> </value>
    <property name="target">
    <ref bean="CLLIManagerImpl" />
    <property name="interceptorNames">
    <bean id="CLLIWebserviceProxy" class="org.springframework.remoting.jaxws.JaxWsPor tProxyFactoryBean">
    <property name="username" value="user"></property>
    <property name="password" value="pass"></property>
    <property name="serviceInterface" value="uri.alcatel_com._5530.bulkcollector._1.Exte rnalBulkCollector" />
    <property name="wsdlDocumentUrl" value="url" />
    <property name="serviceName" value="ExternalBulkCollector" />
    <property name="portName" value="ExternalBulkCollectorPort" />
    <property name="useSoapAction" value="true" />

    <!-- Advices -->
    <bean id = "LogbeforeCall" class = " ce" />

    I could get from the release notes of 2.5.5 that http based authentication is supported for jax-ws webservices.

    Any inputs on this will be really helpful.
    Last edited by cags; Oct 14th, 2008, 01:34 AM.

  • #2
    Any information on this?


    • #3

      i've got the same Error, when i try to access my Webservice with Basic-HTTP-Authentication.

      My config.xml:

      <bean id="calculatorService" class="org.springframework.remoting.jaxws.JaxWsPor tProxyFactoryBean">
      <property name="serviceInterface" value=""/>
      <property name="wsdlDocumentUrl" value="http://localhost:8080/testws/Calculator?wsdl"/>
      <property name="namespaceUri" value=""/>
      <property name="serviceName" value="CalculatorService"/>
      <property name="portName" value="CalculatorPort"/>
      <property name="username" value="duck"/>
      <property name="password" value="test" />

      Is this an open issue?


      • #4
        Make sure that the url specified with the wsdlDocumentUrl property isn't protected.
        The username and password properties of the JaxWsPortProxyFactoryBean class are used to authenticate when accessing the endpoint service defined in the wsdl - not for accessing the wsdl itself. The JaxWsPortProxyFactoryBean won't work if the wsdl itself is protected. Either configure a UDDI where the wsdl can be accessed or include the wsdl in the application and reference it like this..

        <property name="wsdlDocumentUrl" value="classpath:wsdlfilename.wsdl"/>


        • #5
          Define Custom JaxWsPortProxyFactoryBean

          Create CustomJaxWsPortProxyFactoryBean like below and define in spring config xml. It will enable WSDL url http basic authentication

          public class CustomJaxWsPortProxyFactoryBean extends JaxWsPortProxyFactoryBean {
          public Service createJaxWsService() {
          [INDENT=2] Authenticator.setDefault(new Authenticator() {
          protected PasswordAuthentication getPasswordAuthentication() {
          [/INDENT][INDENT=4] return new PasswordAuthentication(
          [/INDENT][INDENT=4] }
          [/INDENT][INDENT=3] });
          [/INDENT][INDENT=2]return super.createJaxWsService();