I have used WSClient++ to generate my source code. When I am passing null value to object, I expect when request XML is generated it should include the empty tag to the request XML. But it seems that its not generating any tag when null value is pass. For example:
SchoolRequest req = new SchoolRequest();
req.setName("Xyz");
req.setRoll(1);
req.setSub("CS");
req.setPunctual(null);
I expect request xml to be
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://blah.blah.blah/" xmlns:ns4="http://abc.xyz/xml" xmlns:ns5="http://blah.blah.blah" xmlns:ns6="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header />
<soap:Body>
<ns4:GetSchoolInfo>
<ns4:request>
<ns4:Name>1021</ns4:Name>
<ns4:Roll>1.0.2.1</ns4:Roll>
<ns4:Sub>CS</ns4:Sub>
<ns4:Punctual/> <----Notice this tag
</ns4:request>
</ns4:GetSchoolInfo>
</soap:Body>
</soap:Envelope>
What I get
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://blah.blah.blah/" xmlns:ns4="http://abc.xyz/xml" xmlns:ns5="http://blah.blah.blah" xmlns:ns6="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header />
<soap:Body>
<ns4:GetSchoolInfo>
<ns4:request>
<ns4:Name>1021</ns4:Name>
<ns4:Roll>1.0.2.1</ns4:Roll>
<ns4:Sub>CS</ns4:Sub> <--Notice NO PUNCTUAL TAG
</ns4:request>
</ns4:GetSchoolInfo>
</soap:Body>
</soap:Envelope>
I have no idea about this behavior. Is there anything I am doing wrong? Can anybody help me through this.?