0

私はWebサービスにかなり慣れていないので、奇妙な動作と戦っています。VS2010 経由で WSDL xml ファイルをインポートした後、これらの認識されないポリシー アサーションを取得します。WSDL ファイルは SAP チームによって作成されたので、彼らが正確に何をしたかはわかりません。

これらのコメントを無視して Web サービスを使用しようとすると、次のような期待が生じます 。提供された URI スキーム 'https' は無効です。「http」が必要です。

このエラー メッセージは、URI で定義されているトランスポート ロジックが異なることを意味していることはわかっていますが、それについて何かを行うべきか、WSDL ファイルを更新するべきかはわかりません。

    <system.serviceModel>
<bindings>
    <customBinding>
        <binding name="binding">
            <!--    WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'urn:sap-com:document:sap:soap:functions:mc-style':    -->
            <!--    <wsdl:binding name='binding'>    -->
            <!--        <saptrnbnd:OptimizedXMLTransfer xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/">..</saptrnbnd:OptimizedXMLTransfer>    -->
            <!--        <sapattahnd:Enabled xmlns:sapattahnd="http://www.sap.com/710/features/attachment/">..</sapattahnd:Enabled>    -->
            <mtomMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
                messageVersion="Soap11WSAddressing10" maxBufferSize="65536"
                writeEncoding="utf-8">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
            </mtomMessageEncoding>
            <httpsTransport manualAddressing="false" maxBufferPoolSize="524288"
                maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
                bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard"
                keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
                realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
                useDefaultWebProxy="true" requireClientCertificate="false" />
        </binding>
        <binding name="binding_SOAP12">
            <!--    WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'urn:sap-com:document:sap:soap:functions:mc-style':    -->
            <!--    <wsdl:binding name='binding_SOAP12'>    -->
            <!--        <saptrnbnd:OptimizedXMLTransfer xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/">..</saptrnbnd:OptimizedXMLTransfer>    -->
            <!--        <sapattahnd:Enabled xmlns:sapattahnd="http://www.sap.com/710/features/attachment/">..</sapattahnd:Enabled>    -->
            <mtomMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
                messageVersion="Default" maxBufferSize="65536" writeEncoding="utf-8">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
            </mtomMessageEncoding>
            <httpsTransport manualAddressing="false" maxBufferPoolSize="524288"
                maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
                bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard"
                keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
                realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
                useDefaultWebProxy="true" requireClientCertificate="false" />
        </binding>
    </customBinding>
</bindings>
<client>
    <endpoint address="http://{HOSTNAME}/sap/bc/srt/rfc/sap/zicert_kunden_auslesen/010/005056a5007b1ee2a5da43a20303be2b/binding"
        binding="customBinding" bindingConfiguration="binding" contract="ServiceReference.ZICERT_KUNDEN_AUSLESEN"
        name="binding" />
    <endpoint address="http://{HOSTNAME}/sap/bc/srt/rfc/sap/zicert_kunden_auslesen/010/005056a5007b1ee2a5da43a20303be2b/binding"
        binding="customBinding" bindingConfiguration="binding_SOAP12"
        contract="ServiceReference.ZICERT_KUNDEN_AUSLESEN" name="binding_SOAP12" />
</client>

4

2 に答える 2

1

エンドポイントにはhttpスキームがありますが、バインディングは のみを定義しますhttpsTransport。バインディングを に変更してみるhttpTransportか、エンドポイントがhttpsプロトコルでも使用できるかどうかを確認してください。

于 2013-04-09T07:34:16.463 に答える
0

TransportCredentialOnlyHTTPS プロトコルを必要としないセキュリティ モードとして使用してみてください(ただし、ユーザー名とパスワードを提供する必要があります)。

<bindings>
  <basicHttpBinding>
    <binding name="NewBinding">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Basic" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

以下のように、.NET コードでユーザー名とパスワードを設定できます。

sapService.ClientCredentials.UserName.UserName = "UserName";
sapService.ClientCredentials.UserName.Password = "Password";
于 2016-08-25T08:18:48.880 に答える