473,837 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling a web service with nillable Value Types

Hi!

I'm calling a web service using C# and a wrapper class generated by
wsdl tool. The web service specification contains some nillable
parameters which types are Value Types in .NET (long, int, Decimal,
....) and I must to send them as null, and not their default value. It
is possible? Is there any trick to succeed it?

Thanks in advance,

Marc.
Nov 21 '05 #1
8 7193
check this out for a possible answer

http://www.mcse.ms/message908331.html
Nov 21 '05 #3
Thanks a lot for your response, I've tried to put the new parameter
(xxxSpecified) in the class and the solutions builds correctly. But
when I try to execute, at the moment I create the class which inherits
from System.Web.Serv ices.Protocols. SoapHttpClientP rotocol, .NET
debugger throws me the following exception:

"Excepción no controlada del tipo 'System.IO.File NotFoundExcepti on' en
mscorlib.dll

Información adicional: File or assembly name a4fnoqyx.dll, or one of
its dependencies, was not found."

The name of DLL is always different.

I think that I can't modify the wrapper class generated by WSDL, but
then how can I send null Value Types to the web service?

Thanks again for our attention,

Marc.

di****@online.m icrosoft.com (dino chiesa) wrote in message news:<vb******* *******@cpmsftn gxa10.phx.gbl>. ..
check this out for a possible answer

http://www.mcse.ms/message908331.html
--

Nov 21 '05 #4
Doc,

do me a favor.
Examine the Schema that is enclosed at the bottom of this message, you will
see that the data elements are attributed with:
minOccurs="0" nillable="true"

When these data elements are "nil", the XML is not passed at all.
Run that schema through the schema tool (xsd.exe) with the /c switch, and
look at what you get. The programming model is then :

if (o.IDSpecified) {
// ID was specified
}
else {
// ID was null (the element was not specified at all)
}

--
Now, if an element in your schema includes minOccurs="1" nillable="true" ,
then you have a trickier situation. In this case valid XML may be
something like:
<DataElement xsi:nil="true" />

That is, the DataElement is specified, but no value for it is passed. In
this case the default behavior of the XML serializer in .NET is to choke.
The classes you generate (either through xsd.exe, wsdl.exe, or Add Web Ref
in Visual Studio) will not properly handle these cases. To deal with this,
You need to do some special handling in the class.

For this I direct you to an example that illustrates the workaround.
http://www.winisp.net/cheeso/srcview...n&file=XsiNilD
ate.cs

---

The FileNotFound problem seems like it is a different issue. It can occur
for a number of reasons.
Can we see the WSDL you are using?

-Dino
--------schema starts here -------
<schema
elementFormDefa ult="qualified"
targetNamespace ="urn:The-Schema-target-namespace"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/2001/XMLSchema"


<element name="Type1">
<complexType>
<sequence>
<element minOccurs="0" maxOccurs="1" name="ID" nillable="true"
type="xsd:int" />
<element minOccurs="0" maxOccurs="1" name="Stamp" nillable="true"
type="xsd:dateT ime" />
<element minOccurs="0" maxOccurs="1" name="Amount" nillable="true"
type="xsd:decim al" />
</sequence>
</complexType>
</element>

</schema>

-------- schema ends here ---------------------
Nov 21 '05 #5
Hi Dino,

I've send (by email) the wsdl url and the class generated by wsdl tool
in my computer. You will see that WSDL haven't generated the
xxxSpecified attribute for every nillable attribute. So, I can send
null values for the attributes like long, int, ... When I try to write
manually the attributes (xxxSpecified), then the execution throws me
an error (which is mentioned in a previous message,
FileNotFoundExc eption).

So, my question is, how can I modify manually the class generated by
wsdl in order to serialize null Value Types needed for the web
service?

Thanks again,

Marc.
Nov 21 '05 #6
Hi again dino,

I've tried to send you a message with the wsdl url and other info, but
I suppose your email address isn't reachable. Well I'll post it in
this newsgroup:

