缺少SOAP Header中的<wsse:security> </wsse:security>

时间:2011-12-12 10:31:17

标签: c# .net wcf web-services

代理使用以下命令生成


svcutil.exe / language:cs /out:generatedProxy.cs /config:app.config http://sewsr2.sewinfra.com:8002/webservices/SOAProvider/plsql/fnd_user_pkg/?wsdl

这是我创建的代码:


    BasicHttpBinding basicHttpBinding = new BasicHttpBinding();           
    basicHttpBinding.Security.Mode = BasicHttpSecurityMode.None;
    basicHttpBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
    EndpointAddress epa = new EndpointAddress("http://sewsr2.sewinfra.com:8002/webservices/SOAProvider/plsql/fnd_user_pkg/");
    FND_USER_PKG_PortTypeClient port = new FND_USER_PKG_PortTypeClient(basicHttpBinding,epa);
    port.ClientCredentials.UserName.UserName ="asadmin";
    port.ClientCredentials.UserName.Password = "welcome";
    SOAHeader header = new SOAHeader();
    InputParameters10 input = new InputParameters10();
    header.RespApplication = "FND";
    header.Responsibility = "FND_REP_APP";
    header.SecurityGroup = "STANDARD";
    header.NLSLanguage = "AMERICAN";
    header.Org_Id = "115";
    input.X_USER_NAME = "sysadmin";
    OutputParameters4 ouput = port.TESTUSERNAME(header, input);
    int value = ouput.TESTUSERNAME.Value;

我得到Missing <wsse:Security> in SOAP例外。

请帮助我,我是.net中的新Bie

这是我的app.config文件

<system.serviceModel>

    <bindings>

        <basicHttpBinding>

            <binding name="FND_USER_PKG_Binding" closeTimeout="00:01:00"

                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"

                allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"

                useDefaultWebProxy="true">

                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"

                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />

                <security mode="None">

                    <transport clientCredentialType="None" proxyCredentialType="None"

                        realm="" />

                    <message clientCredentialType="UserName" algorithmSuite="Default" />

                </security>

            </binding>

        </basicHttpBinding>

    </bindings>

    <client>

        <endpoint address="http://sewsr2.sewinfra.com:8002/webservices/SOAProvider/plsql/fnd_user_pkg/"

            binding="basicHttpBinding" bindingConfiguration="FND_USER_PKG_Binding"

            contract="FND_USER_PKG_PortType" name="FND_USER_PKG_Port" />

    </client>

</system.serviceModel>

0 个答案:

没有答案