import com.example.client.yourservice; // Сгенерированный сервисный класс < /p>
import org.apache.cxf.jaxws.jaxwsproxyfactorybean; < /p>
@applicationscoped
public class soapclient {p>
Код: Выделить всё
private static final String WSDL_URL = "http://example.com/your-wsdl?wsdl"; // Replace with actual WSDL URL
public YourServicePortType createServiceClient() {
// Use the generated service interface
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(YourServicePortType.class); // Set the service class
factory.setAddress(WSDL_URL); // Set the service endpoint URL
return (YourServicePortType) factory.create(); // Create client proxy
}
public String invokeService() {
YourServicePortType client = createServiceClient();
// Call the service method. Replace with the actual method name from your generated class
return client.yourServiceMethod("param1", "param2"); // Adjust method name and parameters
}
Пока не пробовано, пока
Подробнее здесь: https://stackoverflow.com/questions/797 ... pring-boot