How could I invoke a webservice with some nillable values

  • Thread starter vqqmbhlu8s88lz1
  • Start date
V

vqqmbhlu8s88lz1

In document mode, I want to fill some values in my SOAP Request with
literal values but I want also pass "null values" on it to set to blank
distant data like datas, addresses, ... and so on, as I will reset
them.

Thanks for your help.
 
M

Manohar Kamath

Depends on if you nulls are valid values for the objects. Fundamental types
like int, etc. are value-types, and you can not assign nulls to these. If
you really need to null these out, consider create a flag to indicate that
these values are nulls, and handle this accordingly in your web methods.
 
D

Dan Rogers

Also, consider passing (or not passing) elements as a way to do this. An
optional element that is not set is not serialized (refernce types). If
you want to not pass a value type, create a field with the same name as
your field, but of type boolean with the word Specified appended to the
field name.

public int myInt;
public bool myIntSpecified = false;

This will make the myInt field be supressed from serialization if the value
of myIntSpecified is false.
--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top