use of javax.wsdl.Definition in project jbossws-cxf by jbossws.
the class JBWS2150TestCase method testRewriteWithPathRuleAndForcedHttps.
/**
* Test soap:address rewrite when a path rewrite rule is specified and https scheme is forced.
*
* @throws Exception
*/
@Test
@RunAsClient
public void testRewriteWithPathRuleAndForcedHttps() throws Exception {
setModifySOAPAddress(true);
final String expectedContext = "xx/jaxws-jbws2150";
final String sedCmd = "s/jaxws-jbws2150/xx\\/jaxws-jbws2150/g";
setWebServicePathRewriteRule(sedCmd);
setWebServiceUriScheme("https");
deployer.deploy(DEP);
try {
final String serverHost = getServerHost();
final int serverPort = getServerPort();
// 8080 + 363 = 8443
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", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/" + expectedContext + "/ValidURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/" + 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("https://" + host + ":" + serverSecurePort + "/" + expectedContext + "/ValidURL", address);
address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
assertEquals("https://" + host + ":" + serverSecurePort + "/" + 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 testSecureRewriteLoadBalancer.
/**
* [JBWS-454] Test soap:address URL rewrite according to transport guarantee
*
* @throws Exception
*/
@Test
@RunAsClient
public void testSecureRewriteLoadBalancer() throws Exception {
setModifySOAPAddress(true);
final String testWebServiceHost = "myloadbalancer.com";
setWebServiceHost(testWebServiceHost);
deployer.deploy(DEP_SEC);
try {
final Map<String, String> wsdlLocationsSecMap = new HashMap<String, String>();
final Map<String, String> importMap = new HashMap<String, String>();
final String serverHost = getServerHost();
final int serverPort = getServerPort();
// 8443 = 8080 + 363
final int serverSecurePort = serverPort + 363;
wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", testWebServiceHost);
wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", testWebServiceHost);
wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", testWebServiceHost);
wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", testWebServiceHost);
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
if (isTestsuiteServerHostLocalhost()) {
wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", testWebServiceHost);
wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", testWebServiceHost);
wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", testWebServiceHost);
wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", testWebServiceHost);
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "https://" + testWebServiceHost + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
}
for (Entry<String, String> entry : wsdlLocationsSecMap.entrySet()) {
String wsdlLocationSec = entry.getKey();
String host = entry.getValue();
Definition definition = getWSDLDefinition(wsdlLocationSec);
String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL", address);
address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL", address);
address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL", address);
address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
assertEquals("https://" + host + ":" + serverSecurePort + "/jaxws-jbws2150-sec/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(wsdlLocationSec), getWsdlImportAddress(definition));
}
} finally {
deployer.undeploy(DEP_SEC);
}
}
use of javax.wsdl.Definition in project jbossws-cxf by jbossws.
the class JBWS2150TestCase method testAutoRewriteForceHttp.
/**
* Test soap:address rewrite with rewrite engine on, the webServiceHost set to jbossws.undefined.host and forced http uri scheme
*
* @throws Exception
*/
@Test
@RunAsClient
public void testAutoRewriteForceHttp() throws Exception {
setModifySOAPAddress(true);
setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
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();
wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", serverHost);
wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", serverHost);
wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", serverHost);
wsdlLocationsMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", serverHost);
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
if (isTestsuiteServerHostLocalhost()) {
wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "127.0.0.1");
wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "127.0.0.1");
wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "127.0.0.1");
wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "127.0.0.1");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "http://127.0.0.1:" + serverPort + "/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("http://" + host + ":" + serverPort + "/jaxws-jbws2150/ValidURL", address);
address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidURL", address);
address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL", address);
address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL", address);
assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
}
} finally {
deployer.undeploy(DEP);
}
}
use of javax.wsdl.Definition in project jbossws-cxf by jbossws.
the class JBWS2183TestCase method testWsdl.
@Test
@RunAsClient
public void testWsdl() throws Exception {
URL wsdlURL = new URL(baseURL + "/jaxws-jbws2183/TestServiceImpl?wsdl");
WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
Definition wsdlDefinition = wsdlReader.readWSDL(wsdlURL.toString());
assertNotNull(wsdlDefinition);
for (Iterator<?> it = wsdlDefinition.getAllBindings().values().iterator(); it.hasNext(); ) {
List<?> extElements = ((Binding) it.next()).getExtensibilityElements();
boolean found = false;
for (int i = 0; i < extElements.size(); i++) {
ExtensibilityElement extElement = (ExtensibilityElement) extElements.get(i);
if (extElement instanceof SOAP12Binding)
found = true;
else if (extElement instanceof SOAPBinding)
fail("SOAP 1.1 Binding found!");
}
assertTrue("SOAP 1.2 Binding not found!", found);
}
}
use of javax.wsdl.Definition in project jbossws-cxf by jbossws.
the class JBWS1969TestCase method testSubDirectory.
@Test
@RunAsClient
public void testSubDirectory() throws Exception {
// WSDL and Schema files are loaded in META-INF/wsdl/echo directory
URL wsdlURL = new URL(baseURL + "/jaxws-jbws1969?wsdl");
WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
Definition wsdlDefinition = wsdlReader.readWSDL(wsdlURL.toString());
assertNotNull(wsdlDefinition);
}
Aggregations