0

这是我给服务提供商的 pom 片段

<serviceProviders>
                        <serviceProvider>
                            <name>StoreSite</name>
                            <protocol>https</protocol>
                            <host>https://somesiteurl.com</host>
                            <path></path>
                            <consumers>
                                <consumer>
                                    <name>FrontSite</name>
                                    <pactUrl>http://[::1]:8080/pacts/provider/StoreSvc/consumer/SiteSvc/latest</pactUrl>
                                </consumer>
                            </consumers>
                        </serviceProvider>
                    </serviceProviders>

并在 pact:verify 操作之后。我得到以下堆栈跟踪的构建错误。我可以看到在 localhost 代理中生成的协议文件。但是当端点更改为 https 时,验证一直失败。

[DEBUG]   (s) name = StoreSite
[DEBUG]   (s) protocol = https
[DEBUG]   (s) host = https://somesiteurl.com
[DEBUG]   (s) name = FrontSite
[DEBUG]   (s) pactUrl = http://[::1]:8080/pacts/provider/StoreSvc/consumer/SiteSvc/latest
[DEBUG]   (s) consumers = [au.com.dius.pact.provider.maven.Consumer()]
[DEBUG]   (f) serviceProviders = [au.com.dius.pact.provider.maven.Provider(null, null, null, null)]
[DEBUG] -- end configuration --

Verifying a pact between FrontSite and StoreSite
  [from URL http://[::1]:8080/pacts/provider/StoreSite/consumer/FrontSite/latest]
  Valid sign up request
[DEBUG] Verifying via request/response
[DEBUG] Making request for provider au.com.dius.pact.provider.maven.Provider(null, null, null, null):
[DEBUG]     method: POST
path: /api/v1/customers
    headers: [Content-Type:application/json, User-Agent:Mozilla/5.0 
    matchers: [:]
    body: au.com.dius.pact.model.OptionalBody(PRESENT, {"dob":"1969-12-17","pwd":"255577_G04QU","userId":"965839_R9G3O"})
      Request Failed - https

Failures:

0) Verifying a pact between FrontSite and StoreSite - Valid sign up request
      https
4

1 回答 1

0

我试图针对在 https 上运行的名为 BusService 的服务进行验证,并让它像这样工作。我的示例的设置方式与您的不同,但我认为重要的区别在于添加了标签<insecure>true</insecure>,并且只使用了 host-tag 中的服务器名称<host>localhost</host>

<serviceProvider>
   <name>BusService</name>
   <protocol>https</protocol>
   <insecure>true</insecure>
   <host>localhost</host>
   <port>8443</port>
   <path>/</path>
   <pactBrokerUrl>http://localhost:8113/</pactBrokerUrl>
</serviceProvider>
于 2018-01-02T16:43:32.770 回答