You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by Tim Dierks <ti...@yahoo.com> on 2002/10/31 17:49:25 UTC

.NET client omits null arguments

I am having a problem with a .NET client omitting null
arguments from messages sent to my Apache SOAP (2.3.1)
service.  For example, SOAP service method signature
is:

  public int myMethod(String arg1, String arg2);

My .NET C# client makes an call to the SOAP service
like this:

   int result = myMethod(arg1, null);

If arg2 is null, then arg2 is left out altogether from
the message sent to my Apache SOAP service.  So Apache
SOAP generates a FAULT with the error "no signature
match", since it received only one argument instead of
two.

Has anyone encountered this problem and figured out a
solution?

Thanks,

Tim Dierks



__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: .NET client omits null arguments

Posted by Tim Dierks <ti...@yahoo.com>.
Scott,

Your suggestion works fine.  I had hoped to avoid
editing the C# proxy file generated by the Microsoft
wsdl utility, but I guess there's no way around it.

Thanks for the help!

Tim Dierks

--- Scott Nichol <sn...@scottnichol.com> wrote:
> Here's the short of it:
> 
> 1. You must use wsdl.exe to generate a proxy class
> for the service (or
> write a proxy manually).  You cannot do "Add Web
> Reference", as that
> re-generates the proxy code whenever you rebuild the
> project (VS.NET).
> 
> 2. You must add a SoapElement attribute for each
> method parameter that
> specifies the parameter is nullable, e.g.
> 
>     public String echoString([SoapElement("s",
> IsNullable=true)] String
> s) {...}
> 
> 3. .NET will now send an XML element for every
> parameter, but for null
> parameters it will not send an xsi:type attribute,
> just xsi:null (note:
> this is a bug: it should send xsi:nil for the 2001
> schema).  Therefore,
> you must add a mapping to your service's deployment
> descriptor for every
> parameter name, e.g.
> 
>     <isd:map
>
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>              xmlns:x="" qname="x:s"
> 
>
xml2JavaClassName="org.apache.soap.encoding.soapenc.StringDeserializer"/
> >
> 
> Scott Nichol
> 
> ----- Original Message -----
> From: "Tim Dierks" <ti...@yahoo.com>
> To: <so...@xml.apache.org>
> Sent: Thursday, October 31, 2002 11:49 AM
> Subject: .NET client omits null arguments
> 
> 
> > I am having a problem with a .NET client omitting
> null
> > arguments from messages sent to my Apache SOAP
> (2.3.1)
> > service.  For example, SOAP service method
> signature
> > is:
> >
> >   public int myMethod(String arg1, String arg2);
> >
> > My .NET C# client makes an call to the SOAP
> service
> > like this:
> >
> >    int result = myMethod(arg1, null);
> >
> > If arg2 is null, then arg2 is left out altogether
> from
> > the message sent to my Apache SOAP service.  So
> Apache
> > SOAP generates a FAULT with the error "no
> signature
> > match", since it received only one argument
> instead of
> > two.
> >
> > Has anyone encountered this problem and figured
> out a
> > solution?
> >
> > Thanks,
> >
> > Tim Dierks
> >
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > HotJobs - Search new jobs daily now
> > http://hotjobs.yahoo.com/
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@xml.apache.org>
> > For additional commands, e-mail:
> <ma...@xml.apache.org>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@xml.apache.org>
> For additional commands, e-mail:
> <ma...@xml.apache.org>
> 



__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

Re: .NET client omits null arguments

Posted by Tim Dierks <ti...@yahoo.com>.
Scott,

Your suggestion works fine.  I had hoped to avoid
editing the C# proxy file generated by the Microsoft
wsdl utility, but I guess there's no way around it.

Thanks for the help!

Tim Dierks

--- Scott Nichol <sn...@scottnichol.com> wrote:
> Here's the short of it:
> 
> 1. You must use wsdl.exe to generate a proxy class
> for the service (or
> write a proxy manually).  You cannot do "Add Web
> Reference", as that
> re-generates the proxy code whenever you rebuild the
> project (VS.NET).
> 
> 2. You must add a SoapElement attribute for each
> method parameter that
> specifies the parameter is nullable, e.g.
> 
>     public String echoString([SoapElement("s",
> IsNullable=true)] String
> s) {...}
> 
> 3. .NET will now send an XML element for every
> parameter, but for null
> parameters it will not send an xsi:type attribute,
> just xsi:null (note:
> this is a bug: it should send xsi:nil for the 2001
> schema).  Therefore,
> you must add a mapping to your service's deployment
> descriptor for every
> parameter name, e.g.
> 
>     <isd:map
>
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>              xmlns:x="" qname="x:s"
> 
>
xml2JavaClassName="org.apache.soap.encoding.soapenc.StringDeserializer"/
> >
> 
> Scott Nichol
> 
> ----- Original Message -----
> From: "Tim Dierks" <ti...@yahoo.com>
> To: <so...@xml.apache.org>
> Sent: Thursday, October 31, 2002 11:49 AM
> Subject: .NET client omits null arguments
> 
> 
> > I am having a problem with a .NET client omitting
> null
> > arguments from messages sent to my Apache SOAP
> (2.3.1)
> > service.  For example, SOAP service method
> signature
> > is:
> >
> >   public int myMethod(String arg1, String arg2);
> >
> > My .NET C# client makes an call to the SOAP
> service
> > like this:
> >
> >    int result = myMethod(arg1, null);
> >
> > If arg2 is null, then arg2 is left out altogether
> from
> > the message sent to my Apache SOAP service.  So
> Apache
> > SOAP generates a FAULT with the error "no
> signature
> > match", since it received only one argument
> instead of
> > two.
> >
> > Has anyone encountered this problem and figured
> out a
> > solution?
> >
> > Thanks,
> >
> > Tim Dierks
> >
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > HotJobs - Search new jobs daily now
> > http://hotjobs.yahoo.com/
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@xml.apache.org>
> > For additional commands, e-mail:
> <ma...@xml.apache.org>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@xml.apache.org>
> For additional commands, e-mail:
> <ma...@xml.apache.org>
> 



