none
Class with XmlSchemaProviderAttribute like DataTable in any [WebMethod] forces serialization of the whole service with IsWrapped=true RRS feed

  • Question

  • Help needed,

    who can explain to me, why this happens?

    What are the benefits and drawbacks of using wrapped serialization? 

    I extended an existing WebService and removed the only one [WebMethod] that referenced the System.Data.DataTable.

    After updating the web Service reference for the web client the whoole service changed dramatically.

    All web services data are now serialized with IsWrapped=false and have body classes and generic Array-types.

    Which attribute I have to use in the web service tho force the IsWrapped=true generation of the service reference?

    I will not rewrite the whoole client code.

    (Up to now I added an empty Method that Returns a DataTable....)

    Regards

    Roman

    Tuesday, February 25, 2014 10:13 AM

Answers

  • Hi,

    >>Which attribute I have to use in the web service tho force the IsWrapped=true generation of the service reference?

    In the web service, the WebMethod parameter named ParameterStyle, which is used by the XmlSerializer in ASMX services. Then if you wan to prevent wrapping, you set the ParameterStyle to Bare. You can also force wrapping by using a ParameterStyle value of Wrapped.

    Then for the difference betwwen them, please try to check the following:
    http://stackoverflow.com/questions/5324051/webservices-bare-vs-wrapped .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Roman csharp Wednesday, February 26, 2014 9:26 AM
    Wednesday, February 26, 2014 8:20 AM
    Moderator

All replies

  • Hi,

    >>Which attribute I have to use in the web service tho force the IsWrapped=true generation of the service reference?

    In the web service, the WebMethod parameter named ParameterStyle, which is used by the XmlSerializer in ASMX services. Then if you wan to prevent wrapping, you set the ParameterStyle to Bare. You can also force wrapping by using a ParameterStyle value of Wrapped.

    Then for the difference betwwen them, please try to check the following:
    http://stackoverflow.com/questions/5324051/webservices-bare-vs-wrapped .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Roman csharp Wednesday, February 26, 2014 9:26 AM
    Wednesday, February 26, 2014 8:20 AM
    Moderator
  • Hi,

    I have found it now for C#

    http://msdn.microsoft.com/en-us/library/dkwy2d72(v=vs.100).aspx

    tnx

    For the  whole Service specify this Attribute at Service class level

    [SoapDocumentService(Use=SoapBindingUse.Literal,
                         ParameterStyle=SoapParameterStyle.Wrapped)]

    But.. , this does not solve the Problem in VisualStudio 2012!

    I can specify this attributes, but if I update the Service-Reference, all Services marked with

    IsWrapped=false.

    VisualStudio Service-Reference-Generator seems to ignore all this attributes???

     

    Roman


    • Edited by Roman csharp Wednesday, February 26, 2014 12:50 PM
    Wednesday, February 26, 2014 9:48 AM