use of javax.xml.soap.SOAPEnvelope in project pentaho-platform by pentaho.
the class XMLABaseComponent method findDiscoverRoot.
/**
* locate "root" in DisoverResponse
*/
private SOAPElement findDiscoverRoot(final SOAPMessage reply) throws SOAPException, XMLAException {
SOAPPart sp = reply.getSOAPPart();
SOAPEnvelope envelope = sp.getEnvelope();
SOAPBody body = envelope.getBody();
Name childName;
SOAPElement eResponse = null;
if (provider == 0) {
// unknown provider - recognize by prefix of DiscoverResponse
Iterator itBody = body.getChildElements();
while (itBody.hasNext()) {
Node n = (Node) itBody.next();
if (!(n instanceof SOAPElement)) {
continue;
}
Name name = ((SOAPElement) n).getElementName();
if (name.getLocalName().equals("DiscoverResponse")) {
// $NON-NLS-1$
eResponse = (SOAPElement) n;
provider = getProviderFromDiscoverResponse(envelope, eResponse);
break;
}
}
if (eResponse == null) {
throw new XMLAException(// $NON-NLS-1$
Messages.getInstance().getString("XMLABaseComponent.ERROR_0013_NO_DISCOVER_RESPONSE"));
}
} else {
if ((provider == XMLABaseComponent.PROVIDER_MICROSOFT) || (provider == XMLABaseComponent.PROVIDER_ESSBASE)) {
// Microsoft
// or
// Essbase
childName = // $NON-NLS-1$ //$NON-NLS-2$
envelope.createName("DiscoverResponse", "m", XMLABaseComponent.XMLA_URI);
} else if ((provider == XMLABaseComponent.PROVIDER_SAP) || (provider == XMLABaseComponent.PROVIDER_MONDRIAN)) {
// SAP
// or
// Mondrian
childName = // $NON-NLS-1$ //$NON-NLS-2$
envelope.createName("DiscoverResponse", "", XMLABaseComponent.XMLA_URI);
} else {
throw new IllegalArgumentException(Messages.getInstance().getString(// $NON-NLS-1$
"XMLABaseComponent.ERROR_0014_NO_PROVIDER_SPEC"));
}
eResponse = selectSingleNode(body, childName);
if (eResponse == null) {
throw new XMLAException(Messages.getInstance().getString(// $NON-NLS-1$
"XMLABaseComponent.ERROR_0015_NO_DISCOVER_RESPONSE_ELEMENT"));
}
}
SOAPElement eReturn = getDiscoverReturn(envelope, eResponse);
if (eReturn == null) {
throw new XMLAException(Messages.getInstance().getString(// $NON-NLS-1$
"XMLABaseComponent.ERROR_0016_NO_RESULT_RETURN_ELEMENT"));
}
SOAPElement eRoot = getDiscoverRoot(envelope, eReturn);
if (eRoot == null) {
throw new XMLAException(// $NON-NLS-1$
Messages.getInstance().getString("XMLABaseComponent.ERROR_0017_NO_RESULT_ROOT_ELEMENT"));
}
return eRoot;
}
use of javax.xml.soap.SOAPEnvelope in project pentaho-platform by pentaho.
the class XMLABaseComponent method findExecRoot.
/**
* locate "root" in ExecuteResponse
*/
private SOAPElement findExecRoot(final SOAPMessage reply) throws SOAPException, XMLAException {
SOAPPart sp = reply.getSOAPPart();
SOAPEnvelope envelope = sp.getEnvelope();
SOAPBody body = envelope.getBody();
Name name;
// $NON-NLS-1$//$NON-NLS-2$
name = envelope.createName("ExecuteResponse", "m", XMLABaseComponent.XMLA_URI);
SOAPElement eResponse = selectSingleNode(body, name);
if (eResponse == null) {
throw new XMLAException(Messages.getInstance().getString(// $NON-NLS-1$
"XMLABaseComponent.ERROR_0011_NO_EXECUTE_RESPONSE_ELEMENT"));
}
// $NON-NLS-1$//$NON-NLS-2$
name = envelope.createName("return", "m", XMLABaseComponent.XMLA_URI);
SOAPElement eReturn = selectSingleNode(eResponse, name);
// $NON-NLS-1$//$NON-NLS-2$
name = envelope.createName("root", "", XMLABaseComponent.MDD_URI);
SOAPElement eRoot = selectSingleNode(eReturn, name);
if (eRoot == null) {
throw new XMLAException(Messages.getInstance().getString("XMLABaseComponent.ERROR_0012_NO_RESPONSE_ROOT_ELEMENT"));
}
// $NON-NLS-1$
return eRoot;
}
Aggregations