Java Code Examples for java.util.Vector.listIterator()

The following are Jave code examples for showing how to use listIterator() of the java.util.Vector class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: parabuild-ci   File:   Source Code and License Vote up 5 votes
 * This method sends a file as an attachment then 
 *  receives it as a return.  The returned file is
 *  compared to the source. Uses SAAJ API.
 *  @param The filename that is the source to send.
 *  @return True if sent and compared.
public boolean echoUsingSAAJ(String filename) throws Exception {
    String endPointURLString =  "http://localhost:" +opts.getPort() + "/axis/services/urn:EchoAttachmentsService";

    SOAPConnectionFactory soapConnectionFactory =
    SOAPConnection soapConnection =

    MessageFactory messageFactory =
    SOAPMessage soapMessage =
    SOAPPart soapPart = soapMessage.getSOAPPart();
    SOAPEnvelope requestEnvelope =
    SOAPBody body = requestEnvelope.getBody();
    SOAPBodyElement operation = body.addBodyElement

    Vector dataHandlersToAdd = new Vector();
    dataHandlersToAdd.add(new DataHandler(new FileDataSource(new

    if (dataHandlersToAdd != null) {
        ListIterator dataHandlerIterator =

        while (dataHandlerIterator.hasNext()) {
            DataHandler dataHandler = (DataHandler)
            javax.xml.soap.SOAPElement element =
            javax.xml.soap.AttachmentPart attachment =
                                 ("href"), "cid:" + attachment.getContentId());
    javax.xml.soap.SOAPMessage returnedSOAPMessage =
  , endPointURLString);
    Iterator iterator = returnedSOAPMessage.getAttachments();
    if (!iterator.hasNext()) {
        //The wrong type of object that what was expected.
        System.out.println("Received problem response from server");
        throw new AxisFault("", "Received problem response from server", null, null);

    //Still here, so far so good.
    //Now lets brute force compare the source attachment
    // to the one we received.
    DataHandler rdh = (DataHandler) ((AttachmentPart);

    //From here we'll just treat the data resource as file.
    String receivedfileName = rdh.getName();//Get the filename. 

    if (receivedfileName == null) {
        System.err.println("Could not get the file name.");
        throw new AxisFault("", "Could not get the file name.", null, null);

    System.out.println("Going to compare the files..");
    boolean retv = compareFiles(filename, receivedfileName); receivedFile = new;


    return retv;