.NET 1.1 consuming a web service with null types, what should I do?

I need to use WebService with .NET 1.1. The problem is that webService returns Null Values, and .NET 1.1 does not work with Nullable types.

WebService Schema Part

<xs:element name="SomeDate" type="xs:dateTime" nillable="true" /> <xs:element name="Email" type="xs:string" nillable="true" /> 

How could you use it? What approach would I use to solve this puzzle?

I can't even call WebService..Net 1.1 try to parse the null values ​​and the failure.

When we try to call WebService, it gives us the following exception:

The input string was not in the correct format.

Exception Details: System.FormatException: The input string was not in the 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: the input line was not in the correct format.]

System.Number.ParseInt32 (String s, NumberStyles style, NumberFormatInfo info) +0

System.Int32.Parse (String s, type NumberStyles, provider IFormatProvider) +37

System.Xml.XmlConvert.ToInt32 (String s)

+4
source share
4 answers

Perhaps you can add some additional controls to the VS proxy class or wsdl.exe automatically generates (C:\Projetos\PortalIO\Fontes\DotNet\Source\PortalIO\Web References\wsCentralClientes\Reference.cs)

+2
source

You can wrap your DateTime class (of any other value type that must be null) in the NullableDateTime class (as a reference type). This is not as good as the generic type, but should work even in .NET 1.1.

I have not tested it, but I just found a Nullable Type Library in Source Forge .

+3
source

You can write an intermediate service in .net 2 that supports this service. In other words, you write a service with the same interface, just change the fields with a null value to something else, and then in the service that you call the real service, massage the results and then return them to client 1.1.

+2
source

When you do something in .NET 1.x, there is only one way - the hard way (so sue me Lexus) Check http://msdn.microsoft.com/en-us/magazine/cc188761.aspx AND combine it with XSLT (available in 1.x IIRC) to rewrite the definition according to the deserializer.

+1
source

Source: https://habr.com/ru/post/1380072/


All Articles