26
26
import org .reficio .ws .builder .SoapOperation ;
27
27
import org .reficio .ws .builder .core .Wsdl ;
28
28
import org .reficio .ws .client .core .SoapClient ;
29
+ import org .reficio .ws .common .ResourceUtils ;
29
30
30
31
// @Server annotation spawns an instance of a SoapServer for the lifespan of the test / method.
31
32
// The SOAP server provides a SOAP auto-responder for the specified binding -> messages are generated and send automatically.
34
35
// In order to enable the @Server annotation a junit @Rule has to be defined (JUnit requirement):
35
36
// - org.junit.ClassRule in order to enable the @Server on a per-class basis
36
37
// - org.junit.Rule in order to enable the @Server on a per-class basis
37
- @ Server (wsdl = "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL " , binding = "CurrencyConvertorSoap" )
38
+ @ Server (wsdl = "classpath:wsdl/currency-convertor.wsdl " , binding = "CurrencyConvertorSoap" )
38
39
public class SoapRuleTest {
39
40
40
41
private final static Logger log = Logger .getLogger (SoapRuleTest .class );
41
- private static final String WSDL = "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL" ;
42
+ private static final String WSDL = ResourceUtils . getResource ( "wsdl/currency-convertor.wsdl" ). toString () ;
42
43
43
44
@ Rule
44
45
// define an instance rule if the @Server annotation is used per method
@@ -49,7 +50,7 @@ public class SoapRuleTest {
49
50
public static SoapRule classRule = new SoapRule ();
50
51
51
52
@ Test
52
- @ Server (wsdl = WSDL , binding = "CurrencyConvertorSoap" , port = 41414 )
53
+ @ Server (wsdl = "classpath:wsdl/currency-convertor.wsdl" , binding = "CurrencyConvertorSoap" , port = 41414 )
53
54
public void testSoapMock_perMethodServer () {
54
55
SoapClient client = SoapClient .builder ().endpointUri ("http://localhost:41414/service" ).build ();
55
56
SoapBuilder builder = Wsdl .parse (WSDL ).binding ().localPart ("CurrencyConvertorSoap" ).find ();
0 commit comments