Understanding a java webservice from C#



  • Hello guys i am currently working on an energy consumer portal of a german company.
    When I started there my first task was to establish a webservice connection to a certain energy system operator.

    The provided webservice was implementet in java, as i was told - my own plattform was .NET 2.0 using visual studio 2005.
    When i startet writing my code to gather the data for the webservice and executing methods i came over a strange thing -
    It might be my incompetence with webservices - it's not my first time .net but my first time on a WS.

    So far i think it is just another WTF:  

    Whenever setting up the objects for the webservice, filling them with the data from my own business objects, every once in a while an object didn't only have a property for the data to be set -
    it also contained a property that said something like "dataSpecified", for example:

    MasterData data = new MasterData();
    data.Customer = new Customer("CompanyName");
    data.CustomerSpecified = true;

    This had to be done, otherwise the webservice would return a meaningless and undocumented error message.
    I was told that these things had to be set because of the attribute isNullable from the WSDL file that was used to generate the interface from VS05.

    I couldn't figure it out so far. Any annotations? Who is the idiot - they or me? 



  • This blog seems to discuss the issue:

    http://blogs.msdn.com/yassers/archive/2004/07/22/191526.aspx 

     Apparently the "specified" flag is necessary for optional elements (minOccurs=0) to distinguis between the cases "element not present" and "element present but set to nil". Of course it's rather idiotic to not set it to true automatically when the element's value is set.



  • omg, you found that after 2 minutes of google i guess? still,  thanks for the quick answer!

    What a stupi behaviour when using the ws. it must be possible to do that better...


Log in to reply