首页 > 解决方案 > 解锁企业网络中的防火墙以访问 Google 文本到语音 API 需要什么 URL?

问题描述

当前的谷歌文本到语音我的Java代码运行良好,但是当上传到服务器时显示错误代码低于代码,因为我知道服务器太安全所以可能需要从防火墙解除阻止但我找不到哪些正在访问背景。

我已经尝试在环境变量中设置代理,但它不起作用。

try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
        // Set the text input to be synthesized
        SynthesisInput input = SynthesisInput.newBuilder()
              .setText(strText)
              .build();

        VoiceSelectionParams voice = VoiceSelectionParams.newBuilder()
            .setLanguageCode("en-US")
            .setSsmlGender(SsmlVoiceGender.NEUTRAL)
            .build();

            // Select the type of audio file you want returned
            AudioConfig audioConfig = AudioConfig.newBuilder()
            .setAudioEncoding(AudioEncoding.MP3)
            .build();

        // Perform the text-to-speech request on the text input with the selected voice parameters and
        // audio file type
        SynthesizeSpeechResponse syntehsizeResponse = textToSpeechClient.synthesizeSpeech(input, voice,
            audioConfig);   

        // Get the audio contents from the response
        ByteString audioContents = syntehsizeResponse.getAudioContent();


Error-----------------------------------------------------------------

Caused by: javax.net.ssl.SSLHandshakeException: error:10000410:SSL routines:OPENSSL_internal:SSLV3_ALERT_HANDSHAKE_FAILURE 
        at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.shutdownWithError(ReferenceCountedOpenSslEngine.java:897)

标签: javagoogle-apigoogle-text-to-speech

解决方案


Speech.googleapis.com 是需要在防火墙中清除的基本链接。


推荐阅读