我是WSDL的新手。我有一个WSDL,需要使用springBoot应用程序建立与端点的连接并验证其工作状态。
在我的Java类SoapClientConfig中,我需要contextPath和默认的Uri进行设置。使用给定的WSDL,我不确定会是我的contextPath和默认的Uri。 在WSDL中,我看到以下标记用于地址定位。我不确定如何在Springboot应用程序中使用该地址建立与同一WSDL提供的API的连接
<wsdl:service name="PayServices">
<wsdl:port name="BasicHttpBinding_PayServices"
binding="tns:BasicHttpBinding_PayServices">
<soap:address
location="https://test.testfw.ws/ts/gpcs/grsv/routerservice.svc"/>
</wsdl:port>
</wsdl:service>
API操作结果之一
<wsdl:operation name="PaymentOutcome">
<soap:operation
soapAction="http://hide.net/services/atms/PayServices/PaymentOutcome" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
<soap:header message="tns:PayServices_RouterAddressing" part="ADDRESSING" use="literal"/>
<soap:header message="tns:PayServices_RouterSecurity" part="SECURITY" use="literal"/>
<soap:header message="tns:PayServices_Security" part="Security" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="SecurityFault">
<soap:fault name="SecurityFault" use="literal"/>
</wsdl:fault>
<wsdl:fault name="RouterFault">
<soap:fault name="RouterFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
用于SOap客户端连接的Java代码:
@Configuration
public class SoapClientConfig {
@Bean
public Jaxb2Marshaller marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
// this package must match the package in the <generatePackage> specified in
// pom.xml
marshaller.setContextPath("");
return marshaller;
}
@Bean
public PaymentOutcomeClient paymentOutcomeClient(Jaxb2Marshaller marshaller) {
PaymentOutcomeClient client = new PaymentOutcomeClient();
client.setDefaultUri("http://localhost:8080");
client.setMarshaller(marshaller);
client.setUnmarshaller(marshaller);
return client;
}
}