1、wsdl传入soapUI获取接口模板
2、构建SoapRequest
SoapRequest request = SoapRequest.builder()
.url("http://localhost:8080/service/student-details")
.namespace("http://www.howtodoinjava.com/xml/school")
.localPart("StudentDetailsRequest")
.bodyParams(["name": "Lokesh"])
.timeout(15000)//超时时间,默认15s
.retryCount(0)//重试次数,0为不重试,最大为3
.build()
3、使用提供的方法发送
ApiResult result = Fx.http.postSoap(request)
4、若返回字段(ApiResult.error)无误,输出数据
HttpResult httpResult = result.data
println httpResult.getContent()
5、返回结果如下(Groovy)
{StudentDetailsResponse={Student={standard=6, address=Delhi, name=Lokesh}}}
对应soapMessage为: