use of org.apache.axis2.addressing.metadata.WSDLLocation in project axis-axis2-java-core by apache.
the class PackageSetBuilder method getWSDLDefinition.
private static Definition getWSDLDefinition(String wsdlLoc) {
Definition wsdlDefinition = null;
final String wsdlLocation = wsdlLoc;
if (wsdlLocation != null && wsdlLocation.trim().length() > 0) {
try {
wsdlDefinition = (Definition) AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws MalformedURLException, IOException, WSDLException {
String baseDir = new File(System.getProperty("basedir", ".")).getCanonicalPath();
String wsdlLocationPath = new File(baseDir + File.separator + wsdlLocation).getAbsolutePath();
File file = new File(wsdlLocationPath);
URL url = file.toURI().toURL();
if (log.isDebugEnabled()) {
log.debug("Reading WSDL from URL:" + url.toString());
}
// This is a temporary wsdl and we use it to dig into the schemas,
// Thus the memory limit is set to false. It will be discarded after it is used
// by the PackageSetBuilder implementation.
WSDLWrapper wsdlWrapper = new WSDL4JWrapper(url, false, 0);
return wsdlWrapper.getDefinition();
}
});
} catch (PrivilegedActionException e) {
// Swallow and continue
if (log.isDebugEnabled()) {
log.debug("Exception getting wsdlLocation: " + e.getException());
}
}
}
return wsdlDefinition;
}
use of org.apache.axis2.addressing.metadata.WSDLLocation in project axis-axis2-java-core by apache.
the class BindingProvider method getEndpointReference.
/*
* (non-Javadoc)
* @see javax.xml.ws.BindingProvider#getEndpointReference(java.lang.Class)
*/
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz) {
EndpointReference jaxwsEPR = null;
String addressingNamespace = EndpointReferenceUtils.getAddressingNamespace(clazz);
try {
org.apache.axis2.addressing.EndpointReference epr = binding.getAxis2EndpointReference();
if (epr == null) {
String address = (String) requestContext.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
if (address == null)
address = endpointDesc.getEndpointAddress();
QName service = endpointDesc.getServiceQName();
QName port = endpointDesc.getPortQName();
// let the webcontainer redirect us to the real WSDL URL; it knows where it is
String wsdlLocation = "?wsdl";
epr = EndpointReferenceUtils.createAxis2EndpointReference(address, service, port, wsdlLocation, addressingNamespace);
// Add reference parameters from WSDL to the EPR
AxisService axisService = endpointDesc.getAxisService();
if (axisService != null) {
AxisEndpoint axisEndpoint = axisService.getEndpoint(axisService.getEndpointName());
if (axisEndpoint != null) {
ArrayList referenceParameters = (ArrayList) axisEndpoint.getParameterValue(AddressingConstants.REFERENCE_PARAMETER_PARAMETER);
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace("getEndpointReference: Adding reference parameters to EPR from WSDL: axisService = " + axisService + ", axisEndpoint = " + axisEndpoint.getName() + ", referenceParameters = " + referenceParameters);
}
if (referenceParameters != null) {
Iterator iterator = referenceParameters.iterator();
HashMap<QName, OMElement> refParamMap = new HashMap<QName, OMElement>();
while (iterator.hasNext()) {
OMElement omElement = (OMElement) iterator.next();
refParamMap.put(omElement.getQName(), omElement);
}
epr.setReferenceParameters(refParamMap);
}
}
}
} else if (!addressingNamespace.equals(binding.getAddressingNamespace())) {
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("bindingProviderErr1", binding.getAddressingNamespace(), addressingNamespace));
}
jaxwsEPR = EndpointReferenceUtils.convertFromAxis2(epr, addressingNamespace);
} catch (UnsupportedOperationException e) {
throw e;
} catch (WebServiceException e) {
throw e;
} catch (Exception e) {
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointRefConstructionFailure3", e.toString()));
}
return clazz.cast(jaxwsEPR);
}
Aggregations