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.

No comments:

Post a Comment

Coder Magnet
CoderMagnet is full of resources from our daily development activities. It has solutions for common problematic scenarios in technologies like Java 8, AEM, JCR and also occasionally gives you tips on Blogger as well.