The wsdl url is http://was.test.fiatc.es/autos/services/wsAutos?wsdl
and the class generated by wsdl tool (.NET Framework Version
1.1.4322.573) is at end of the message with the log generated.

--
Looking the class, for example the field polizaSubstitui da, is
<element name="polizaSub stituida" nillable="true" type="xsd:long" />
the field generated is
public long polizaSubstitui da;

when I add the following field in AutosServiceSer vice.cs
[System.Xml.Seri alization.XmlIg noreAttribute()]
public bool polizaSubstitui daSpecified;

then when I try to create the class AutosServiceSer vice
AutosServiceSer vice ass = new AutosServiceSer vice();

the application throws me the exception
Excepción no controlada del tipo 'System.IO.File NotFoundExcepti on' en
mscorlib.dll

Información adicional: File or assembly name x9udkba3.dll, or one of
its dependencies, was not found.

but without the xxxSpecified field the application works fine (well it
can't send null values :-(). What can I do?

Thanks a lot,

Marc.

<---- WSDL output message starts here ---->
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 1.1.4322.573]
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Schema validation warning: Namespace
'http://was.test.fiatc. es/autos/services/wsAutos' is not available to
be referenced in this schema.
Schema validation warning: Namespace
'http://was.test.fiatc. es/autos/services/wsAutos' is not available to
be referenced in this schema.
Schema validation warning: Namespace
'http://was.test.fiatc. es/autos/services/wsAutos' is not available to
be referenced in this schema.
Schema validation warning: Namespace
'http://was.test.fiatc. es/autos/services/wsAutos' is not available to
be referenced in this schema.
Schema validation warning: Namespace
'urn:contratar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:contratar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:contratar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:contratar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:contratar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:contratar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:contratar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:contratar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:contratar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:contratar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:contratar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:tarificar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:tarificar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:tarificar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:tarificar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:tarificar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:tarificar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:tarificar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:tarificar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'urn:tarificar. beans.autos.fia tc.es' is not available to be referenced
in this schema.
Writing file 'D:\mtomas\proj ects\Tarificado rs\test\AutosSe rviceService.cs '.
<---- WSDL output message ends here ---->
<---- Generated class starts here ---->
//------------------------------------------------------------------------------
// <autogenerate d>
// This code was generated by a tool.
// Runtime Version: 1.1.4322.573
//
// Changes to this file may cause incorrect behavior and will be
lost if
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------

