use of javax.wsdl.Definition in project jbossws-cxf by jbossws.
the class JBWS2150TestCase method testRewriteWithPathRule.
/**
* Test soap:address rewrite when a path rewrite rule is specified.
*
* @throws Exception
*/
@Test
@RunAsClient
public void testRewriteWithPathRule() throws Exception {
setModifySOAPAddress(true);
final String expectedContext = "xx/jaxws-jbws2150";
final String sedCmd = "s/jaxws-jbws2150/xx\\/jaxws-jbws2150/g";
setWebServicePathRewriteRule(sedCmd);
deployer.deploy(DEP);
try {
final String serverHost = getServerHost();
final int serverPort = getServerPort();
// 8443 = 8080 + 363
final int serverSecurePort = serverPort + 363;
final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
final Map<String, String> importMap = new HashMap<String, String>();
wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", getWebServiceHost());
wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", getWebServiceHost());
wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", getWebServiceHost());
wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", getWebServiceHost());
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/" + expectedContext + "/ValidURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/" + expectedContext + "/InvalidURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL?wsdl=inner.wsdl");
for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
String wsdlLocation = entry.getKey();
String host = entry.getValue();
Definition definition = getWSDLDefinition(wsdlLocation);
String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
assertEquals("http://" + host + ":" + serverPort + "/" + expectedContext + "/ValidURL", address);
address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
assertEquals("http://" + host + ":" + serverPort + "/" + expectedContext + "/InvalidURL", address);
address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
assertEquals("https://" + host + ":" + serverSecurePort + "/" + expectedContext + "/ValidSecureURL", address);
address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
assertEquals("https://" + host + ":" + serverSecurePort + "/" + expectedContext + "/InvalidSecureURL", address);
// check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
}
} finally {
deployer.undeploy(DEP);
}
}
use of javax.wsdl.Definition in project jbossws-cxf by jbossws.
the class JBWS2150TestCase method testAutoRewriteCodeFirstPathRule.
/**
* Test soap:address rewrite for code-first endpoints when a path rewrite rule is specified and auto-rewrite is on
* (wsdl host prop set to ServerConfig.UNDEFINED_HOSTNAME)
*
* @throws Exception
*/
@Test
@RunAsClient
public void testAutoRewriteCodeFirstPathRule() throws Exception {
setModifySOAPAddress(true);
final String expectedContext = "xx/jaxws-jbws2150-codefirst";
final String sedCmd = "s/jaxws-jbws2150-codefirst/xx\\/jaxws-jbws2150-codefirst/g";
setWebServicePathRewriteRule(sedCmd);
setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
deployer.deploy(DEP_CODEFIRST);
try {
String serverHost = getServerHost();
int serverPort = getServerPort();
final String wsdlLocation = "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl";
Definition definition = getWSDLDefinition(wsdlLocation);
String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
assertEquals("http://" + serverHost + ":" + serverPort + "/" + expectedContext + "/CodeFirstService", address);
if (isTestsuiteServerHostLocalhost()) {
definition = getWSDLDefinition("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl");
address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
assertEquals("http://127.0.0.1:" + serverPort + "/" + expectedContext + "/CodeFirstService", address);
}
} finally {
deployer.undeploy(DEP_CODEFIRST);
}
}
use of javax.wsdl.Definition in project jbossws-cxf by jbossws.
the class JBWS2150TestCase method testRewriteLoadBalancerForceHttps.
/**
* Test soap:address rewrite with rewrite engine on, the webServiceHost set to a (fake) load balancer host and forced https uri scheme
*
* @throws Exception
*/
@Test
@RunAsClient
public void testRewriteLoadBalancerForceHttps() throws Exception {
setModifySOAPAddress(true);
final String testWebServiceHost = "myloadbalancer.com";
setWebServiceHost(testWebServiceHost);
setWebServiceUriScheme("https");
deployer.deploy(DEP);
try {
final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
final Map<String, String> importMap = new HashMap<String, String>();
final String serverHost = getServerHost();
final int serverPort = getServerPort();
// 8080 + 363 = 8443
final int serverSecurePort = serverPort + 363;
wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", testWebServiceHost);
wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", testWebServiceHost);
wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", testWebServiceHost);
wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", testWebServiceHost);
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
if (isTestsuiteServerHostLocalhost()) {
wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", testWebServiceHost);
wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", testWebServiceHost);
wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", testWebServiceHost);
wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", testWebServiceHost);
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
}
for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
String wsdlLocation = entry.getKey();
String host = entry.getValue();
Definition definition = getWSDLDefinition(wsdlLocation);
String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/ValidURL", address);
address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidURL", address);
address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL", address);
address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL", address);
// check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
}
} finally {
deployer.undeploy(DEP);
}
}
use of javax.wsdl.Definition in project jbossws-cxf by jbossws.
the class JBWS2150TestCase method testRewriteLoadBalancerCodeFirstForceHttps.
/**
* Test soap:address rewrite with rewrite engine on , the webServiceHost set to a (fake) load balancer host (code-first endpoint) and forced https scheme
*
* @throws Exception
*/
@Test
@RunAsClient
public void testRewriteLoadBalancerCodeFirstForceHttps() throws Exception {
setModifySOAPAddress(true);
final String testWebServiceHost = "myloadbalancer.com";
setWebServiceHost(testWebServiceHost);
setWebServiceSecurePort(443);
setWebServiceUriScheme("https");
deployer.deploy(DEP_CODEFIRST);
try {
Definition definition = getWSDLDefinition("http://" + getServerHost() + ":" + getServerPort() + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl");
String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
assertEquals("https://" + testWebServiceHost + "/jaxws-jbws2150-codefirst/CodeFirstService", address);
} finally {
deployer.undeploy(DEP_CODEFIRST);
}
}
use of javax.wsdl.Definition in project jbossws-cxf by jbossws.
the class JBWS2150TestCase method testRewriteCodeFirstPathRule.
/**
* Test soap:address rewrite for code-first endpoints when a path rewrite rule is specified
*
* @throws Exception
*/
@Test
@RunAsClient
public void testRewriteCodeFirstPathRule() throws Exception {
setModifySOAPAddress(true);
final String expectedContext = "xx/jaxws-jbws2150-codefirst";
final String sedCmd = "s/jaxws-jbws2150-codefirst/xx\\/jaxws-jbws2150-codefirst/g";
setWebServicePathRewriteRule(sedCmd);
deployer.deploy(DEP_CODEFIRST);
try {
final String serverHost = getServerHost();
final int serverPort = getServerPort();
final String wsdlLocation = "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-codefirst/CodeFirstService?wsdl";
Definition definition = getWSDLDefinition(wsdlLocation);
String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
assertEquals("http://" + getWebServiceHost() + ":" + serverPort + "/" + expectedContext + "/CodeFirstService", address);
} finally {
deployer.undeploy(DEP_CODEFIRST);
}
}
Aggregations