• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
2310 b xd
 

2310 b xd

on

  • 539 views

 

Statistics

Views

Total Views
539
Views on SlideShare
538
Embed Views
1

Actions

Likes
0
Downloads
10
Comments
0

1 Embed 1

http://cybage.krazykoder.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    2310 b xd 2310 b xd Presentation Transcript

    • Appendix D: XML Web Service Responses
    • Lesson: XML Web Service Responses
      • XML Web Service Responses
      • Default Formatted XML Web Service Responses
      • Reshaping XML Web Service Responses
      • Demonstration: Reshaping XML Web Service Responses
    • XML Web Service Responses
      • Web services respond to direct HTTP-GET calls with simple XML documents
      • Web services respond to application-to-application calls with SOAP envelopes
        • Envelope definition
        • Encoding rules
        • RPC representation
        • Protocol bindings
    • Default Formatted XML Web Service Responses <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <ArrayOfContact> <Contact>   <name>Janet</name>   <address>Seattle, WA</address>   </Contact> <Contact>   <name>Joe</name>   <address>Attleboro, MA</address>   </Contact> </ArrayOfContact>
      • XML Web service code for an array
      • Resulting XML data
      Public Structure Contact Public name As String Public address As String End Structure <WebMethod()>Public Function _ GetContacts() As Contact() Dim x(1) As Contact x(0).name = &quot;Janet&quot; x(0).address = &quot;Seattle, WA&quot; x(1).name = &quot;Joe&quot; x(1).address = &quot;Attleboro, MA&quot; Return x End Function public struct Contact { public string name; public string address; } [WebMethod()]public Contact[] GetContacts() { Contact[] x; x = new Contact[2]; x[0].name = &quot;Janet&quot;; x[0].address = &quot;Seattle, WA&quot;; x[1].name = &quot;Joe&quot;; x[1].address = &quot;Attleboro, MA&quot;; return x; }
    • Reshaping XML Web Service Responses
      • XML Web service revised code
      • Resulting XML response
      <XmlType(&quot;MyContact&quot;)>Public Structure Contact <XmlAttributeAttribute(&quot;ContactName&quot;)> _ Public name As String <XmlAttributeAttribute(&quot;ContactAddress&quot;)> _ Public address As String End Structure <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <ArrayOfMyContact>   <MyContact ContactName=&quot;Janet&quot; ContactAddress=&quot;Seattle, WA&quot; />   <MyContact ContactName =&quot;Joe&quot; ContactAddress=&quot;Attleboro, MA&quot; /> </ArrayOfMyContact> [XmlType(&quot;MyContact&quot;)]public struct Contact{ [XmlAttributeAttribute(&quot;ContactName&quot;)] public string name; [XmlAttributeAttribute(&quot;ContactAddress&quot;)] public String address; }
    • Demonstration: Reshaping XML Web Service Responses
      • Add a Web method that returns a list of contacts (structure)
      • Reshape the returned XML