Java SOAP Message printSoapFaultException(SOAPFaultException sfe)

Here you can find the source of printSoapFaultException(SOAPFaultException sfe)

Description

print Soap Fault Exception

License

Apache License

Parameter

Parameter Description
sfe the SOAP fault exception to be printed

Declaration

private static void printSoapFaultException(SOAPFaultException sfe) 

Method Source Code

//package com.java2s;
/**//from w  ww. j a v  a2  s. c  om
 *
 * "Checkpoint Charlie" POC
 * 
 * Copyright 2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *
 **/

import javax.xml.ws.soap.SOAPFaultException;
import org.apache.log4j.*;

public class Main {
    /**
     * This class opens a connection to the indicated ESX server, using the supplied credentials, and then 
     * creates a snapshot of the specified Virtual Machine.  
     * 
     * TODO: Known issues:
     * 
     *  a)  Right now the credentials and the name of the ESX server to connect to, as well as the specific 
     *  VM to snapshot, are all hard-coded.  This is just a demonstration of feasibility, and so this should
     *  not be construed as production code.  This software is not to be used for any customer's production 
     *  deployment.  These limitations are easy to fix if a production-ready version is needed.
     * 
     *  b) This class makes use of some sample code found in the VMware vSphere SDK. This is because this is 
     *  just a POC and good programmers are lazy, and because there really aren't that many choices in how one would 
     *  implement this function anyway.  AFIAK, this use is perfectly consistent with the original VMware SDK 
     *  license terms of use. In any case, some portions must be re-implemented if this effort were to move beyond 
     *  the developer POC stage.  In particular:  build a real trust manager, improve traversal spec, improve 
     *  connection logic (to provide HA fail-over and/or pooling), etc. 
     * 
     **/

    private static Logger snapshotLogger = Logger.getLogger("io.pivotal.aspects.checkpoint.VMSnapshotUtil");

    /**
     * 
     * @param sfe  the SOAP fault exception to be printed
     */
    private static void printSoapFaultException(SOAPFaultException sfe) {
        snapshotLogger.log(Level.INFO, "SOAP Fault -");
        if (sfe.getFault().hasDetail()) {
            snapshotLogger.log(Level.INFO, sfe.getFault().getDetail().getFirstChild().getLocalName());
        }
        if (sfe.getFault().getFaultString() != null) {
            System.out.println("\n Message: " + sfe.getFault().getFaultString());
        }
    }
}

Related

  1. isOutgoingMessage(SOAPMessageContext smc)
  2. isSOAP12(SOAPMessage soapMessage)
  3. isSOAP12(SOAPMessage soapMessage)
  4. isSOAPFault(SOAPMessage messageSOAP)
  5. printMessage(SOAPMessageContext smc)
  6. printSOAPMessage(SOAPMessage msg, String titol)
  7. printTree(NodeList childNodes, String padding, ByteArrayOutputStream byteArrayOS)
  8. saveMimeHeaders(SOAPMessage msg, String fileName)
  9. toByteArray(SOAPMessage soapMessage)