I need to consume a WebService with .NET 1.1. The problem is that the webService return Null Values, and .NET 1.1 doesn't work with Nullable types.
A piece of the WebService Schema
<xs:element name="SomeDate" type="xs:dateTime" nillable="true" />
<xs:element name="Email" type="xs:string" nillable="true" />
How could you consume it? Wich approach would I use to solve this puzzle?
I can't even Invoke the webService. .Net 1.1 try to parse the null values, and crash.
When we try to invoke the WebService, it give us the exception below:
Input string was not in a correct format.
Exception Details: System.FormatException: Input string was not in a correct format.
Line 75: [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://mysite.com/Clientes/ConsultaCliente", RequestNamespace="http://mysite.com/Clientes/", ResponseNamespace="http://mysite.com/Clientes/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
Line 76: public Clientes ConsultaCliente(ParametrosConsultaClientes parametros) {
Line 77: object[] results = this.Invoke("ConsultaCliente", new object[] {
Line 78: parametros});
[FormatException: Input string was not in a correct format.]
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +0
System.Int32.Parse(String s, NumberStyles style, IFormatProvider provider) +37
System.Xml.XmlConvert.ToInt32(String s)
You could wrap your DateTime
class (of any other value type that has to be nullable) into a NullableDateTime
class (as a reference type). It's not so nice as a generic type but should work even in .NET 1.1.
I didn't test it but I just found a Nullable Type Library on Source Forge.
Maybe you can add some extra controls to the proxy class VS
or wsdl.exe
automatically generates (C:\Projetos\PortalIO\Fontes\DotNet\Source\PortalIO\Web References\wsCentralClientes\Reference.cs)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With