FitNesse:使FitNesse装置能够在服务器端调用方法

问题描述 投票:2回答:1

我已经使用Eclipse通过某些方法实现了Web服务。

然后我将其导出到WAR文件,该文件将与Tomcat一起使用。

然后,我使用wsimport为我的Web服务创建了“存根”。

“存根”只是接口。

现在,我想知道如何通过我要编写的FitNesse固定装置调用Web服务。

我用JAVA编码。

是否有任何方法可以通过我的[[FitNesse固定装置调用Web服务方法,同时牢记为Web服务生成的“存根”?

java eclipse web-services fitnesse wsimport
1个回答
2
投票
有很多方法可以描述您的情况。例如,您可以使用Java创建自己的夹具(即包含测试代码的类),该夹具使用生成的存根调用服务。或者(我更喜欢)是使用在Wiki中配置的HTTP帖子直接调用服务,然后执行XPath查询,通过编写Java代码或在Wiki上对收到的响应进行XPath查询,以检查服务实现。

后一种方法由我放在GitHub(https://github.com/fhoeben/hsac-fitnesse-fixtures)上的固定装置支持(并准备运行FitNesse安装)。有关如何调用Web服务的特定信息,请参阅https://github.com/fhoeben/hsac-fitnesse-fixtures/wiki/4.-XmlHttpTest-Exampleshttps://github.com/fhoeben/hsac-fitnesse-fixtures/wiki/6.-SoapCallMapColumnFixture-Examples,具体取决于您要使用Slim还是Fit。

苗条样品:

!2 Body via scenario Using a scenario allows us to generate multiple request, only changing certain values. !*> Scenario definition !define POST_BODY_2 { {{{ <s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"> <s11:Body> <ns1:GetCityWeatherByZIP xmlns:ns1="http://ws.cdyne.com/WeatherWS/"> <ns1:ZIP>@{zip}</ns1:ZIP> </ns1:GetCityWeatherByZIP> </s11:Body> </s11:Envelope> }}} } |script|xml http test| |table template |send request | |post |${POST_BODY_2} |to |${URL} | |check |response status|200 | |show |response | |register prefix|weather |for namespace |http://ws.cdyne.com/WeatherWS/| |check |xPath |//weather:City/text()|@{City} | *! |send request | |zip |City | |10007|New York | |94102|San Francisco|

© www.soinside.com 2019 - 2024. All rights reserved.