__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: .NET client omits null arguments

Posted by Scott Nichol <sn...@scottnichol.com>.
Here's the short of it:

1. You must use wsdl.exe to generate a proxy class for the service (or
write a proxy manually).  You cannot do "Add Web Reference", as that
re-generates the proxy code whenever you rebuild the project (VS.NET).

2. You must add a SoapElement attribute for each method parameter that
specifies the parameter is nullable, e.g.

    public String echoString([SoapElement("s", IsNullable=true)] String
s) {...}

3. .NET will now send an XML element for every parameter, but for null
parameters it will not send an xsi:type attribute, just xsi:null (note:
this is a bug: it should send xsi:nil for the 2001 schema).  Therefore,
you must add a mapping to your service's deployment descriptor for every
parameter name, e.g.

    <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
             xmlns:x="" qname="x:s"

xml2JavaClassName="org.apache.soap.encoding.soapenc.StringDeserializer"/
>

Scott Nichol

----- Original Message -----
From: "Tim Dierks" <ti...@yahoo.com>
To: <so...@xml.apache.org>
Sent: Thursday, October 31, 2002 11:49 AM
Subject: .NET client omits null arguments


> I am having a problem with a .NET client omitting null
> arguments from messages sent to my Apache SOAP (2.3.1)
> service.  For example, SOAP service method signature
> is:
>
>   public int myMethod(String arg1, String arg2);
>
> My .NET C# client makes an call to the SOAP service
> like this:
>
>    int result = myMethod(arg1, null);
>
> If arg2 is null, then arg2 is left out altogether from
> the message sent to my Apache SOAP service.  So Apache
> SOAP generates a FAULT with the error "no signature
> match", since it received only one argument instead of
> two.
>
> Has anyone encountered this problem and figured out a
> solution?
>
> Thanks,
>
> Tim Dierks
>
>
>
> __________________________________________________
> Do you Yahoo!?
> HotJobs - Search new jobs daily now
> http://hotjobs.yahoo.com/
>
> --
> To unsubscribe, e-mail:
<ma...@xml.apache.org>
> For additional commands, e-mail:
<ma...@xml.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: .NET client omits null arguments

Posted by Scott Nichol <sn...@scottnichol.com>.
Here's the short of it:

1. You must use wsdl.exe to generate a proxy class for the service (or
write a proxy manually).  You cannot do "Add Web Reference", as that
re-generates the proxy code whenever you rebuild the project (VS.NET).

2. You must add a SoapElement attribute for each method parameter that
specifies the parameter is nullable, e.g.

    public String echoString([SoapElement("s", IsNullable=true)] String
s) {...}

3. .NET will now send an XML element for every parameter, but for null
parameters it will not send an xsi:type attribute, just xsi:null (note:
this is a bug: it should send xsi:nil for the 2001 schema).  Therefore,
you must add a mapping to your service's deployment descriptor for every
parameter name, e.g.

    <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
             xmlns:x="" qname="x:s"

xml2JavaClassName="org.apache.soap.encoding.soapenc.StringDeserializer"/
>

Scott Nichol

----- Original Message -----
From: "Tim Dierks" <ti...@yahoo.com>
To: <so...@xml.apache.org>
Sent: Thursday, October 31, 2002 11:49 AM
Subject: .NET client omits null arguments


> I am having a problem with a .NET client omitting null
> arguments from messages sent to my Apache SOAP (2.3.1)
> service.  For example, SOAP service method signature
> is:
>
>   public int myMethod(String arg1, String arg2);
>
> My .NET C# client makes an call to the SOAP service
> like this:
>
>    int result = myMethod(arg1, null);
>
> If arg2 is null, then arg2 is left out altogether from
> the message sent to my Apache SOAP service.  So Apache
> SOAP generates a FAULT with the error "no signature
> match", since it received only one argument instead of
> two.
>
> Has anyone encountered this problem and figured out a
> solution?
>
> Thanks,
>
> Tim Dierks
>
>
>
> __________________________________________________
> Do you Yahoo!?
> HotJobs - Search new jobs daily now
> http://hotjobs.yahoo.com/
>
> --
> To unsubscribe, e-mail:
<ma...@xml.apache.org>
> For additional commands, e-mail:
<ma...@xml.apache.org>
>
>