How to remove auto populated fields in SOAPUI Pro request?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to remove auto populated fields in SOAPUI Pro request?
Hi,
My request always comes with auto populated fields after I save.
For example. If I execute the below request, it works fine.
<abc>000012</abc>
Once I save, close & reopen the Test Step again, it comes like this
<123/><456/><789/><abc>000012</abc>
So the Step fails with errors.
I checked the WSDL. Fields 123, 456 & 789, like mentioned above, have MinOccurs=1 but Dev team are saying these are not mandatory fields & they can’t change schematics of the services.
Please suggest how best to manage this scenario. I am using SOAPUI Pro 5.1.0.
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Below is my Test Step (Request).
<soapenv:Envelope>
<soapenv:Header/>
<soapenv:Body>
<xyz>
<Amount>50000</Amount>
</xyz>
</soapenv:Body>
</soapenv:Envelope>
It gives proper response. Then I save the project, close the Test Step & reopen again. Below is the Request.
<soapenv:Envelope>
<soapenv:Header/>
<soapenv:Body>
<xyz>
<Amount>50000</Amount>
<Amount1/>
<Amount2/>
<Amount3/>
</xyz>
</soapenv:Body>
</soapenv:Envelope>
Because of new tags like <Amount1/>, <Amount2/> & <Amount3/>, which gets auto populated every time, the Test Step fails this time. Ideally only <Amount> should come in the Request like I saved earlier.
WSDL has <Amount1>, <Amount2> & <Amount3> tags as MinOccurs=1 but Dev team are saying these are not mandatory fields.
I want only <Amount> to come in the request all the time.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you using the "Form" view of the request editor? As I can replicate the behaviour you describe by deleteing data from the "XML" view, switching to the "Form" view and then when going back to the "XML" view and elements with minOccurs=1 are recreated
My guess (and this is a guess) is that when going from the "Form" view to the "XML" view, Ready API has to recreate the XML, thus all it can use to do that is the WSDL contract, thus if the contract states minOccurs=1 then it will add the element. Perhaps somebody from SmartBear can confirm?
Fundamentally though if you have minOccurs=1 it is mandatory, regardless what somebody may say. Saying that, if your problem is caused by the "Form" view as described above, you can set the default SOAP request editor in the preferences to "Source" and never switch to the "Form", though to be honest I would only see this as a very temporary work around as simply switching to the Form view (a very common thing) will break your tests.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank You very much. It works like I expected.
One question. For Web Services which work fine, shall I stick to Form or Source?
In other words, if I keep Source, can I expect unexpected Responses in future or it may impact somewhere?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Under normal circumstances it shouldn't matter if you use the Form or XML view, use whichever you are most comfortable with. I personally use the XML view.
With regard to your issue, I wouldn't rely on not using the Form view as a long term solution. My suggestion was only meant to be a temporary work around while waiting for the web service to be fixed (if the elements truely are optional) or the tests updated to always include the empty elements (if the web service WSDL is correct and they are mandatory).
I'm sorry I can't answer your question:
"if I keep Source, can I expect unexpected Responses in future or it may impact somewhere?"
I don't know all the internals of Ready API, and when it uses the WSDL contract to generate XML. Sorry that's probably not what you wanted to hear.
