Silverlight Web Service FAQ: ข้อจำกัดของ web service ใน Silverlight 2

תשובה Silverlight Web Service FAQ: ข้อจำกัดของ web service ใน Silverlight 2

ตอบทั้งหมด

  • 13 กุมภาพันธ์ 2555 9:01
    ผู้ดูแล
     
     คำตอบ


    สำหรับSOAP:



    Silverlight 2 จะซับพอร์ต feature ส่วนใหญ่ของ SOAP 1.1 และWS-I Basic Profile 1.0 แต่ไม่ซับพอร์ตSOAP 1.2 หรือเวอร์ชั่นที่สูงกว่านั้น
    เช่น
    WS-Security และWS-Addressing จะไม่ซับพอร์ต

    ถ้าต้องใช้งานร่วมกับ
    WCF ให้ใช้BasicHttpBinding และmark type เป็นแบบDataContract/Member เพื่อให้สามารถใช้ด้วยกันได้

    ถ้าต้องการใช้งานร่วมกับ
    ASMX/Java/PHP จะต้องดูว่า service สามารถใช้งานได้กับ SOAP 1.1 และ WS-I Basic Profile 1.0 หรือไม่ ยกตัวอย่างเช่น จะไม่มีการใช้
    DataSet



    Silverlight 3 จะเพิ่มการซับพอร์ต SOAP1.2 และWS-Addressing เช่นเดียวกับ Binary XML format (CustomBinding ด้วย binaryMessageEncoding และhttp/https Transport binding elements) นอกจากนี้ ยังมีsubset ย่อยๆ ของ WS-Security ที่ได้รับการซับพอร์ต คือ

    Username/Password tokens (BasicHttpBinding ในโหมดของ TransportWithMessageCredentials)



    สำหรับREST:



    Silverlight 2 จะซับพอร์ต GET และPOST

    และ
    http feature บางอันจะไม่สามารถใช้งานได้ เช่น http header บางอันจะไม่ซับพอร์ต Authentication



    XML message body จะไม่ซับพอร์ตการใช้ XmlSerializer หรือการใช้ LINQ-to-XML (System.Xml.Linq.XElement class)

    เพื่อที่จะใช้
    XmlSerializer เราอาจจะต้องทำการ generate แบบ automatic จาก sample XML
    โดยใช้การ “Paste XML as Types” เพื่อ add-in เข้าใน Visual Studio

    ข้อมูลเพิ่มเติม
    WCF REST Starter Kit



    JSON message body จะซับพอร์ตการใช้ DataContractJsonSerializer หรือการใช้ LINQ-to-JSON (System.Json.JsonValue class) สำหรับ RSS และ
    Atom message bod
    y ก็สามารถแยกเป็น XML ได้ หรือสามารถใช้ System.ServiceModel.Syndication ได้



    Supa Sethasiripong [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • ทำเครื่องหมายเป็นคำตอบโดย supa_sModerator 14 กุมภาพันธ์ 2555 7:01
    •