public InputSource getBaseInputSource() { final ZipEntry entry = moduleFile.getEntry(wsdlURI.toString()); if (entry == null) { throw new ServerRuntimeException("The webservices.xml file points to a non-existant WSDL file " + wsdlURI.toString()); } final InputStream wsdlInputStream; try { wsdlInputStream = moduleFile.getInputStream(entry); streams.add(wsdlInputStream); } catch (final Exception e) { throw new ServerRuntimeException("Could not open stream to wsdl file", e); } return new InputSource(wsdlInputStream); }
public InputSource getImportInputSource(final String parentLocation, final String relativeLocation) { final URI parentURI = URI.create(parentLocation); latestImportURI = parentURI.resolve(relativeLocation); final InputStream importInputStream; try { final ZipEntry entry = moduleFile.getEntry(latestImportURI.toString()); importInputStream = moduleFile.getInputStream(entry); streams.add(importInputStream); } catch (final Exception e) { throw new ServerRuntimeException("Could not open stream to import file", e); } final InputSource inputSource = new InputSource(importInputStream); inputSource.setSystemId(getLatestImportURI()); return inputSource; }
private void forkServerProcess() { try { final ArrayList<String> cmd = new ArrayList<String>(); final String s = java.io.File.separator; //Not really required here for exec, but as a reminder that we run on all platforms final boolean isWindows = System.getProperty("os.name").toLowerCase().contains("win"); String java = System.getProperty("java.home") + s + "bin" + s + (isWindows ? "java.exe" : "java"); cmd.add(java); addSystemProperties(cmd); cmd.add("-classpath"); cmd.add(getClasspath()); cmd.add("org.apache.openejb.server.Main"); final String[] command = cmd.toArray(new String[cmd.size()]); final Runtime runtime = Runtime.getRuntime(); Process server = runtime.exec(command); InputStream out = server.getInputStream(); Thread serverOut = new Thread(new Pipe(out, System.out)); serverOut.setDaemon(true); serverOut.start(); final InputStream err = server.getErrorStream(); Thread serverErr = new Thread(new Pipe(err, System.err)); serverErr.setDaemon(true); serverErr.start(); } catch (Exception e) { throw new ServerRuntimeException("Cannot start the server."); } }
private SOAPBody getBody(final SOAPMessage message) { try { return message.getSOAPPart().getEnvelope().getBody(); } catch (final SOAPException e) { throw new ServerRuntimeException(e); } }
private void saveChanges(final MessageContext context) { try { final SOAPMessage message = ((SOAPMessageContext) context).getMessage(); if (message != null) { message.saveChanges(); } } catch (final SOAPException e) { throw new ServerRuntimeException("Unable to save changes to SOAPMessage : " + e.toString()); } }
private static void initDefaultSAAJProvider() { final String provider = SystemInstance.get().getOptions().get(SAAJ_PROVIDER_PROPERTY, "sun"); // sun is the best default we can get + can impact perfs a lot if (provider != null) { if (provider.equalsIgnoreCase("axis2")) { DEFAULT_SAAJ_UNIVERSE = SaajUniverse.Type.AXIS2; } else if (provider.equalsIgnoreCase("sun")) { DEFAULT_SAAJ_UNIVERSE = SaajUniverse.Type.SUN; } else if (provider.equalsIgnoreCase("default")) { DEFAULT_SAAJ_UNIVERSE = null; } else { throw new ServerRuntimeException("Invalid SAAJ universe specified: " + provider); } if (DEFAULT_SAAJ_UNIVERSE != null) { logger.info("Default SAAJ universe: " + DEFAULT_SAAJ_UNIVERSE); } else { logger.info("Default SAAJ universe not set"); } } else { logger.info("Default SAAJ universe not set"); } }
private static void initDefaultSAAJProvider() { final String provider = SystemInstance.get().getOptions().get(SAAJ_PROVIDER_PROPERTY, "sun"); // sun is the best default we can get + can impact perfs a lot if (provider != null) { if (provider.equalsIgnoreCase("axis2")) { DEFAULT_SAAJ_UNIVERSE = SaajUniverse.Type.AXIS2; } else if (provider.equalsIgnoreCase("sun")) { DEFAULT_SAAJ_UNIVERSE = SaajUniverse.Type.SUN; } else if (provider.equalsIgnoreCase("default")) { DEFAULT_SAAJ_UNIVERSE = null; } else { throw new ServerRuntimeException("Invalid SAAJ universe specified: " + provider); } if (DEFAULT_SAAJ_UNIVERSE != null) { logger.info("Default SAAJ universe: " + DEFAULT_SAAJ_UNIVERSE); } else { logger.info("Default SAAJ universe not set"); } } else { logger.info("Default SAAJ universe not set"); } }
public void createResult(final Object object) { messageContext.setPastPivot(true); try { final Message requestMessage = messageContext.getRequestMessage(); final SOAPEnvelope requestEnvelope = requestMessage.getSOAPEnvelope(); final RPCElement requestBody = getBody(requestEnvelope, messageContext); final Message responseMessage = messageContext.getResponseMessage(); final SOAPEnvelope responseEnvelope = responseMessage.getSOAPEnvelope(); final ServiceDesc serviceDescription = messageContext.getService().getServiceDescription(); final RPCElement responseBody = createResponseBody(requestBody, messageContext, operation, serviceDescription, object, responseEnvelope, getInOutParams()); responseEnvelope.removeBody(); responseEnvelope.addBodyElement(responseBody); } catch (final Exception e) { throw new ServerRuntimeException("Failed while creating response message body", e); } }
final MethodProxy methodProxy = MethodProxy.find(serviceEndpointClass, signature); if (methodProxy == null) { throw new ServerRuntimeException("No method proxy for operationInfo " + signature);
final OperationInfo operationInfo = operations[index]; if (operationInfo == null) { throw new ServerRuntimeException("Operation not mapped: " + method.getName() + " index: " + index + "\n OperationInfos: " + Arrays.asList(operations)); return null; } else { throw new ServerRuntimeException("Invalid messaging style: " + operationInfo.getOperationDesc().getMep());
return; } else if (responseMessage == null) { responseMessage = handleException(messageContext, null, new ServerRuntimeException("No response for non-one-way operation"));
reserialize((SoapMessage) inMessage); } catch (Exception e) { throw new ServerRuntimeException("Failed to reserialize soap message", e);
reserialize((SoapMessage) inMessage); } catch (final Exception e) { throw new ServerRuntimeException("Failed to reserialize soap message", e);