//
// This source code was auto-generated by wsdl, Version=1.1.432 2.573.
//
using System.Diagnost ics;
using System.Xml.Seri alization;
using System;
using System.Web.Serv ices.Protocols;
using System.Componen tModel;
using System.Web.Serv ices;
/// <remarks/>
[System.Diagnost ics.DebuggerSte pThroughAttribu te()]
[System.Componen tModel.Designer CategoryAttribu te("code")]
[System.Web.Serv ices.WebService BindingAttribut e(Name="wsAutos SoapBinding",
Namespace="http ://was.test.fiatc. es/autos/services/wsAutos")]
[System.Xml.Seri alization.SoapI ncludeAttribute (typeof(Garanti a))]
[System.Xml.Seri alization.SoapI ncludeAttribute (typeof(ErrorAu tos))]
public class AutosServiceSer vice :
System.Web.Serv ices.Protocols. SoapHttpClientP rotocol {

/// <remarks/>
public AutosServiceSer vice() {
this.Url = "http://was.test.fiatc. es/autos/services/wsAutos";
}

/// <remarks/>
[System.Web.Serv ices.Protocols. SoapRpcMethodAt tribute("",
RequestNamespac e="http://autos.fiatc.es" ,
ResponseNamespa ce="http://was.test.fiatc. es/autos/services/wsAutos")]
[return: System.Xml.Seri alization.SoapE lementAttribute ("tarificaRetur n")]
public RespuestaTarifi cacion tarifica(Petici onTarificacion
peticion) {
object[] results = this.Invoke("ta rifica", new object[] {
peticion});
return ((RespuestaTari ficacion)(resul ts[0]));
}

/// <remarks/>
public System.IAsyncRe sult Begintarifica(P eticionTarifica cion
peticion, System.AsyncCal lback callback, object asyncState) {
return this.BeginInvok e("tarifica", new object[] {
peticion}, callback, asyncState);
}

/// <remarks/>
public RespuestaTarifi cacion Endtarifica(Sys tem.IAsyncResul t
asyncResult) {
object[] results = this.EndInvoke( asyncResult);
return ((RespuestaTari ficacion)(resul ts[0]));
}

/// <remarks/>
[System.Web.Serv ices.Protocols. SoapRpcMethodAt tribute("",
RequestNamespac e="http://autos.fiatc.es" ,
ResponseNamespa ce="http://was.test.fiatc. es/autos/services/wsAutos")]
[return: System.Xml.Seri alization.SoapE lementAttribute ("contrataRetur n")]
public RespuestaContra tacion contrata(Petici onContratacion
peticion) {
object[] results = this.Invoke("co ntrata", new object[] {
peticion});
return ((RespuestaCont ratacion)(resul ts[0]));
}

/// <remarks/>
public System.IAsyncRe sult Begincontrata(P eticionContrata cion
peticion, System.AsyncCal lback callback, object asyncState) {
return this.BeginInvok e("contrata", new object[] {
peticion}, callback, asyncState);
}

/// <remarks/>
public RespuestaContra tacion Endcontrata(Sys tem.IAsyncResul t
asyncResult) {
object[] results = this.EndInvoke( asyncResult);
return ((RespuestaCont ratacion)(resul ts[0]));
}
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("P eticionTarifica cion",
"urn:autos.fiat c.es")]
public class PeticionTarific acion {

/// <remarks/>
public BonusMalus bonusMalus;

/// <remarks/>
public Conductores conductores;

/// <remarks/>
public Control control;

/// <remarks/>
public DescuentosDirec tos descuentosDirec tos;

/// <remarks/>
public GarantiasOpcion ales garantiasOpcion ales;

/// <remarks/>
public General general;

/// <remarks/>
public Vehiculo vehiculo;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("B onusMalus",
"urn:tarificar. beans.autos.fia tc.es")]
public class BonusMalus {

/// <remarks/>
public string codigoDgsCia;

/// <remarks/>
public System.Decimal dtoDanos;

/// <remarks/>
public System.Decimal dtoRC;

/// <remarks/>
public string nivelDanos;

/// <remarks/>
public string nivelRC;

/// <remarks/>
public string sincoNIF;

/// <remarks/>
public string sincoPoliza;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("M ensajesContrata cion",
"urn:contratar. beans.autos.fia tc.es")]
public class MensajesContrat acion {

/// <remarks/>
public ErrorAutos[] errores;

/// <remarks/>
public string[] tareas;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("E rrorAutos",
"urn:beans.auto s.fiatc.es")]
public class ErrorAutos {

/// <remarks/>
public string codError;

/// <remarks/>
public string textoError;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("D atosRecibo",
"urn:contratar. beans.autos.fia tc.es")]
public class DatosRecibo {

/// <remarks/>
public System.Decimal consorcio;

/// <remarks/>
public System.DateTime fechaEfecto;

/// <remarks/>
public System.DateTime fechaVencimient o;

/// <remarks/>
public System.Decimal fondoMutual;

/// <remarks/>
public System.Decimal impuestos;

/// <remarks/>
public System.Decimal ips;

/// <remarks/>
public long numPoliza;

/// <remarks/>
public System.Decimal prima;

/// <remarks/>
public System.Decimal totalRecibo;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("G arantia",
"urn:contratar. beans.autos.fia tc.es")]
public class Garantia {

/// <remarks/>
public System.Decimal comisionCantida d;

/// <remarks/>
public System.Decimal comisionPorcent aje;

/// <remarks/>
public System.Decimal consorcio;

/// <remarks/>
public System.Decimal impuestos;

/// <remarks/>
public string nombre;

/// <remarks/>
public System.Decimal prima;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("D atosComisiones" ,
"urn:contratar. beans.autos.fia tc.es")]
public class DatosComisiones {

/// <remarks/>
public Garantia[] garantias;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("R espuestaContrat acion",
"urn:autos.fiat c.es")]
public class RespuestaContra tacion {

/// <remarks/>
public DatosComisiones datosComisiones ;

/// <remarks/>
public DatosRecibo datosRecibo;

/// <remarks/>
public MensajesContrat acion mensajes;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("V ehiculo",
"urn:contratar. beans.autos.fia tc.es")]
public class Vehiculo1 {

/// <remarks/>
public string claseMatricula;

/// <remarks/>
public string desExtrasAudio;

/// <remarks/>
public string desExtrasNoAudi o;

/// <remarks/>
public string matricula;

/// <remarks/>
public bool remolque;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("T omador",
"urn:contratar. beans.autos.fia tc.es")]
public class Tomador {

/// <remarks/>
public string apellido1;

/// <remarks/>
public string apellido2;

/// <remarks/>
public string codPostal;

/// <remarks/>
public string domicilio;

/// <remarks/>
public string email;

/// <remarks/>
public string estadoCivil;

/// <remarks/>
public System.DateTime fechaNacimiento ;

/// <remarks/>
public string idPoblacion;

/// <remarks/>
public string idioma;

/// <remarks/>
public string nifCif;

/// <remarks/>
public string nombre;

/// <remarks/>
public string numDomicilio;

/// <remarks/>
public int numHijos;

/// <remarks/>
public string piso;

/// <remarks/>
public string sexo;

/// <remarks/>
public string telefono;

/// <remarks/>
public string tipoVia;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("P ropietario",
"urn:contratar. beans.autos.fia tc.es")]
public class Propietario {

/// <remarks/>
public string apellido1;

/// <remarks/>
public string apellido2;

/// <remarks/>
public System.DateTime fechaNacimiento ;

/// <remarks/>
public System.DateTime fechaPermiso;

/// <remarks/>
public string nifCif;

/// <remarks/>
public string nombre;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("G eneral",
"urn:contratar. beans.autos.fia tc.es")]
public class General1 {

/// <remarks/>
public System.DateTime fechaEfecto;

/// <remarks/>
public System.DateTime fechaVencimient o;

/// <remarks/>
public int modalidad;

/// <remarks/>
public string refPeticion;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("D atosBancarios",
"urn:contratar. beans.autos.fia tc.es")]
public class DatosBancarios {

/// <remarks/>
public string control;

/// <remarks/>
public string cuenta;

/// <remarks/>
public string entidad;

/// <remarks/>
public string oficina;

/// <remarks/>
public string primerRecibo;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("C ontrol",
"urn:contratar. beans.autos.fia tc.es")]
public class Control1 {

/// <remarks/>
public string idiomaInterface ;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("C onductores",
"urn:contratar. beans.autos.fia tc.es")]
public class Conductores1 {

/// <remarks/>
public string habitualApellid o1;

/// <remarks/>
public string habitualApellid o2;

/// <remarks/>
public string habitualEstadoC ivil;

/// <remarks/>
public string habitualNif;

/// <remarks/>
public string habitualNombre;

/// <remarks/>
public int habitualProfesi on;

/// <remarks/>
public string habitualSexo;

/// <remarks/>
public string ocasionalApelli do1;

/// <remarks/>
public string ocasionalApelli do2;

/// <remarks/>
public string ocasionalEstado Civil;

/// <remarks/>
public string ocasionalNif;

/// <remarks/>
public string ocasionalNombre ;

/// <remarks/>
public int ocasionalProfes ion;

/// <remarks/>
public string ocasionalSexo;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("B eneficiarios",
"urn:contratar. beans.autos.fia tc.es")]
public class Beneficiarios {

/// <remarks/>
public string danos;

/// <remarks/>
public string ocupantes;

/// <remarks/>
public string retiradaCarnet;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("P eticionContrata cion",
"urn:autos.fiat c.es")]
public class PeticionContrat acion {

/// <remarks/>
public Beneficiarios beneficiarios;

/// <remarks/>
public Conductores1 conductores;

/// <remarks/>
public Control1 control;

/// <remarks/>
public DatosBancarios datosBancarios;

/// <remarks/>
public General1 general;

/// <remarks/>
public Propietario propietario;

/// <remarks/>
public Tomador tomador;

/// <remarks/>
public Vehiculo1 vehiculo;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("M ensajesTarifica cion",
"urn:tarificar. beans.autos.fia tc.es")]
public class MensajesTarific acion {

/// <remarks/>
public ErrorAutos[] errores;

/// <remarks/>
public string refPeticion;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("D atosNumericos",
"urn:tarificar. beans.autos.fia tc.es")]
public class DatosNumericos {

/// <remarks/>
public System.Decimal terceros;

/// <remarks/>
public System.Decimal tercerosIncendi o;

/// <remarks/>
public System.Decimal tercerosPerTota l;

/// <remarks/>
public System.Decimal tercerosRobo;

/// <remarks/>
public System.Decimal tercerosRoboInc iendio;

/// <remarks/>
public System.Decimal tercerosRoboPer Total;

/// <remarks/>
public System.Decimal todoRiesgo;

/// <remarks/>
public System.Decimal todoRiesgo1250;

/// <remarks/>
public System.Decimal todoRiesgo1800;

/// <remarks/>
public System.Decimal todoRiesgo200;

/// <remarks/>
public System.Decimal todoRiesgo2500;

/// <remarks/>
public System.Decimal todoRiesgo3050;

/// <remarks/>
public System.Decimal todoRiesgo400;

/// <remarks/>
public System.Decimal todoRiesgo450;

/// <remarks/>
public System.Decimal todoRiesgo54;

/// <remarks/>
public System.Decimal todoRiesgo6050;

/// <remarks/>
public System.Decimal todoRiesgo650;

/// <remarks/>
public System.Decimal todoRiesgo90;

/// <remarks/>
public System.Decimal todoRiesgo900;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("R espuestaTarific acion",
"urn:autos.fiat c.es")]
public class RespuestaTarifi cacion {

/// <remarks/>
public DatosNumericos datosNumericos;

/// <remarks/>
public MensajesTarific acion mensajes;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("V ehiculo",
"urn:tarificar. beans.autos.fia tc.es")]
public class Vehiculo {

/// <remarks/>
public string cpCirculacion;

/// <remarks/>
public System.Decimal extrasAudio;

/// <remarks/>
public System.Decimal extrasResto;

/// <remarks/>
public System.DateTime fechaMatricula;

/// <remarks/>
public long marcaB7;

/// <remarks/>
public long modeloB7;

/// <remarks/>
public System.Decimal toneladasPlazas ;

/// <remarks/>
public long uso;

/// <remarks/>
public System.Decimal valor;

/// <remarks/>
public long versionB7;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("G eneral",
"urn:tarificar. beans.autos.fia tc.es")]
public class General {

/// <remarks/>
public System.DateTime fechaCalculo;

/// <remarks/>
public string formaPago;

/// <remarks/>
public long polizaSubstitui da;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("G arantiasOpciona les",
"urn:tarificar. beans.autos.fia tc.es")]
public class GarantiasOpcion ales {

/// <remarks/>
public bool asistenciaViaje ;

/// <remarks/>
public bool defensaExcluida ;

/// <remarks/>
public string lunas;

/// <remarks/>
public System.Decimal ocupCapitalInva lidez;

/// <remarks/>
public System.Decimal ocupCapitalMuer te;

/// <remarks/>
public int ocupNumero;

/// <remarks/>
public System.Decimal rcCargaCapital;

/// <remarks/>
public bool rcCargaMaquina;

/// <remarks/>
public System.Decimal retCarnetCapita l;

/// <remarks/>
public int retCarnetDuraci on;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("D escuentosDirect os",
"urn:tarificar. beans.autos.fia tc.es")]
public class DescuentosDirec tos {

/// <remarks/>
public System.Decimal asistenciaViaje ;

/// <remarks/>
public System.Decimal danosPropios;

/// <remarks/>
public System.Decimal defensaExtranje ro;

/// <remarks/>
public System.Decimal defensaNacional ;

/// <remarks/>
public System.Decimal lunas;

/// <remarks/>
public System.Decimal ocupantes;

/// <remarks/>
public System.Decimal rcCarga;

/// <remarks/>
public System.Decimal rco;

/// <remarks/>
public System.Decimal rcv;

/// <remarks/>
public System.Decimal reclamacion;

/// <remarks/>
public System.Decimal retiradaCarnet;

/// <remarks/>
public System.Decimal robo;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("C ontrol",
"urn:tarificar. beans.autos.fia tc.es")]
public class Control {

/// <remarks/>
public string codigoControl;

/// <remarks/>
public bool empleado;

/// <remarks/>
public string idiomaInterface ;

/// <remarks/>
public string mediador;

/// <remarks/>
public string oficina;

/// <remarks/>
public string usuario;
}

