因为它使用的类型在WCF测试客户端的WCF服务方法不可用因为它、不可用、客户端、类型

2023-09-04 01:54:53 作者:消极.

我想使用WCF测试客户端来测试WCF服务,我已经建立。

该服务有一个方法SubmitRequest。

  [OperationContract的]
响应SubmitRequest(申请要求);
 

当我加载了WCF测试客户端,方法是灰色的消息,因为它使用类型WcfLibrary.Objects.Request不支持在WCF测试客户端这个操作

下面是类型定义,没有人看到什么了?

  [DataContract]
公共类请求
{
    [数据成员]
    公共字符串LoanNumber {获得;组; }

    [数据成员]
    公共字符串客户端code {获得;组; }

    [数据成员]
    公共区域地区{获得;组; }

    [数据成员]
    公共请求类型请求类型{获取;组; }

    [数据成员]
    公开名单< RequestParameter> requestParameters的{获得;组; }

    [数据成员]
    公开名单< MspWebCallType> MspWebCallsForXmlRequest {获得;组; }

    [数据成员]
    公共Hashtable的XmlRequestParameters {获得;组; }

    公共请求(字符串loanNumber,字符串客户端code,地区区,请求类型请求类型,列表和LT; RequestParameter> requestParameters的)
    {
        LoanNumber = loanNumber;
        客户端code =客户端code;
        地区=区域;
        请求类型=请求类型;
        requestParameters的= requestParameters的;
    }
}

[DataContract]
公共类MspWebCallType
{
    [数据成员]
    公共字符串的WebService {获得;组; }
    [数据成员]
    公共字符串操作{获得;组; }
    [数据成员]
    公共字符串版本{获得;组; }
    [数据成员]
    公共Hashtable的参数{获得;组; }
    [数据成员]
    公共Msp.FavReadViews FAVReadViewIndicator {获得;组; }
    [数据成员]
    公共Msp.DsReadIndicators DSReadInidicator {获得;组; }
}

[DataContract]
公共枚举区
{
        [EnumMember]
        P2,
        [EnumMember]
        PROD
}

[DataContract]
公共枚举的RequestType
{
    [EnumMember]
    无,
    [EnumMember]
    XmlRequest,
    [EnumMember]
    SomeOtherRequestType
}

[DataContract]
公共结构RequestParameter
{
    [数据成员]
    公共字符串参数名称{获得;组; }

    [数据成员]
    公共字符串的parameterValue {获得;组; }
}
 

感谢。

编辑瓦特/答案... 该操作是无法通过WCF测试客户端,因为类型MspWebCallType有型哈希表的属性。有一次,我去掉这个属性是固定的问题。感谢大家的帮助。

解决方案   

以下是不支持的WCF测试客户端的功能列表:

        

类型:流,信息,的XmlElement,XmlAttribute,XmlNode的,类型   实现IXmlSerializable接口,包括有关   XmlSchemaProviderAttribute属性,且的XDocument和的XElement   类型和ADO.NET数据表型。

  

双面打印合同。

  

交易。

  

安全:CardSpace的,证书和用户名/密码

  

绑定:WSFederationbinding,任何上下文绑定和HTTPS绑定,   的WebHttpBinding(JSON响应消息的支持)。

  

来源: MSDN

检查 Msp.FavReadViews Msp.DsReadIndicators ,以确保他们遵守。

Java与WCF交互 一 Java客户端调用WCF服务

I am trying to use the WCF Test Client to test a WCF service I have built.

The service has one method "SubmitRequest".

[OperationContract]
Response SubmitRequest(Request request);

When I load up the WCF Test Client, the method is grayed out with the message "This operation is not supported in the WCF Test Client because it uses type WcfLibrary.Objects.Request

Below is the type definition, does anyone see anything wrong?

[DataContract]
public class Request
{
    [DataMember]
    public string LoanNumber { get; set; }

    [DataMember]
    public string ClientCode { get; set; }

    [DataMember]
    public Region Region { get; set; }

    [DataMember]
    public RequestType RequestType { get; set; }

    [DataMember]
    public List<RequestParameter> RequestParameters { get; set; }

    [DataMember]
    public List<MspWebCallType> MspWebCallsForXmlRequest { get; set; }

    [DataMember]
    public Hashtable XmlRequestParameters { get; set; }

    public Request(string loanNumber, string clientCode, Region region, RequestType requestType, List<RequestParameter> requestParameters)
    {
        LoanNumber = loanNumber;
        ClientCode = clientCode;
        Region = region;
        RequestType = requestType;
        RequestParameters = requestParameters;
    }
}

[DataContract]
public class MspWebCallType
{
    [DataMember]
    public string WebService { get; set; }
    [DataMember]
    public string Operation { get; set; }
    [DataMember]
    public string Version { get; set; }
    [DataMember]
    public Hashtable Parameters { get; set; }
    [DataMember]
    public Msp.FavReadViews FAVReadViewIndicator { get; set; }
    [DataMember]
    public Msp.DsReadIndicators DSReadInidicator { get; set; }        
}

[DataContract]
public enum Region 
{ 
        [EnumMember]
        P2,
        [EnumMember]
        PROD 
}

[DataContract]
public enum RequestType
{
    [EnumMember]
    None,
    [EnumMember]
    XmlRequest,
    [EnumMember]
    SomeOtherRequestType
}

[DataContract]
public struct RequestParameter
{
    [DataMember]
    public string ParameterName { get; set; }

    [DataMember]
    public string ParameterValue { get; set; }
}

Thanks.

EDIT w/ answer... The operation was not available via the WCF Test Client because the type MspWebCallType had a property of type Hashtable. Once I removed this property it fixed the issue. Thanks for everyone's help.

解决方案

The following is a list of features not supported by WCF Test Client:

Types: Stream, Message, XmlElement, XmlAttribute, XmlNode, types that implement the IXmlSerializable interface, including the related XmlSchemaProviderAttribute attribute, and the XDocument and XElement types and the ADO.NET DataTable type.

Duplex contract.

Transaction.

Security: CardSpace , Certificate, and Username/Password.

Bindings: WSFederationbinding, any Context bindings and Https binding, WebHttpbinding (Json response message support).

Source: MSDN

Check Msp.FavReadViews and Msp.DsReadIndicators to ensure they comply.