svcutil.exe - Proxy generated not allowing for nullable fields

前端 未结 3 962
鱼传尺愫
鱼传尺愫 2021-01-01 00:19

I am trying to consume a web service specified using WSDL by creating a WCF proxy using svcutil.exe, but the WSDL specifies that some of the operations have parameters that

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-01 00:34

    I would guess the client proxy class generated by svcutil has a field/property called meetingId of type int - right? Yes, this is non-nullable - but I bet you also have a boolean field/property called meetingIdSpecified - only if this is set to true will the service actually look at it; if you don't set it, then the service will not look at the value, so it's almost as if it where NULL.

    Also - you didn't specify the field to be nullable in your XSD, either - you specified it to be optional. To make it nullable, use this syntax here:

    
    

    See the "nullable" attribute? That's the one used for making a field really nullable - you can now have an entry like this in your XML:

    
      
    
    

    Marc

提交回复
热议问题