Results 1 to 5 of 5

Thread: Spring 2.5.5 and JAX-WS HTTP Authentication

  1. #1
    Join Date
    Jul 2006
    Posts
    4

    Default 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 = "com.cgi.network.sdcconfigurator.CLLIManagerIm pl">
    <property name="service" ref="CLLIWebserviceProxy" />

    </bean>

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

    <property name="proxyInterfaces">
    <value>com.cgi.network.sdcconfigurator.CLLIManager </value>
    </property>
    <property name="target">
    <ref bean="CLLIManagerImpl" />
    </property>
    <property name="interceptorNames">
    <list>
    <value>LogbeforeCall</value>
    </list>
    </property>
    </bean>
    <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" />

    </bean>
    <!-- Advices -->
    <bean id = "LogbeforeCall" class = "com.cgi.network.sdcconfigurator.LogBeforeCallAdvi 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 at 01:34 AM.

  2. #2
    Join Date
    Jul 2006
    Posts
    4

    Default

    Any information on this?

  3. #3
    Join Date
    Mar 2006
    Posts
    29

    Default

    Hi,

    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="org.me.calculator.Calculator_interf"/>
    <property name="wsdlDocumentUrl" value="http://localhost:8080/testws/Calculator?wsdl"/>
    <property name="namespaceUri" value="http://calculator.me.org/"/>
    <property name="serviceName" value="CalculatorService"/>
    <property name="portName" value="CalculatorPort"/>
    <property name="username" value="duck"/>
    <property name="password" value="test" />
    </bean>

    Is this an open issue?

  4. #4
    Join Date
    Dec 2008
    Posts
    2

    Default

    Hi,
    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. #5
    Join Date
    Aug 2012
    Posts
    1

    Smile 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 {
    @Override
    public Service createJaxWsService() {
    Authenticator.setDefault(new Authenticator() {
    @Override
    protected PasswordAuthentication getPasswordAuthentication() {
    return new PasswordAuthentication(
    getUsername(),
    getPassword().toCharArray());
    }
    });
    return super.createJaxWsService();
    }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •