Convert curl request to SoapUI Request
I'm currently trying to convert a working curl command to a valid SoapUI test case but am having some issues. I am trying to attach a json file and the server also requires authorisation. I'm able to configure the authorisation correctly but when comparing the raw packet of both curl and SoapUI, it seems that SoapUI seems to be adding this to the header:
Content-Type: application/json; name="file"
where as the curl request has:
Is there a way to edit this part of the header?
Alternatively is another way to make this work?
EDIT: just a bit more info about my test case. To replicate the curl request, I have added the attachment and checked the 'Cached' box. I have seen other questions which say that the 'Name' field should be the full path (C:/etc/etc) and others that do not specify this. I have tried both to no avail. 'Content type' is set to application/json as this is what comes up in the curl request and the 'ContentID' = attachment. I have then added a parameter with the 'Name' = attachment, 'Value' = file:*filename* (without the path), 'Style' = QUERY and 'Level' = RESOURCE. 'Media Type is multipart/form-data, 'PostQueryString' box is checked as well and 'Method' set to POST.
Solved! Go to Solution.
If you have got a wsdl / swagger definition file, it would be very simple to use either SoapUI OS / ReadyAPI.
You want to go thru documentation?
I'm currently using version 1.9.0. Unfortunately, I don't have a WSDL file so I cannot do it that way. I have also looks through that documentation and didn't find anything helpful.
That was a typo, it is wadl not wsdl if you are using a REST API.
wadl / swagger definition is something similar to wsdl for SOAP, acts a contract between the different parties who interact.
Otherwise, you have to add the artifacts manually which may be tedious if you many methods in the API.
You can have a look this video to get an idea
The workaround to perform is to remove the name via Groovy. You can change it by using the below Groovy script in event handler FilterRequest.filterRequest:
def bodyPart1 = context.getProperty("httpMethod").requestEntity.message.content.getBodyPart(0)