3

.NET アプリケーションで使用される SAP Web サービスをセットアップしようとしています。簡単だと思って、HTTP を使用するように SAP で Service をセットアップしました。.NET プロジェクト ツリーの [サービス参照] を右クリックし、[サービス参照の追加...] を選択します。サーバーでローカルにホストされている WSDL URL を入力し、[移動] を押してエンドポイントを選択し、[OK] を押します。 .

app.config ファイルを開いて、HTTP を使用するように設定しましたが、<httpsTransport>代わりにと表示されていることを確認しました。<httpTransport>

<system.serviceModel>
      <bindings>
           <customBinding>
               <binding name="ZHR_RECRUITNEW1">
                    <!--WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'urn:sap-com:document:sap:soap:functions:mc-style':-->
                    <!--    <wsdl:binding name='ZHR_RECRUITNEW'>    -->
                    <!--        <wsaw:UsingAddressing xmlns:wsaw="http://schemas.xmlsoap.org/ws/2004/08/addressing">..</wsaw:UsingAddressing>    -->
                    <!--        <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>    -->
                    <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
                        messageVersion="Soap11" writeEncoding="utf-8">
                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    </textMessageEncoding>
                    <httpsTransport manualAddressing="false" maxBufferPoolSize="524288"
                        maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
                        bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                        keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
                        realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
                        useDefaultWebProxy="true" requireClientCertificate="false" />
                </binding>
            </customBinding>
        </bindings>
        <client>
            <endpoint address="http://<host>:8000/sap/bc/srt/rfc/sap/zhr_recruitnew/300/zhr_recruitnew/zhr_recruitnew"
                binding="customBinding" bindingConfiguration="ZHR_RECRUITNEW1"
                contract="ServiceReference2.ZHR_RECRUITNEW" name="ZHR_RECRUITNEW1" />
        </client>
    </system.serviceModel>

したがって、「適切に」機能させるには、その xml タグの名前を httpsTransport から httpTransport に変更し、requireClientCertificate="false" 属性を削除する必要があります。

そのため、SAP に移動して HTTPS を使用するようにサービスを設定し、.NET プロジェクトに戻ってそのサービスを再度追加すると、次のエラー メッセージが表示されます。

Could not establish trust relationship for the SSL/TLS secure channel with authority '<host>:<portnumber>'.

構成ファイル内のそのコメント「WsdlImporter が認識されないポリシー アサーションに遭遇しました」が、その情報が SAP から読み違えられて何かをする必要があるかどうかについて興味があります。

4

1 に答える 1

3

権限 ':' で SSL/TLS セキュア チャネルの信頼関係を確立できませんでした。

これは、サービス プロバイダーの証明書がローカルの信頼されたルート証明書にないためです。

これをコードに追加して(他の何よりも前に)無視することができます:

System.Net.ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);
于 2010-03-04T12:09:01.937 に答える