/// <remarks/>
[System.Xml.Seri alization.SoapT ypeAttribute("C onductores",
"urn:tarificar. beans.autos.fia tc.es")]
public class Conductores {

/// <remarks/>
public System.DateTime habitualFechaNa cimiento;

/// <remarks/>
public System.DateTime habitualFechaPe rmiso;

/// <remarks/>
public bool habitualPermiso CD;

/// <remarks/>
public System.DateTime ocasionalFechaN acimiento;

/// <remarks/>
public System.DateTime ocasionalFechaP ermiso;

/// <remarks/>
public bool ocasionalPermis oCD;
}
<---- Generated class ends here ---->
Nov 21 '05 #7
Ya you modify the class to send nulls. I use attributes on the data
types to change how they are serialized. There is some decent
documentation which describes all the possible attributes you can use to
modify the serialized output.

scalars i use [System.Componen tModel.DefaultV alueAttribute(0 )]
datetime i use
[System.Componen tModel.DefaultV alueAttribute(t ypeof(System.Da teTime),"")]
for everything else i use
[System.Xml.Seri alization.XmlEl ementAttribute( IsNullable=true )]

seems to work pretty well hope this helps ya!

steve

Marc wrote:
Hi Dino,

I've send (by email) the wsdl url and the class generated by wsdl tool
in my computer. You will see that WSDL haven't generated the
xxxSpecified attribute for every nillable attribute. So, I can send
null values for the attributes like long, int, ... When I try to write
manually the attributes (xxxSpecified), then the execution throws me
an error (which is mentioned in a previous message,
FileNotFoundExc eption).

