Sending xsi:nil from a .NET client to an Axis Service

Paul Johansen <[email protected]> Tue, 5 Oct 2004 22:00:22 -0500
Newsgroups gmane.comp.windows.devel.soap.general
Message-ID <4D52CA31755F4841902BCB199084A54B4E1E17__42490.5578177006$1097031665$gmane$org@mwmktomail02.midwestwireless.com>
I am consuming an Apache Axis Web service with a .NET client, and I am
running into issues when trying to send a null value.

=20

Here is the definition from the WSDL of the message to be sent:

=20

Snip...

<wsdl:message name=3D"processAccountSearchRequest">

                        <wsdl:part name=3D"accNum" =
type=3D"soapenc:string"/>

                        <wsdl:part name=3D"firstName"
type=3D"soapenc:string"/>

                        <wsdl:part name=3D"lastName"
type=3D"soapenc:string"/>

                        <wsdl:part name=3D"accountName"
type=3D"soapenc:string"/>

                        <wsdl:part name=3D"mdn" =
type=3D"soapenc:string"/>

                        <wsdl:part name=3D"sim" =
type=3D"soapenc:string"/>

                        <wsdl:part name=3D"imsi" =
type=3D"soapenc:string"/>

                        <wsdl:part name=3D"esn" =
type=3D"soapenc:string"/>

                        <wsdl:part name=3D"iusr" =
type=3D"soapenc:string"/>

                        <wsdl:part name=3D"min" =
type=3D"soapenc:string"/>

                        <wsdl:part name=3D"ssn" =
type=3D"soapenc:string"/>

                        <wsdl:part name=3D"maxResults" =
type=3D"xsd:int"/>

                        <wsdl:part name=3D"csr" =
type=3D"soapenc:string"/>

            </wsdl:message>

...Snip

=20

Basically all of these parameters are "optional". If I call the proxy
class method in C# like this:

=20

processAccountSearch(null,null,null,null,"(555)555-5555",
null,null,null,null,null,null,20,null);

=20

The resulting SOAP body request that is generated by .NET is the
following:

=20

Snip...

<soap:Body
soap:encodingStyle=3D"http://schemas.xmlsoap.org/soap/encoding/">

                        <tns:processAccountSearch>

                                    <mdn
xsi:type=3D"xsd:string">(555)555-5555</mdn>

                                    <maxResults
xsi:type=3D"xsd:int">20</maxResults>

                        </tns:processAccountSearch>

            </soap:Body>

...Snip

=20

What the Web service is looking for is something that looks like the
following:

=20

Snip...

<SOAP-ENV:Body>

<m:processAccountSearch
xmlns:m=3D"http://accountsearchgateway.webservices.com"
SOAP-ENV:encodingStyle=3D"http://schemas.xmlsoap.org/soap/encoding/">

                                                <accNum
xsi:type=3D"xsd:string" xsi:nil=3D"true"></accNum>

                                                <firstName
xsi:type=3D"xsd:string" xsi:nil=3D"true"></firstName>

                                                <lastName
xsi:type=3D"xsd:string" xsi:nil=3D"true"></lastName>

                                                <accountName
xsi:type=3D"xsd:string" xsi:nil=3D"true"></accountName>

                                                <mdn
xsi:type=3D"xsd:string">(555)-555-5555</mdn>

                                                <sim
xsi:type=3D"xsd:string" xsi:nil=3D"true"></sim>

                                                <imsi
xsi:type=3D"xsd:string" xsi:nil=3D"true"></imsi>

                                                <esn
xsi:type=3D"xsd:string" xsi:nil=3D"true"></esn>

                                                <iusr
xsi:type=3D"xsd:string" xsi:nil=3D"true"></iusr>

                                                <min
xsi:type=3D"xsd:string" xsi:nil=3D"true"></min>

                                                <ssn
xsi:type=3D"xsd:string" xsi:nil=3D"true"></ssn>

                                                <maxResults
xsi:type=3D"xsd:int">20</maxResults>

                                                <csr
xsi:type=3D"xsd:string" xsi:nil=3D"true"></csr>

                        </m:processAccountSearch>

            </SOAP-ENV:Body>

...Snip

=20

Is there a way to have .NET generate the request as shown above? Or
would it be a change in the WSDL file or possibly on the Axis side.

=20

Thanks in advance!

=20

Paul

=20

=20

=20