use of javax.wsdl.Definition in project jbossws-cxf by jbossws.
the class WSDLFilePublisher method publishWsdlFiles.
/**
* Publish the deployed wsdl file to the data directory
*/
public void publishWsdlFiles(QName serviceName, String wsdlLocation, Bus bus, List<ServiceInfo> serviceInfos) throws IOException {
String deploymentName = dep.getCanonicalName();
File wsdlFile = getPublishLocation(serviceName.getLocalPart(), deploymentName, wsdlLocation);
if (wsdlFile == null)
return;
createParentDir(wsdlFile);
try {
// Write the wsdl def to file
ServiceWSDLBuilder builder = new ServiceWSDLBuilder(bus, serviceInfos);
Definition def = builder.build();
Document doc = getWsdlDocument(bus, def);
writeDocument(doc, wsdlFile);
URL wsdlPublishURL = new URL(URLDecoder.decode(wsdlFile.toURI().toURL().toExternalForm(), "UTF-8"));
Loggers.DEPLOYMENT_LOGGER.wsdlFilePublished(wsdlPublishURL);
// Process the wsdl imports
if (def != null) {
List<String> published = new LinkedList<String>();
String expLocation = getExpLocation(wsdlLocation);
publishWsdlImports(wsdlPublishURL, def, published, expLocation);
// Publish XMLSchema imports
publishSchemaImports(wsdlPublishURL, doc.getDocumentElement(), published, expLocation);
dep.addAttachment(WSDLFilePublisher.class, this);
} else {
throw Messages.MESSAGES.wsdl20NotSupported();
}
} catch (RuntimeException rte) {
throw rte;
} catch (Exception e) {
throw Messages.MESSAGES.cannotPublishWSDLTo(serviceName, wsdlFile, e);
}
}
use of javax.wsdl.Definition in project jbossws-cxf by jbossws.
the class JBWS2150TestCase method testSecureRewriteOverriddenByForcedHttp.
/**
* Test soap:address URL rewrite according to transport guarantee is overridden by forced http uri scheme
*
* @throws Exception
*/
@Test
@RunAsClient
public void testSecureRewriteOverriddenByForcedHttp() throws Exception {
setModifySOAPAddress(true);
setWebServiceUriScheme("http");
setWebServicePort(80);
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();
wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", getWebServiceHost());
wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", getWebServiceHost());
wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", getWebServiceHost());
wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", getWebServiceHost());
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
if (isTestsuiteServerHostLocalhost()) {
wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", getWebServiceHost());
wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", getWebServiceHost());
wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", getWebServiceHost());
wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", getWebServiceHost());
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "http://" + getWebServiceHost() + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "http://" + getWebServiceHost() + "/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("http://" + host + "/jaxws-jbws2150-sec/ValidURL", address);
address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
assertEquals("http://" + host + "/jaxws-jbws2150-sec/InvalidURL", address);
address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
assertEquals("http://" + host + "/jaxws-jbws2150-sec/ValidSecureURL", address);
address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
assertEquals("http://" + host + "/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 testSecureRewrite.
/**
* [JBWS-454] Test soap:address URL rewrite according to transport guarantee
*
* @throws Exception
*/
@Test
@RunAsClient
public void testSecureRewrite() throws Exception {
setModifySOAPAddress(true);
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", getWebServiceHost());
wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", getWebServiceHost());
wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", getWebServiceHost());
wsdlLocationsSecMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", getWebServiceHost());
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl=inner.wsdl");
if (isTestsuiteServerHostLocalhost()) {
wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", getWebServiceHost());
wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", getWebServiceHost());
wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", getWebServiceHost());
wsdlLocationsSecMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", getWebServiceHost());
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/InvalidURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150-sec/ValidSecureURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150-sec/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + 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 testRewrite.
/**
* Test soap:address rewrite with rewrite engine on
*
* @throws Exception
*/
@Test
@RunAsClient
public void testRewrite() throws Exception {
setModifySOAPAddress(true);
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();
// 8443 = 8080 + 363
final int serverSecurePort = serverPort + 363;
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 + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150/InvalidSecureURL?wsdl=inner.wsdl");
if (isTestsuiteServerHostLocalhost()) {
wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", getWebServiceHost());
wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", getWebServiceHost());
wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", getWebServiceHost());
wsdlLocationsMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", getWebServiceHost());
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/jaxws-jbws2150/ValidURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl", "http://" + getWebServiceHost() + ":" + serverPort + "/jaxws-jbws2150/InvalidURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/ValidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + getWebServiceHost() + ":" + 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("http://" + host + ":" + serverPort + "/jaxws-jbws2150/ValidURL", address);
// avoid invoking on https endpoints as that would require getting the imported wsdl using https...
if (!wsdlLocation.contains("Secure")) {
ServiceIface endpoint = getEndpoint(wsdlLocation, "ValidURLService");
assertEquals(endpoint.echo("hello"), "hello");
}
address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidURL", address);
if (!wsdlLocation.contains("Secure")) {
ServiceIface endpoint = getEndpoint(wsdlLocation, "InvalidURLService");
assertEquals(endpoint.echo("hello"), "hello");
}
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 testAutoRewrite.
/**
* Test soap:address rewrite with rewrite engine on and the webServiceHost set to jbossws.undefined.host
*
* @throws Exception
*/
@Test
@RunAsClient
public void testAutoRewrite() 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();
// 8080 + 363 = 8443
final int serverSecurePort = serverPort + 363;
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", "https://" + serverHost + ":" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
importMap.put("http://" + serverHost + ":" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://" + serverHost + ":" + serverSecurePort + "/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", "https://127.0.0.1:" + serverSecurePort + "/jaxws-jbws2150/ValidSecureURL?wsdl=inner.wsdl");
importMap.put("http://127.0.0.1:" + serverPort + "/jaxws-jbws2150/InvalidSecureURL?wsdl", "https://127.0.0.1:" + 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("http://" + host + ":" + serverPort + "/jaxws-jbws2150/ValidURL", address);
address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
assertEquals("http://" + host + ":" + serverPort + "/jaxws-jbws2150/InvalidURL", address);
// check wsdl import address rewrite (we expect a rewritten version of the same base address used to fetch the wsdl)
if (!wsdlLocation.contains("Secure")) {
assertEquals(importMap.get(wsdlLocation), getWsdlImportAddress(definition));
}
}
} finally {
deployer.undeploy(DEP);
}
}
Aggregations