I try to use the built-in simple web service client using Spring -WS and click on the wall. The SOAP service I'm trying to call is used for HTTP Basic Basic authentication.
Using the sample Spring -WS tutorial, I configured mine WebServiceTemplatefor use HttpComponentsMessageSenderwith my credentials:
<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
<constructor-arg ref="messageFactory"/>
<property name="messageSender">
<bean class="org.springframework.ws.transport.http.HttpComponentsMessageSender">
<property name="credentials">
<bean class="org.apache.http.auth.UsernamePasswordCredentials">
<constructor-arg value="john:secret"/>
</bean>
</property>
</bean>
</property>
<property name="defaultUri" value="http://example.com/WebService"/>
</bean>
When I try to execute the client, I get the following error:
org.springframework.ws.client.WebServiceTransportException: Authorization Required [401]
My previous one ( WebServiceTemplate with Basic Auth using HttpComponentsMessageSender and HttpClientBuilder basic auth ) shows that the problem is that Spring -WS tries to connect to the endpoint without credentials first, which causes the endpoint to reject the initial connection.
, -, HTTP.
, Spring ?
- .
( , - -, , HTTP, , ).
!