As a SOAP newbie I am following the same tutorial as given in Spring boot - Server did not recognize the value of HTTP Header SOAPAction. The tutorial can be found in https://howtodoinjava.com/spring-boot/spring-soap-client-webservicetemplate/amp/
Currently I am able to send the SOAP payload with the request needed. The server is responding to say I have not authenticated.
I therefore am trying to send the SOAP header with authentication detail along with this SOAP payload. See below examples.
Firstly, I have successfully managed to get the tutorial working. The request was sent with SOAP Action and response received.
Sent request [SaajSoapMessage {http://server.windeed.co.za/windeedengine/}CheckDeedsOfficeStatus]
The response is that I have not authenticated/sent authentication details correctly. I therefore created the Authentication Object with all the necessary details in order to marshall and make part of the SOAP message.
I tried the below:
ObjectFactory of = new ObjectFactory();
WinDeedCredentials cred = of.createWinDeedCredentials();
cred.setUsername("Test");
cred.setPassword("Test123");
cred.setCompany("COMPANY");
cred.setRequester("SOAP");
CheckDeedsOfficeStatus cdo = of.createCheckDeedsOfficeStatus();
CheckDeedsOfficeStatusResponse dr = (CheckDeedsOfficeStatusResponse)sc.callWebService(cdo,"http://server.windeed.co.za/windeedengine/CheckDeedsOfficeStatus");
The goal is to achieve this:
POST /windeedengine3/client.asmx HTTP/1.1
Host: server.windeed.co.za
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://server.windeed.co.za/windeedengine/CheckDeedsOfficeStatus"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<WinDeedCredentials xmlns="http://server.windeed.co.za/windeedengine/">
<Username>string</Username>
<Password>string</Password>
<Company>string</Company>
<Requester>string</Requester>
</WinDeedCredentials>
</soap:Header>
<soap:Body>
<CheckDeedsOfficeStatus xmlns="http://server.windeed.co.za/windeedengine/" />
</soap:Body>
</soap:Envelope>
Currently, with the missing Authentication details, I am told I haven't authenticated correctly.
The expected result is the correct response from the server: Online or Offline. What is the correct way?