Home All Groups Group Topic Archive Search About
Author
25 Oct 2006 10:56 AM
Eduardo Silva
Hi,

    I am doing a webservice base in a herarchy of classes and every thing is
working fine unlit the client ask me to have a value as an atribute of a
node and with the classes I only found the way to create nodes like that

<achievementSubmission



<passportNumber>"ABC123"</passportNumber>

<submissionReceipt>

<responseCode>XXX</responseCode>

<message>response message</message>

</submissionReceipt>



But thy wanted like that:



<achievementSubmission passportNumber="ABC123">

<submissionReceipt>

<responseCode>XXX</responseCode>

<message>response message</message>

</submissionReceipt>


I try other methods but when i try to return the xml I get a string at the
begining and the end of the xml

Any ideas??


Thank you very much


By the way this is the function i am using now...


<WebMethod()> _Public Function GetCandidateAchievement(ByVal candidateNumber
As String) As achievementSubmission
Dim achievementsInfo As achievementSubmission
Try
achievementsInfo = GetCandidateAchievementsFromDB(candidateNumber,
firstName, lastName, passportNo)
Return achievementsInfo
Catch
Dim AchievementsInfoEror As New achievementSubmission()
AchievementsInfoEror.submissionReceipt.responseCode = 900
AchievementsInfoEror.submissionReceipt.message = "err.description:" &
Err.Description & " - err.number:" & Err.Number & " - function:
GetCandidateAchievement"
Return AchievementsInfoEror
End Try

End Function

Author
25 Oct 2006 5:45 PM
Chris Dunaway
Eduardo Silva wrote:

Show quoteHide quote
>     I am doing a webservice base in a herarchy of classes and every thing is
> working fine unlit the client ask me to have a value as an atribute of a
> node and with the classes I only found the way to create nodes like that
>
> <achievementSubmission
>
>
>
> <passportNumber>"ABC123"</passportNumber>
>
>
> But thy wanted like that:
>
>
> <achievementSubmission passportNumber="ABC123">
>

In your achievementSubmission class, mark the passportNumber property
with the <XmlAttribute("passportNumber")> attribute.  That should cause
the serializer to serialize that property as an attribute instead of a
normal element.

Chris
Author
26 Oct 2006 3:00 PM
Eduardo Silva
Thanks a lot chris works perfect
Show quoteHide quote
"Chris Dunaway" <dunaw***@gmail.com> wrote in message
news:1161798313.662587.197450@b28g2000cwb.googlegroups.com...
> Eduardo Silva wrote:
>
>>     I am doing a webservice base in a herarchy of classes and every thing
>> is
>> working fine unlit the client ask me to have a value as an atribute of a
>> node and with the classes I only found the way to create nodes like that
>>
>> <achievementSubmission
>>
>>
>>
>> <passportNumber>"ABC123"</passportNumber>
>>
>>
>> But thy wanted like that:
>>
>>
>> <achievementSubmission passportNumber="ABC123">
>>
>
> In your achievementSubmission class, mark the passportNumber property
> with the <XmlAttribute("passportNumber")> attribute.  That should cause
> the serializer to serialize that property as an attribute instead of a
> normal element.
>
> Chris
>