Steps to Get Payload Data:
def apiRequestBody = context.ApiRequest.getBody().asString()
def soapEnv = new XmlSlurper().parseText(apiRequestBody)
def clientSystem = soapEnv['Header']['XXHeader']['XXSystem'].toString()
if ( clientSystem != 'SNV-Vijaya' )
{
throw new oracle.apiplatform.policies.sdk.exceptions.PolicyProcessingException('Forbidden', 403, 'Access Denied')
}
def sourceEnv = soapEnv['Header']['XXHeader']['XXEnvironment'].toString()
def corrId = soapEnv['Header']['XXHeader']['XXId'].toString()
Set Custom Header Values:
context.ServiceRequest.setHeader("x-intg-source-system", clientSystem )
context.ServiceRequest.setHeader("x-intg-source-env", sourceEnv)
context.ServiceRequest.setHeader("x-intg-corrid", corrId)
Sample Payload :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xxs="http://xmlns.oracle.com/svn/ics/SampleService">
<soapenv:Header>
<xxintegration:XXHeader xmlns:xxintegration="http://xmlns.oracle.com/svn/ics/types/base/XXHeader/v001">
<xxintegration:XXUserInfo>
<xxintegration:IdentityId>12345</xxintegration:IdentityId>
<xxintegration:User>VijayaKumar</xxintegration:User>
</xxintegration:XXUserInfo>
<xxintegration:XXEnvironment>development</xxintegration:XXEnvironment>
<xxintegration:XXSystem>SNV-Vijaya</xxintegration:XXSystem>
<xxintegration:XXId>Id-0f218d61d48c3a8c8b46afe5</xxintegration:XXId>
</xxintegration:XXHeader>
</soapenv:Header>
<soapenv:Body>
<xxs:SalesTransactionMessage>
<xxs:TransactionType>ICSSales</xxs:TransactionType>
<xxs:TransactionID>123459</xxs:TransactionID>
<xxs:CustomerOrderMode/>
<xxs:BusinessDate/>
<xxs:ReceiptNo/>
<xxs:SalesId/>
<xxs:CustomerId/>
<xxs:Sales>
<xxs:SalesTrans>
<xxs:ItemId/>
<xxs:ItemCategory/>
<xxs:Quantity/>
<xxs:Serial/>
<xxs:NetAmount/>
<xxs:SalesTaxAmount/>
<xxs:GrossAmount/>
<xxs:SalesTaxPercentage/>
<xxs:DiscountAmount/>
<xxs:Price/>
<xxs:LineNumber/>
</xxs:SalesTrans>
</xxs:Sales>
<xxs:Payment>
<xxs:PaymentTrans>
<xxs:PaymentType/>
<xxs:Amount/>
<xxs:Currency/>
</xxs:PaymentTrans>
</xxs:Payment>
</xxs:SalesTransactionMessage>
</soapenv:Body>
</soapenv:Envelope>