Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / September 2004

Tip: Looking for answers? Try searching our database.

Attribute missing / not serialized

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eric - 12 Jul 2004 10:35 GMT
Hi,

I have a WS client. All the code is generated by VS.NET 2003.

For me its seems that an attribute is not generated during sending the
request in the SOAPHeader.
The problem is with RFCSendingValue.
There the attribute 'groupeid0 isn't generated in the SOAP request.

The proxy is generated this way:

----------------------------------------------------------------------------
---------
/// <remarks/>

public RFCSending RFCSendingValue;

public EFCSending EFCSendingValue;

[System.Web.Services.Protocols.SoapHeaderAttribute("RFCSendingValue",
Direction=System.Web.Services.Protocols.SoapHeaderDirection.In,
Required=true)]

[System.Web.Services.Protocols.SoapHeaderAttribute("EFCSendingValue",
Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out,
Required=true)]

[System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]

[return: System.Xml.Serialization.XmlArrayAttribute("EFCCase",
Namespace=http://www.)]

[return: System.Xml.Serialization.XmlArrayItemAttribute("cardIndex",
Namespace=http://www., IsNullable=false)]

public EFCCaseTypeCardIndex[]
identifyClient([System.Xml.Serialization.XmlArrayAttribute(Namespace=http://
www.)] [System.Xml.Serialization.XmlArrayItemAttribute("cardIndex",
Namespace=http://www., IsNullable=false)] RFCCaseTypeCardIndex[] RFCCase) {

object[] results = this.Invoke("identifyClient", new object[] { RFCCase});

return ((EFCCaseTypeCardIndex[])(results[0]));

}

[System.Xml.Serialization.XmlTypeAttribute(Namespace=http://www.xxx.ch)]

[System.Xml.Serialization.XmlRootAttribute(Namespace=http://www.xxx.ch,
IsNullable=false)]

public class RFCSending : sendingType {

/// <remarks/>

[System.Xml.Serialization.XmlArrayItemAttribute("cardIndex",
IsNullable=false)]

public RFCCaseTypeCardIndex[] RFCCase;

/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute("groupe-id")]

public int groupeid;

/// <remarks/>

[System.Xml.Serialization.XmlIgnoreAttribute()]

public bool groupeidSpecified;

}

The generated SOAP header looks like:

- <soap:Header>
- <RFCSending sending-date="2004-07-12T10:35:09.2208717+02:00"
sending-id="1" xmlns="http://www.ofac.ch/XEDO">
 <sender code="1" />
 <recipient code="4" />
 </RFCSending>
 </soap:Header>

It seems that only the attributes in the base class 'sendingType' are
generated. Why?

Thanks

Eric
Elena Kharitidi - 02 Sep 2004 07:12 GMT
I am going to guess here that the 'groupeid' attribute is defined in the
schema with use="optional" and type="xs:int", the schema type "int" will be
mapped to CLR primitive type System.Int32, which is a ValueType, so after
an instance of RFCSending is deserialized there is no way to tell if the
groupeid=".." attribute was present in the instance. XmlSerializer employs
xxxSpecified pattern to determine if the satellite xxx member was set or
not. When reading an instance of RFCSending, the groupeidSpecified member
will be set to "true" if the xml instance had the groupeid=".." attribute,
otherwise the value of the groupeidSpecified will be false.  Unfortunately
this means that user is burdened with responsibility of setting the
groupeidSpecified to true if he/she want is to be serialized:

    MyProxy x = new MyProxy();
    x.RFCSendingValue = new RFCSending();
    x.RFCSendingValue.groupeid = 555;
    x.RFCSendingValue. groupeidSpecified = true;

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.