Announcement Announcement Module
Collapse
No announcement yet.
Spring 2.5.5 and JAX-WS HTTP Authentication Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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 = "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, 01:34 AM.

  • #2
    Any information on this?

    Comment


    • #3
      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?

      Comment


      • #4
        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"/>

        Comment


        • #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 {
          @Override
          public Service createJaxWsService() {
          [INDENT=2] Authenticator.setDefault(new Authenticator() {
          [/INDENT][INDENT=3]@Override
          protected PasswordAuthentication getPasswordAuthentication() {
          [/INDENT][INDENT=4] return new PasswordAuthentication(
          [/INDENT][INDENT=5]getUsername(),
          [/INDENT][INDENT=5]getPassword().toCharArray());
          [/INDENT][INDENT=4] }
          [/INDENT][INDENT=3] });
          [/INDENT][INDENT=2]return super.createJaxWsService();
          [/INDENT]
          }
          }

          Comment

          Working...
          X