Monday, 25 July 2016

Remove WebService Parameters from Request XML programmatically

Remove SOAP Request XML parameter programmatically.

SOAP is a protocol that allows systems to communicate using HTTP and uses predominantly XML
for communication. The necessity of web applications to inter communicate made it necessary for
a protocol to be designed.

Sometimes when setting the web service parameters there are compulsory parameters whose values needs
to be set. But passing these parameter might cause the Web Service to fail. So a situation may arise
where we need to both set the web service parameter value as well as remove the parameter from the
request XML!!!

So lets say for example you have a webservice parameter like this:


Suppose passing this value in the request xml is giving an error.
And also lets assume this is being set from the JAVA program like this.


Now to remove this parameter from the web service request XML we just need to set
the parameter as NULL. This will remove the web service parameter from the request XML.


Afer you set a web service parameter to null. It will automatically
be dropped like shown below.


We can see from the above XML that the CodeValue got dropped.