So, my question is, how can I modify manually the class generated by
wsdl in order to serialize null Value Types needed for the web
service?

Thanks again,

Marc.

Nov 21 '05 #8
Thanks for your response, but it doesn't solve my problem, for the
scalars I don't want to send 0, I want to send null, nothing, 0 is a
value and the web service process this value....

Moreover I can't modify the class, when I modify the class (generated
by wsdl), then it doesn't work anymore.

Thanks again,

Marc.

steve terapak <st************ *@mitchell.com> wrote in message news:<OB******* *******@tk2msft ngp13.phx.gbl>. ..
Ya you modify the class to send nulls. I use attributes on the data
types to change how they are serialized. There is some decent
documentation which describes all the possible attributes you can use to
modify the serialized output.

scalars i use [System.Componen tModel.DefaultV alueAttribute(0 )]
datetime i use
[System.Componen tModel.DefaultV alueAttribute(t ypeof(System.Da teTime),"")]
for everything else i use
[System.Xml.Seri alization.XmlEl ementAttribute( IsNullable=true )]

seems to work pretty well hope this helps ya!

steve

Marc wrote:
Hi Dino,

I've send (by email) the wsdl url and the class generated by wsdl tool
in my computer. You will see that WSDL haven't generated the
xxxSpecified attribute for every nillable attribute. So, I can send
null values for the attributes like long, int, ... When I try to write
manually the attributes (xxxSpecified), then the execution throws me
an error (which is mentioned in a previous message,
FileNotFoundExc eption).

