Skip to content

Groovy 43 – Calling a SOAP WS that needs header authentication from groovy

Lets say we need to call directly from groovy a SOAP WS that requires authentication details to be sent in the Header.

For this example lets take a ICS WS, as ICS web services require this heather to be sent in the payload.

WSDL used will be :

This Ws has a method called process and the XML payload looks like so:

  <soapenv:Envelope xmlns:soapenv="" xmlns:typ="" xmlns:cus="">  
<wsse:Security  xmlns:wsse="">   
<wsse:Password Type="">PASSWORD</wsse:Password>  

To call this Ws from groovy first step is to register the WS in Sales Cloud

You will register the WS normally as any SOAP WS , but you will use authentication none or basic in security schema, it will make no difference, as  as we send the authentication in the call , in the payload.

I will use as reference name for the WS: ICS_WS

Now the groovy code we create the heather:

   def soapHeader = '<wsse:Security  xmlns:wsse="">'+  
'<wsse:Password Type="">PASSWORD</wsse:Password>'+  

  Next  we create the payload for the operation:

def payload =

'ATTRIBUTE' :<Value>

Now we put all together and call the WS


def wsdc = adf.webServices.ICS_WS; 
wsdc.requestSoapHeader =soapHeader ;
def response = wsdc.process(Ticket_Renfe);

Hope this will help with this type of web services.


Leave a Reply

Your email address will not be published. Required fields are marked *