use of org.geotoolkit.wps.xml.v200.Description in project axis-axis2-java-core by apache.
the class AxisService method printWSDL2.
/**
* Prints WSDL2.0 data for the service with the given host IP address.
* @param out The output stream for the data to be written for. NOTE: the stream is not closed after the operation,
* it is the responsibility of the caller to close the stream after usage.
* @param requestIP The host IP address.
* @throws AxisFault
*/
public void printWSDL2(OutputStream out, String requestIP) throws AxisFault {
// If we're looking for pre-existing WSDL, use that.
if (isUseUserWSDL()) {
printUserWSDL2(out, null, requestIP);
return;
}
AxisService2WSDL20 axisService2WSDL2 = new AxisService2WSDL20(this);
// If we find a WSDLSupplier with WSDL 2.0 content, use that
WSDLSupplier supplier = getUserDefinedWSDLSupplier("wsdl2");
if (supplier == null) {
supplier = (WSDLSupplier) getParameterValue(Constants.WSDL_SUPPLIER_PARAM);
if (supplier instanceof WSDL20SupplierTemplate) {
((WSDL20SupplierTemplate) supplier).init(this);
}
}
if (supplier != null) {
Object wsdlContent = supplier.getWSDL(this);
if (wsdlContent instanceof Description) {
try {
Description definition = (Description) wsdlContent;
if (definition != null) {
// TODO -- Need to implement this method for WSDL 2.0
// changeImportAndIncludeLocations(definition);
printDescriptionObject(definition, out, requestIP);
}
} catch (Exception e) {
printWSDLError(out, e);
}
// wsdlContent can be a OMElement
} else if (wsdlContent instanceof OMElement) {
OMElement wsdlElement = (OMElement) wsdlContent;
QName wsdlName = wsdlElement.getQName();
if (wsdlName != null && wsdlName.getLocalPart().equals("description") && wsdlName.getNamespaceURI().equals("http://www.w3.org/ns/wsdl")) {
// here ?
try {
XMLPrettyPrinter.prettify(wsdlElement, out);
out.flush();
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
}
return;
}
try {
if (requestIP != null) {
axisService2WSDL2.setEPRs(calculateEPRs(requestIP));
}
OMElement wsdlElement = axisService2WSDL2.generateOM();
wsdlElement.serialize(out);
out.flush();
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
use of org.geotoolkit.wps.xml.v200.Description in project axis-axis2-java-core by apache.
the class AxisService method printUserWSDL2.
public void printUserWSDL2(OutputStream out, String wsdlName, String ip) throws AxisFault {
Description description = null;
// first find the correct wsdl definition
Parameter wsdlParameter = getParameter(WSDLConstants.WSDL_20_DESCRIPTION);
if (wsdlParameter != null) {
description = (Description) wsdlParameter.getValue();
try {
org.apache.woden.WSDLFactory factory = org.apache.woden.WSDLFactory.newInstance();
org.apache.woden.WSDLWriter writer = factory.newWSDLWriter();
writer.writeWSDL(description.toElement(), out);
} catch (org.apache.woden.WSDLException e) {
throw AxisFault.makeFault(e);
}
}
}
use of org.geotoolkit.wps.xml.v200.Description in project geotoolkit by Geomatys.
the class WebProcessingClient method getDescribeProcess.
/**
* Perform a DescribeProcess request on the specified identifiers.
*
* @param processIDs List of process Identifiers
* @return ProcessDescriptions : WPS process description
*/
public ProcessOfferings getDescribeProcess(final List<String> processIDs) throws Exception {
ProcessOfferings description;
// Thread to prevent infinite request on a server
final DescribeProcessRequest describe = createDescribeProcess();
describe.setTimeout(getTimeOutValue());
describe.getContent().setIdentifier(processIDs);
try (final InputStream request = describe.getResponseStream()) {
final Unmarshaller unmarshaller = WPSMarshallerPool.getInstance().acquireUnmarshaller();
Object response = unmarshaller.unmarshal(request);
WPSMarshallerPool.getInstance().recycle(unmarshaller);
if (response instanceof ProcessOfferings) {
description = (ProcessOfferings) response;
} else if (response instanceof ExceptionResponse) {
ExceptionResponse report = (ExceptionResponse) response;
throw report.toException();
} else {
throw new Exception("Unexpected response type from the WPS server: " + (response == null ? "null" : response.getClass()));
}
}
return description;
}
Aggregations