我有以下Web服务界面。
[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类和所有父类[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.
答案 0 :(得分:0)
我在返回的课程中添加以下标签后解决了这个问题。
[DataContract]
[MessageContract(IsWrapped = false)]