Problem with VS Web Reference to document-literal style web service

Discussion in 'ASP .Net Web Services' started by Desmond Fitzgerald, Jan 18, 2006.

  1. We have a document-literal style web service that we provide to a number
    of external parties.

    The input is a create applicant request document with some structured
    customer details including xs:date and bool elements.

    The problem occurs when we add a web reference to this service and try
    to invoke it using the generated proxies. The serialized request is
    missing some of the elements.

    When I looked further into this it seems that the generated classes in
    Reference.cs have a number of xxxSpecified properties and fields
    corresponding to members such as date of births and some of the boolean

    However, when you set the DOB field, for example, it does not set the
    DOBSpecified flag to true. Then it appears that XMLSerializer will not
    serialize the associated property.

    I am using XSDObjectGen to generate the server-side classes and these do
    not exhibit the same problem. They set the xxxSpecified flags correctly.
    The java tools I have tried also process the WSDL correctly and there is
    nothing wrong with the Schema.

    Obviously, I have a number of options to fix the client side proxies
    such as:

    1. Rewrite the Reference.cs in terms of the XSDObjectGen classes.
    2. Add statements to Reference.cs to set the specified flags properly.

    The problem is that some of our clients will be using VS and it is
    highly inconvenient to have them do this every time they update the Web

    To help them I could:

    * Provide a script that does (2) above.
    * Provide a class that introspects the request at run-time and sets the
    specified flags properly.

    Again, I would rather not have to do this. Having to kludge things like
    this is making the RPC style look attractive again!

    Does anyone know how I can sort this out properly. It seems like a bug
    in wsdl.exe?

    *** Sent via Developersdex ***
    Desmond Fitzgerald, Jan 18, 2006
    1. Advertisements

  2. Josh Twist

    Josh Twist Guest

    In the past I've known people to hand-craft proxies for web services
    and provide them as SDK's to clients. This is an opportunity to make
    the proxies more user friendly with collections instead of arrays
    etc... a real shame that VS is struggling with your WSDL though...

    Which version of Visual Studio are you using? Is the web service
    written in .NET?
    Josh Twist, Jan 18, 2006
    1. Advertisements

  3. That is definitely an option. Actually the XSDObjectGen generated
    proxies are quite a bit more friendly that those produced by WSDL.exe.
    So that could be a good start.

    What I don't understand is why it creates xxxSpecified properties for
    some elements and not others. There doesn't seem to be any obvious logic
    behind it.

    *** Sent via Developersdex ***
    Desmond Fitzgerald, Jan 18, 2006
  4. Josh Twist

    Josh Twist Guest

    I'm afraid I'm not sure what you mean by 'xxxSpecified' properties? Can
    you elaborate?
    Josh Twist, Jan 18, 2006
  5. WSDL.exe generates partial classes such as the following excerpt. If the
    DobSpecified property is set to false then the serializer seems to skip
    over serializing the Dob property. It won't be present in the serialized
    XML representation even if object is created and the property is set.

    Now, it is set to false by initialization and is never set even if the
    setter of Dob is used. This is in contrast to classes generated by
    XSDObjectGen which set the DobSpecified flag to true if the setter is

    I can fix the Reference.cs by inserting a statement such as DobSpecified
    = true; on every setter of properties with matching xxxSpecified
    properties but this is irratating at best.

    public partial class personalDetailsType {

    // ...

    private System.DateTime dobField;
    private bool dobFieldSpecified;

    // ...

    public System.DateTime Dob {
    get {
    return this.dobField;
    set {
    this.dobField = value; this.DobSpecified = true;

    public bool DobSpecified {
    get {
    return this.dobFieldSpecified;
    set {
    this.dobFieldSpecified = value;

    // ...


    *** Sent via Developersdex ***
    Desmond Fitzgerald, Jan 18, 2006
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jan
    Mike Schilling
    Sep 1, 2008
  2. Ken Varn
    Ken Varn
    Apr 26, 2004
  3. Anonieko Ramos

    What's wrong with rpc-literal? Why use doc-literal?

    Anonieko Ramos, Sep 27, 2004, in forum: ASP .Net Web Services
    Anonieko Ramos
    Sep 27, 2004
  4. Jennifer

    RPC/Encoded to Document/Literal Conversion

    Jennifer, Jan 11, 2005, in forum: ASP .Net Web Services
    Dilip Krishnan
    Jan 11, 2005
  5. Fima  Furman

    document/literal style SOAP:Lite service

    Fima Furman, May 9, 2007, in forum: Perl Misc
    Ian Wilson
    May 9, 2007