开发者

Boolean type soap request ignored by .net client

I tried to call a webservices method through my asp.net project.

I used Fiddler to log the soap request. However, I found a boolean type value in the request was not sent, the other types work fine.

The xsd file is defined like:

<xs:complexType name="TestObject">
 <xs:complexContent mixed="false">
  <xs:extension base="com:TestObjectDTO">
    <xs:sequence>
      <xs:element minOccurs="1" maxOccurs="1" name="scenario" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="asap" type="xs:boolean" />
    </xs:sequence>
  </xs:extension>
</xs:complexContent>

The soap request was logged as:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>开发者_开发技巧;
    <TestObjectDTO xsi:type="TestObject" xmlns="http://ws.com/service/">
     <scenario>scenario_1</scenario>
    </TestObjectDTO>
</soap:Body>

The asap element was missing. Any idea?

thanks.


<xs:element minOccurs="0" maxOccurs="1" name="asap" type="xs:boolean" />

minOccurs="0" means it's optional, and doesn't need to appear in the request. With no default specified, I'd assume it'll default to false, or it might have to be represented by a nullable type.


We just ran into this and it looks like .NET generates two fields for you to modify

.asap .asapSpecified

When we set both to true, it worked

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