Self-Solve Knowledge Search

Minimize Maximize
How to remove blank element in an array in SOAP request?
This document has not been formally reviewed for accuracy and is provided as is
Title :
How to remove blank element in an array in SOAP request?
Document ID :
KM01805103
Product - Version:
unified functional testing 12.02 ;
OS :
Updated :
Mon Aug 31 10:46:58 GMT 2015
Summary :
How to remove blank element in an array in SOAP request?

How to remove blank element in an array in SOAP request?

Solution

Here is the sample code:

public void StServiceCallActivity_OnAfterGenerateRequest(object sender, HP.ST.Ext.WebServicesActivities.ActivityProcessXmlMessageEventArgs args)
                {

                                 String RequestEnvelop ="";                       

                                XmlNode GenerationLoadDetails;
                                String NodePath = "/*[local-name(.)=XPath]";
                                GenerationLoadDetails = this.StServiceCallActivity7.InputEnvelope.SelectSingleNode (NodePath);

                                if (GenerationLoadDetails.HasChildNodes)
                                {                                               
                                                
                                                XmlNodeList ChildrenGenerationLoadDetails;
                                                ChildrenGenerationLoadDetails = GenerationLoadDetails.ChildNodes;
                                                int i;
                                                int ChildrenCount = ChildrenGenerationLoadDetails.Count;
                                                for (i = 0; i < ChildrenCount; i++)
                                                {
                                                                XmlNode CurrentChild;
                                                                CurrentChild = ChildrenGenerationLoadDetails.Item (ChildrenGenerationLoadDetails.Count-1);
                                                               
                                                                if (!CurrentChild.HasChildNodes)
                                                                {
                                                                                CurrentChild.ParentNode.RemoveChild (CurrentChild);
                                                                               
                                                                }
                                                }
                                }

                               
                }