2

WCF の経験が不足していることをお許しください。ただし、理解が難しいという問題があります。

私が働いている会社の別の組織は、私が使用するための Web サービスを作成しました。提供された WSDL を使用して、プロジェクトにサービス参照を正しく追加したと思います。彼らの Web サービスは、私がほとんど知らない Oracle API に基づいています。私は Oracle 開発者ではありません。

サービス参照を利用するために使用したコードは次のとおりです。

BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
basicHttpBinding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential;
basicHttpBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

EndpointAddress epa = new EndpointAddress("https://MYENDPOINT.URL");
MyServiceReference.SERVICENAME_PortTypeClient port = new MyServiceReference.SERVICENAME_PortTypeClient(basicHttpBinding, epa);
port.ClientCredentials.UserName.UserName = SERVICE_U;
port.ClientCredentials.UserName.Password = SERVICE_P;

SOAHeader header = new SOAHeader();
header.Responsibility = SERVICE_RESPONSIBILITY;

InputParameters2 ip2 = new InputParameters2();
ip2.param1 = "abcd";
ip2.param2 = "1234"

OutputParameters2 output = port.WEB_SERVICE_FUNCTION(header, ip2);

バインディング情報に関する Web.Config ファイルの情報は次のとおりです。

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="SERVICENAME_Binding">
                <security mode="None" />
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="https://MYENDPOINT.URL"
                 binding="basicHttpBinding" bindingConfiguration="SERVICENAME_Binding"
                 contract="MyServiceReference.SERVICENAME_PortType"
                 name=SERVICENAME_Port" />
    </client>
</system.serviceModel>

サービスを呼び出すと、次のエラーが表示されます。

セキュリティ プロセッサは、メッセージ内にセキュリティ ヘッダーを見つけることができませんでした。これは、メッセージがセキュリティで保護されていない障害であるか、通信する当事者間にバインディングの不一致があるためである可能性があります。これは、サービスがセキュリティ用に構成されていて、クライアントがセキュリティを使用していない場合に発生する可能性があります。

次のスタックトレースを使用:

at System.ServiceModel.Security.TransportSecurityProtocol.VerifyIncomingMessageCore(Message& message, TimeSpan timeout)
at System.ServiceModel.Security.TransportSecurityProtocol.VerifyIncomingMessage(Message& message, TimeSpan timeout)
at System.ServiceModel.Security.SecurityProtocol.VerifyIncomingMessage(Message& message, TimeSpan timeout, SecurityProtocolCorrelationState[] correlationStates)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at MyProject.MyServiceReference.SERVICE_NAME_PortType.WEB_SERVICE_FUNCTION(WEB_SERVICE_FUNCTIONRequest request)
at MyProject.MyServiceReference.SERVICE_NAME_PortTypeClient.MyProject.MyServiceReference.SERVICE_NAME_PortType.WEB_SERVICE_FUNCTION(WEB_SERVICE_FUNCTIONRequest request) in c:\MyProject\Service References\MyServiceReference\Reference.cs:line 981
at MyProject.MyServiceReference.SERVICE_NAME_PortTypeClient.WEB_SERVICE_FUNCTION(SOAHeader SOAHeader, InputParameters2 InputParameters) in c:\MyProject\Service References\MyServiceReference\Reference.cs:line 988
at MyProject.MyClass.MyFunction(String inputParam) in c:\MyProject\MyClass.asmx.cs:line 160

スタック トレースを調べたところ、応答の検証が問題である可能性があり、他のユーザーが経験したタイムスタンプの問題に関係している可能性があると思われます (例: http://blog.latamhub.com ) /?p=78includeTimestamp="true" ) が問題である可能性がありますが、Web.Config ファイルのタグに属性を追加しようとするとsecurity、VS2012 は includeTimestamp 属性が許可されていないと報告します。ここで何が起こっているのか、他に何を確認する必要があるのか​​ よくわかりません。どんな助けやアイデアも大歓迎です。

ありがとう。

編集 (2013-05-30):

true および false に設定して次のカスタム バインディングを試しましたが、includeTimestamp成功しませんでした。

<customBinding>
    <binding name="SERVICENAME_Binding">
        <security 
            includeTimestamp="true"
        />
    </binding>
</customBinding>
4

0 に答える 0