PDA

View Full Version : Web Service Client bNull



jcushing
11-Apr-2014, 05:06 PM
Hi,

I just got done creating a web client class with the FedEx Wsld with the using bNull to eliminate unwanted xml elements. It almost works. The only problem is with a string, there is no way to set to remove it from the outgoing xml. For example, if you don't want to specify the service type, you have to remove the element ServiceType, you can't just set it to blank.

Otherwise, it does remove the unwanted elements.

Judi Cushing

John Tuohy
11-Apr-2014, 06:26 PM
Judy,

There is an option for creating null for structs and also for simple datatypes. You probably want both. When that happens all of the simple types become structs. For example,


Struct tWSCommitDetail
Boolean bNull
tNString CommodityName
tNString ServiceType

You have to set ServiceType.bNull to True. Then it should not get sent.


Move True to CommitDetail.ServiceType.bNull
This is a bit of a pain because your other simple types all require recoding. For example, if you did want to pass a ServiceType string, you'd have to change


Move "type" to CommitDetail.ServiceType
to


Move "type" to CommitDetail.ServiceType.Value
because ServiceType is now a tNString struct instead of a string.

-John

FrankValcarcel
12-Apr-2014, 05:56 PM
You can do it old style and remove it from the in memory XML object before it is sent.