use of org.apache.soap.SOAPException in project iaf by ibissource.
the class SoapConfigManager method loadRegistry.
public void loadRegistry() throws SOAPException {
URL servicesRegistry;
String message;
try {
servicesRegistry = context.getResource(filename);
} catch (MalformedURLException e) {
message = "cannot find URL for registry from resource-name '" + filename + "'";
log.error(message, e);
throw new SOAPException(Constants.FAULT_CODE_SERVER, message, e);
}
if (servicesRegistry == null) {
message = "cannot find registry from resource-name '" + filename + "'";
log.error(message);
throw new SOAPException(Constants.FAULT_CODE_SERVER, message);
}
Element element = null;
try {
Document document = xdb.parse(servicesRegistry.openStream());
element = document.getDocumentElement();
} catch (Exception e) {
message = "exception while reading servicesRegistry from " + servicesRegistry;
log.error(message, e);
throw new SOAPException(Constants.FAULT_CODE_SERVER, message, e);
}
log.info("loading servicesRegistry from " + servicesRegistry);
;
NodeList nodelist = element.getElementsByTagNameNS("http://xml.apache.org/xml-soap/deployment", "service");
int i = nodelist.getLength();
dds = new Hashtable();
for (int j = 0; j < i; j++) {
Element element1 = (Element) nodelist.item(j);
DeploymentDescriptor deploymentdescriptor = DeploymentDescriptor.fromXML(element1);
String s = deploymentdescriptor.getID();
log.info("deploying service " + s);
dds.put(s, deploymentdescriptor);
}
}
use of org.apache.soap.SOAPException in project iaf by ibissource.
the class SoapGenericProvider method invoke.
public void invoke(SOAPContext reqContext, SOAPContext resContext) throws SOAPException {
try {
String targetObjectURI = (String) reqContext.getProperty(TARGET_OBJECT_URI_KEY);
if (log.isDebugEnabled()) {
log.debug("Invoking service for targetObjectURI=[" + targetObjectURI + "]");
}
// String message=soapWrapper.getBody(reqContext.getBodyPart(0).getContent().toString());
String message = reqContext.getBodyPart(0).getContent().toString();
HttpServletRequest httpRequest = (HttpServletRequest) reqContext.getProperty(Constants.BAG_HTTPSERVLETREQUEST);
HttpServletResponse httpResponse = (HttpServletResponse) reqContext.getProperty(Constants.BAG_HTTPSERVLETRESPONSE);
ISecurityHandler securityHandler = new HttpSecurityHandler(httpRequest);
Map messageContext = new HashMap();
messageContext.put(IPipeLineSession.securityHandlerKey, securityHandler);
messageContext.put("httpListenerServletRequest", httpRequest);
messageContext.put("httpListenerServletResponse", httpResponse);
String result = sd.dispatchRequest(targetObjectURI, null, message, messageContext);
// resContext.setRootPart( soapWrapper.putInEnvelope(result,null), Constants.HEADERVAL_CONTENT_TYPE_UTF8);
resContext.setRootPart(result, Constants.HEADERVAL_CONTENT_TYPE_UTF8);
} catch (Exception e) {
// log.warn("GenericSoapProvider caught exception:",e);
if (e instanceof SOAPException) {
throw (SOAPException) e;
}
SOAPException se = new SOAPException(Constants.FAULT_CODE_SERVER, "GenericSoapProvider caught exception");
se.initCause(e);
throw se;
}
}
use of org.apache.soap.SOAPException in project iaf by ibissource.
the class ServiceDispatcher_ServiceProxy method dispatchRequest.
/**
* Dispatch a request.
* @param servicename ServiceName
* @param correlationId CorrelationID
* @param message Message
* @return String the result
* @throws SOAPException
*/
public String dispatchRequest(String servicename, String correlationId, String message) throws SOAPException {
Call call = new Call();
call.setTargetObjectURI("urn:service-dispatcher");
call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
String SOAPActionURI = "urn:service-dispatcher";
if (url == null) {
throw new SOAPException(Constants.FAULT_CODE_CLIENT, "A URL must be specified via " + "ServiceDispatcher_ServiceProxy.setEndPoint(URL).");
}
call.setMethodName("dispatchRequest");
Vector params = new Vector();
params.addElement(new Parameter("meth1_inType1", String.class, servicename, null));
params.addElement(new Parameter("meth1_inType2", String.class, correlationId, null));
params.addElement(new Parameter("meth1_inType3", String.class, message, null));
call.setParams(params);
Response resp = call.invoke(url, SOAPActionURI);
// Check the response.
if (resp.generatedFault()) {
Fault fault = resp.getFault();
throw new SOAPException(fault.getFaultCode(), fault.getFaultString());
} else {
Parameter retValue = resp.getReturnValue();
return (String) retValue.getValue();
}
}
Aggregations