Java Code Examples for org.apache.axis.utils.Messages

The following examples show how to use org.apache.axis.utils.Messages. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: openbd-core   Source File: cfcInvoker.java    License: GNU General Public License v3.0 6 votes vote down vote up
public Object invokeCFCFunction(MessageContext msgContext, cfSession session, String cfcName, cfStructData method, Object[] argValues) throws Exception {
	// Create the cfc
	cfComponentData cfc = new cfComponentData(session, cfcName);
	if (cfc == null || cfc.getMetaData() == null || cfc.getMetaData().isEmpty())
		throw new AxisFault(Messages.getMessage("noClassForService00", cfcName));

	// Convert the params
	cfArgStructData args = prepareArgs(session, method, argValues);

	// Execute the cfc
	cfData rtn = invokeComponentMethod(session, method, args, cfc);
	if (rtn == null || rtn instanceof cfNullData)
		return null;
	else {
		return tagUtils.getNatural(rtn, true, true, true);
	}
}
 
Example 2
/**
 * Closes this <CODE>SOAPConnection</CODE> object.
 * @throws  SOAPException if there is a SOAP error
 */
public void close() throws SOAPException {
    if(closed){
        throw new SOAPException(Messages.getMessage("connectionClosed00"));
    }
    closed = true;
}
 
Example 3
Source Project: tomee   Source File: AxisWsContainer.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * print a snippet of service info.
 *
 * @param response    response
 * @param serviceName Name of the service
 */

private void printServiceInfo(final HttpResponse response, final String serviceName) throws IOException {
    response.setContentType("text/html; charset=utf-8");
    final StringBuffer output = new StringBuffer("<h1>")
        .append(serviceName).append("</h1>\n");

    output.append("<p>").append(Messages.getMessage("axisService00"))
        .append("</p>\n");
    output.append(
        "<i>").append(
        Messages.getMessage("perhaps00")).append(
        "</i>\n");
    response.getOutputStream().write(output.toString().getBytes());
}
 
Example 4
Source Project: googleads-java-lib   Source File: HttpHandler.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns a new Axis Message based on the contents of the HTTP response.
 *
 * @param httpResponse the HTTP response
 * @return an Axis Message for the HTTP response
 * @throws IOException if unable to retrieve the HTTP response's contents
 * @throws AxisFault if the HTTP response's status or contents indicate an unexpected error, such
 *     as a 405.
 */
private Message createResponseMessage(HttpResponse httpResponse) throws IOException, AxisFault {
  int statusCode = httpResponse.getStatusCode();
  String contentType = httpResponse.getContentType();
  // The conditions below duplicate the logic in CommonsHTTPSender and HTTPSender.
  boolean shouldParseResponse =
      (statusCode > 199 && statusCode < 300)
          || (contentType != null
              && !contentType.equals("text/html")
              && statusCode > 499
              && statusCode < 600);
  // Wrap the content input stream in a notifying stream so the stream event listener will be
  // notified when it is closed.
  InputStream responseInputStream =
      new NotifyingInputStream(httpResponse.getContent(), inputStreamEventListener);
  if (!shouldParseResponse) {
    // The contents are not an XML response, so throw an AxisFault with
    // the HTTP status code and message details.
    String statusMessage = httpResponse.getStatusMessage();
    AxisFault axisFault =
        new AxisFault("HTTP", "(" + statusCode + ")" + statusMessage, null, null);
    axisFault.addFaultDetail(
        Constants.QNAME_FAULTDETAIL_HTTPERRORCODE, String.valueOf(statusCode));
    try (InputStream stream = responseInputStream) {
      byte[] contentBytes = ByteStreams.toByteArray(stream);
      axisFault.setFaultDetailString(
          Messages.getMessage(
              "return01", String.valueOf(statusCode), new String(contentBytes, UTF_8)));
    }
    throw axisFault;
  }
  // Response is an XML response. Do not consume and close the stream in this case, since that
  // will happen later when the response is deserialized by Axis (as confirmed by unit tests for
  // this class).
  Message responseMessage =
      new Message(
          responseInputStream, false, contentType, httpResponse.getHeaders().getLocation());
  responseMessage.setMessageType(Message.RESPONSE);
  return responseMessage;
}