ERROR:java.lang.NullPointerException: Cannot get property 'message' on null object
Friends, I am trying to add "Content-Disposition" header to one of the parts of multi part SOAP request which is not adding by default if I use Inline Files feature of SoapUI Pro to send a file as an attachment. I have followed below KB article to add this part header using RequestFilter.filterrequest Event handler but I am getting "ERROR:java.lang.NullPointerException: Cannot get property 'message' on null object"
Any hints to fix this?
KB Article:
My Groovy Script from RequestFilter.filterrequest Event:
import org.apache.http.client.methods.HttpRequestBase
import com.eviware.soapui.impl.wsdl.submit.transports.http.BaseHttpRequestTransport
HttpRequestBase httpMethod = (HttpRequestBase) context.getProperty(BaseHttpRequestTransport.HTTP_METHOD)
def count = context.getProperty("httpMethod").requestEntity.message.content.count
for (def i=1; i < count; i++)
{
def bodyPart = context.getProperty("httpMethod").requestEntity.message.content.getBodyPart(i)
bodyPart.removeHeader("Content-Disposition")
bodyPart.addHeader("Content-Disposition", "attachment; name=\"Base64Content.txt\"; filename=\"Base64Content.txt\"")
}