So, my question is, how can I modify manually the class generated by
wsdl in order to serialize null Value Types needed for the web
service?

Thanks again,

Marc.

Nov 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
4992
by: Christian Wilhelm | last post by:
Hi! I'm trying to call a Java WebService out of a .net Client. There are two Methods, one Method requires one Parameter of type Parameter, the other Method requires one Parameter of type Parameter. I can call the first Method without Problems, the Parameter can be deserialized by the WebService. But if I want to call the second Method and give it an Array of Parameters, then the following exception is thrown by the WebService:...
3
5081
by: Jerome Cohen | last post by:
AI am trying to call a third-party web service. this service expects an XML fragment that contains the request plus other parameter. adding the web reference created the syntax below(reference.vb). I changed the data type for the structure that contains the XML data from the default "String" to "xml.xmldocument" to enable easy filling of the data. my client code creates an XML document class, fills the data using standard xml dom...
7
3098
by: Jorgen Haukland, Norway | last post by:
Hi, I have created a Java webservice which runs in IBM WebSphere appserver. I take the WSDL-file and create a VS.NET WinForm application and calls the service running on my PC and everything works fine. So I deploy the webservice on a remote machine (Linux box) and I get an error when calling the service. BUT: I can retrieve the WSDL and make a webreference in my VS.NET project, so obviously I (or more correct: My VS.NET project) am...
2
2761
by: yqlu | last post by:
I hava developed a client in C# that is connected to a 3-party XML Web Services developed in Java based on the AXIS 1.1. Most methods call are successful except for one method named "findObjects" and return a complex type "FieldSearchResult". The error message as following : "Cannot assign object of type System.String to an object of type System.String. There is an error in XML document (23, 97)." By the way,I hava written a client in Java...
4
1980
by: leslie_tighe | last post by:
Hello, I have a webservice running on a J2EE server created with Axis 1.2.. I have a client that I am building in .net that needs to consume this webserivce and am having a bit of trouble. I have pasted the wsdl below and have a created a class in VB.net by adding a web refrence to my project. What is odd is that I can successfully call methods that return a simple value like a string. I call also call methods that add an object....
3
3151
by: GT | last post by:
I have a .NET client that consumes an Axis web service. A change was made recently to the AXIS web service, and ever since then my .NET proxy class has been throwing an InvalidCastException. The proxy class was auto-generated by Visual Studio from WSDL provided by people who provide the Axis service, and I have not modified it (except to add code for a build that includes a SOAP trace). The only difference I see in the messages is that...
8
2780
by: Duffcase | last post by:
Hi. I'm having some problems consuming a webservice. The server keeps complaining about the wrong element beeing sent.. I have this method that takes two strings String_1 and String_2 The server expects to get String_1 first, but somehow my client (C# .net cf) sends String_2 first.. On top of that, If i build solution and run the .exe file, it works fine.
5
4442
by: Daythryl | last post by:
I've got some VB code that's supposed to retrieve a Map from a Web Service written in Java, running under Tomcat via Axis-1.4. I'll list the WSDL, the response message and the source code below. My problem is that while the response contains actual data, the call to Invoke() returns Nothing. I'm hoping someone can tell me why. Thanks in advance. WSDL (i hope stripped down to about the bare minimum): <?xml version="1.0"...
0
2847
by: =?ISO-8859-1?Q?Jan_Thom=E4?= | last post by:
Hi, I've been trying like a madman to make my WSDL work with .net, but it seems I am out of luck. Whenever I add a service reference to Visual C#, the code gets generated fine, however all operations miss their parameters, which is very weird. I have stripped down the WSDL to an example of a singe simple function. Before I post all the WSDL, here is what I tried. I loaded the WSDL using the "add service reference" function. I got code...
0
9678
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10609
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10263
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9390
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7798
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6987
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5663
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4468
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3120
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.