使用 ProtoBehavior 和多个参数调用 WCF 服务

发布于 2024-08-04 06:03:55 字数 1848 浏览 2 评论 0原文

这让我很困惑,我希望这是我的一个愚蠢的疏忽。当我调用以下 Web 服务时,如果遇到 null 参数,则以下所有参数均为 null(或数字为零)。

[OperationContract, ProtoBehavior]
[ServiceKnownType(typeof(ServiceFault))]
[FaultContract(typeof(ServiceFault))]
PersonProfileMessagePart Create(ObjectId person, ObjectId industry, int yearsInIndustry, ObjectId occupation, string occupationFreeText,
                                int yearsInOccupation, string maritalStatus, string educationLevel, 
                                List<ChildMessagePart> children, FinancialProfileMessagePart financialProfile,
                                List<ObjectId> traits);

例如,如果存在 personyearsInIndustry 但不存在 industry,则包括 yearsInIndustry 在内的所有参数都默认为 null/0 。我需要应用其他属性吗?

{编辑} 我的不好。 Marc,它是具有自定义绑定的 WCF。

<customBinding>
    <binding name="ServiceFedBinding">
        <security authenticationMode="SecureConversation">
            <secureConversationBootstrap authenticationMode="IssuedToken">
                <issuedTokenParameters tokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1">
                    <issuer address="http://links-dev:91/security/authentication/securetokenservice.svc/" binding="wsHttpBinding">
                        <identity>
                            <dns value="LINKS"/>
                        </identity>
                    </issuer>
                    <issuerMetadata address="http://links-dev:91/security/authentication/securetokenservice.svc/mex"/>
                </issuedTokenParameters>
            </secureConversationBootstrap>
        </security>

提前致谢。 麦克风

This one has me puzzled and am hoping it's a silly oversight on my part. When I call the following web service, if a null parameter is encountered then all following parameters are null (or zero for the numerics).

[OperationContract, ProtoBehavior]
[ServiceKnownType(typeof(ServiceFault))]
[FaultContract(typeof(ServiceFault))]
PersonProfileMessagePart Create(ObjectId person, ObjectId industry, int yearsInIndustry, ObjectId occupation, string occupationFreeText,
                                int yearsInOccupation, string maritalStatus, string educationLevel, 
                                List<ChildMessagePart> children, FinancialProfileMessagePart financialProfile,
                                List<ObjectId> traits);

For example, if person and yearsInIndustry are present but not industry, all parameters including yearsInIndustry default to null/zero. Is there an additional attribute I need to apply?

{edit}
My bad. Marc, it is WCF with a custom binding.

<customBinding>
    <binding name="ServiceFedBinding">
        <security authenticationMode="SecureConversation">
            <secureConversationBootstrap authenticationMode="IssuedToken">
                <issuedTokenParameters tokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1">
                    <issuer address="http://links-dev:91/security/authentication/securetokenservice.svc/" binding="wsHttpBinding">
                        <identity>
                            <dns value="LINKS"/>
                        </identity>
                    </issuer>
                    <issuerMetadata address="http://links-dev:91/security/authentication/securetokenservice.svc/mex"/>
                </issuedTokenParameters>
            </secureConversationBootstrap>
        </security>

Thanks in advance.
Mike

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文