Announcement Announcement Module
Collapse
No announcement yet.
Authentication with ws:outbound-gateway Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Authentication with ws:outbound-gateway

    Hi,

    I am stuck with a problem. I have a SOAP web service(secured with password) which I am trying to access using ws:outbound-gateway. Here is my config file looks like below.

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

    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:int="http://www.springframework.org/schema/integration"
    xmlns:int-http="http://www.springframework.org/schema/integration/http"
    xmlns:stream="http://www.springframework.org/schema/integration/stream"
    xmlns:ws="http://www.springframework.org/schema/integration/ws"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schem...ring-beans.xsd
    http://www.springframework.org/schema/integration
    http://www.springframework.org/schem...ntegration.xsd
    http://www.springframework.org/schem...gration/stream
    http://www.springframework.org/schem...ion-stream.xsd
    http://www.springframework.org/schema/integration/ws
    http://www.springframework.org/schem...gration-ws.xsd
    http://www.springframework.org/schema/integration/http
    http://www.springframework.org/schema/integration/http/spring-integration-http.xsd">

    <int:channel id="inputchannel" />
    <int:chain input-channel="inputchannel" output-channel="responseChannel">
    <ws:header-enricher>
    <ws:soap-action
    value="http://test.org/PointOfSale/GetAccountListForName" />
    </ws:header-enricher>
    <ws:outbound-gateway message-sender="messageSender"
    uri="https://localhost:9080/services/PointOfSale.asmx?WSDL" />
    </int:chain>

    <bean id="httpClientParams" class="org.apache.commons.httpclient.params.HttpCl ientParams">
    <property name="authenticationPreemptive" value="true" />
    <property name="connectionManagerClass"
    value="org.apache.commons.httpclient.MultiThreaded HttpConnectionManager" />
    </bean>
    <bean id="httpClient" class="org.apache.commons.httpclient.HttpClient">
    <constructor-arg ref="httpClientParams" />
    </bean>

    <bean id="messageSender"
    class="org.springframework.ws.transport.http.Commo nsHttpMessageSender">
    <constructor-arg ref="httpClient" />
    <property name="credentials">
    <bean class="org.apache.commons.httpclient.UsernamePassw ordCredentials">
    <constructor-arg value="username" />
    <constructor-arg value="password" />
    </bean>
    </property>
    </bean>

    <int:channel id="responseChannel">
    <int:queue capacity="10" />
    </int:channel>


    </beans>
    But, I got an error while sending the request.
    [1/3/13 20:01:12:913 IST] 00000026 SystemErr R org.springframework.integration.MessageHandlingExc eption: error occurred in message handler [org.springframework.integration.ws.SimpleWebServic eOutboundGateway#79437943]
    [1/3/13 20:01:12:913 IST] 00000026 SystemErr R at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:79)
    [1/3/13 20:01:12:914 IST] 00000026 SystemErr R at org.springframework.integration.handler.MessageHan dlerChain$1.send(MessageHandlerChain.java:154)
    [1/3/13 20:01:12:914 IST] 00000026 SystemErr R at org.springframework.integration.core.MessagingTemp late.doSend(MessagingTemplate.java:288)
    [1/3/13 20:01:12:914 IST] 00000026 SystemErr R at org.springframework.integration.core.MessagingTemp late.send(MessagingTemplate.java:149)
    .
    .
    .
    ..........
    [1/3/13 20:01:12:920 IST] 00000026 SystemErr R at com.ibm.io.async.ResultHandler$2.run(ResultHandler .java:905)
    [1/3/13 20:01:12:921 IST] 00000026 SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:1613)

    [1/3/13 20:01:12:921 IST] 00000026 SystemErr R Caused by: org.springframework.ws.soap.client.SoapFaultClient Exception: System.Web.Services.Protocols.SoapException: Object reference not set to an instance of an object.
    at Artizan.Webservices.ServiceHost.Advice.PointOfSale .ExceptionInterceptor.AfterThrowing(Exception exception) in D:\work\workspace\visual-studio\Artizan.Webservices\trunk\src\Artizan.Webse rvices.ServiceHost\Advice.PointOfSale\ExceptionInt erceptor.cs:line 45
    at Spring.Aop.Framework.Adapter.ThrowsAdviceIntercept or.InvokeHandlerMethod(IMethodInvocation invocation, Exception triggeringException, MethodInfo handlerMethod) in c:\_svn\spring-net\tags\spring-net-1.3.1\src\Spring\Spring.Aop\Aop\Framework\Adapter\ ThrowsAdviceInterceptor.cs:line 316
    at Spring.Aop.Framework.Adapter.ThrowsAdviceIntercept or.LookupAndInvokeAnyHandler(Exception ex, IMethodInvocation invocation) in c:\_svn\spring-net\tags\spring-net-1.3.1\src\Spring\Spring.Aop\Aop\Framework\Adapter\ ThrowsAdviceInterceptor.cs:line 244
    at Spring.Aop.Framework.Adapter.ThrowsAdviceIntercept or.Invoke(IMethodInvocation invocation) in c:\_svn\spring-net\tags\spring-net-1.3.1\src\Spring\Spring.Aop\Aop\Framework\Adapter\ ThrowsAdviceInterceptor.cs:line 234
    at Spring.Aop.Framework.AbstractMethodInvocation.Proc eed() in c:\_svn\spring-net\tags\spring-net-1.3.1\src\Spring\Spring.Aop\Aop\Framework\Abstract MethodInvocation.cs:line 284
    at Spring.Aop.Framework.DynamicProxy.AdvisedProxy.Inv oke(Object proxy, Object target, Type targetType, MethodInfo targetMethod, MethodInfo proxyMethod, Object[] args, IList interceptors) in c:\_svn\spring-net\tags\spring-net-1.3.1\src\Spring\Spring.Aop\Aop\Framework\DynamicP roxy\AdvisedProxy.cs:line 208
    at CompositionAopProxy_9ca998754eeb44f998a02ee215d15b 9e.GetAccountListForName(GetAccountListForNameRequ est request)
    at PointOfSale.GetAccountListForName(GetAccountListFo rNameRequest request)

    [1/3/13 20:01:12:921 IST] 00000026 SystemErr R at org.springframework.ws.soap.client.core.SoapFaultM essageResolver.resolveFault(SoapFaultMessageResolv er.java:37)
    [1/3/13 20:01:12:921 IST] 00000026 SystemErr R at org.springframework.ws.client.core.WebServiceTempl ate.handleFault(WebServiceTemplate.java:735)
    [1/3/13 20:01:12:921 IST] 00000026 SystemErr R at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:563)
    [1/3/13 20:01:12:921 IST] 00000026 SystemErr R at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:501)
    [1/3/13 20:01:12:922 IST] 00000026 SystemErr R at org.springframework.integration.ws.SimpleWebServic eOutboundGateway.doHandle(SimpleWebServiceOutbound Gateway.java:88)
    [1/3/13 20:01:12:922 IST] 00000026 SystemErr R at org.springframework.integration.ws.AbstractWebServ iceOutboundGateway.handleRequestMessage(AbstractWe bServiceOutboundGateway.java:176)
    [1/3/13 20:01:12:922 IST] 00000026 SystemErr R at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleMessageInternal(A bstractReplyProducingMessageHandler.java:97)
    [1/3/13 20:01:12:922 IST] 00000026 SystemErr R at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:73)
    [1/3/13 20:01:12:922 IST] 00000026 SystemErr R ... 65 more
    I have also used interceptor like this, but this also didn't work.
    <bean id="wss4jSecurityInterceptor"
    class="org.springframework.ws.soap.security.wss4j. Wss4jSecurityInterceptor">
    <property name="securementActions" value="UsernameToken" />
    <property name="securementUsername" value="OmigService" />
    <property name="securementPassword" value="Omig#3021!" />
    <property name="securementPasswordType" value="PasswordText" />
    </bean>
    Also, to mention, I get correct response back from Web Service when I use SOAPUI or any other Web Service client.

    Can some one let me know the cause of the exception and how to resolve it?

    Thanks,
    Avinash

  • #2
    Please don't post the same question in multiple places.

    I don't know .net but a quick google indicates this is some problem with the service itself and/or the data sent, rather than an authentication problem.

    I suggest you use a tcp/ip monitor (or wireshark etc) to compare the messages being sent by the gateway Vs. your SOAPUI test.

    Comment


    • #3
      Originally posted by Gary Russell View Post
      Please don't post the same question in multiple places.

      I don't know .net but a quick google indicates this is some problem with the service itself and/or the data sent, rather than an authentication problem.

      I suggest you use a tcp/ip monitor (or wireshark etc) to compare the messages being sent by the gateway Vs. your SOAPUI test.

      Thanks for the reply. I have posted the question to confirm whether the process I followed is correct or had I did any mistakes?

      Comment

      Working...
      X