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 : https://.oraclecloud.com/ic/ws/integration/v1/flows/osc/OSCTORESPONSYS_RENFE/1.0/?wsdl

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

  <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/crmCommon/content/outboundMessage/types/" xmlns:cus="http://xmlns.oracle.com/apps/custom">  
<wsse:Security  xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">   
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">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="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">'+  
'<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">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 *