C# SOAP头中缺少

C# SOAP头中缺少,c#,.net,wcf,web-services,C#,.net,Wcf,Web Services,使用以下命令生成代理 svcutil.exe/language:cs/out:generatedProxy.cs/config:app.config 这是我创建的代码: 我在SOAP异常中丢失了 请帮助我,我是一个新的Bie在.net 这是我的app.config文件 <system.serviceModel> <bindings> <basicHttpBinding> <binding name="

使用以下命令生成代理

svcutil.exe/language:cs/out:generatedProxy.cs/config:app.config

这是我创建的代码:

我在SOAP异常中丢失了

请帮助我,我是一个新的Bie在.net

这是我的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>

您已将安全模式设置为“无”。上面的第2行已经没有了,我把它作为BasicHttpSecurityMode保留了下来。没有,其他任何为安全模式提供“无”的方法也是如此。如果我错了,请不要介意,我是网络新手。当安全模式为“无”时,就不会将安全标头作为SOAP标头的一部分发送,这就是为什么会出现异常。我猜如果您的web服务进行用户名密码身份验证,那么它应该是TransportWithMessageCredentials为什么要使用basicHttpBinding?构造函数中是否存在只接受EndPointAddress而不接受绑定的重载?我相信这些链接会对您有所帮助。
<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>