.NET wcf 服务输出
.NET wcf service output
我有以下网络服务接口。
[ServiceContract(Namespace = "http://customnamespacehere")]
public interface IDebtKnowledge
{
[OperationContract]
SubscriberOutput GetSubscribers(SubscriberInput subscriberInput);
}
它生成下面的输出。但是我想在没有 v1:GetSubscribers 标签的情况下生成它。这是我的方法名称。
<soapenv:Body>
<v1:GetSubscribers>
<v1:subscriberInput>
<akt:IpAddress>?</akt:IpAddress>
<akt:OperatorCode>?</akt:OperatorCode>
<akt:Password>?</akt:Password>
<akt:Username>?</akt:Username>
</v1:subscriberInput>
</v1:GetSubscribers>
如何获得下面的输出?
<soapenv:Body>
<v1:subscriberInput>
<akt:IpAddress>?</btk:IpAddress>
<akt:OperatorCode>?</btk:OperatorCode>
<akt:Password>?</akt:Password>
<akt:Username>?</akt:Username>
</v1:subscriberInput>
</soapenv:Body>
我用
标记了我的 SubscriberInput class 和所有父 class
[DataContract]
[MessageContract(IsWrapped = false)]
然后我得到了这个异常。
The operation 'GetSubscribers' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with ssageContractAttribute, the method must not use any other types of parameters.
我在返回的class中添加了以下标签后解决了它。
[DataContract]
[MessageContract(IsWrapped = false)]
我有以下网络服务接口。
[ServiceContract(Namespace = "http://customnamespacehere")]
public interface IDebtKnowledge
{
[OperationContract]
SubscriberOutput GetSubscribers(SubscriberInput subscriberInput);
}
它生成下面的输出。但是我想在没有 v1:GetSubscribers 标签的情况下生成它。这是我的方法名称。
<soapenv:Body>
<v1:GetSubscribers>
<v1:subscriberInput>
<akt:IpAddress>?</akt:IpAddress>
<akt:OperatorCode>?</akt:OperatorCode>
<akt:Password>?</akt:Password>
<akt:Username>?</akt:Username>
</v1:subscriberInput>
</v1:GetSubscribers>
如何获得下面的输出?
<soapenv:Body>
<v1:subscriberInput>
<akt:IpAddress>?</btk:IpAddress>
<akt:OperatorCode>?</btk:OperatorCode>
<akt:Password>?</akt:Password>
<akt:Username>?</akt:Username>
</v1:subscriberInput>
</soapenv:Body>
我用
标记了我的 SubscriberInput class 和所有父 class[DataContract]
[MessageContract(IsWrapped = false)]
然后我得到了这个异常。
The operation 'GetSubscribers' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with ssageContractAttribute, the method must not use any other types of parameters.
我在返回的class中添加了以下标签后解决了它。
[DataContract]
[MessageContract(IsWrapped = false)]