webservice function

E

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
 
C

Chris Dunaway

Eduardo said:
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
 
E

Eduardo Silva

Thanks a lot chris works perfect
Chris Dunaway said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top