Example usage for java.net Authenticator setDefault

List of usage examples for java.net Authenticator setDefault

Introduction

In this page you can find the example usage for java.net Authenticator setDefault.

Prototype

public static synchronized void setDefault(Authenticator a) 

Source Link

Document

Sets the authenticator that will be used by the networking code when a proxy or an HTTP server asks for authentication.

Usage

From source file:com.adito.install.forms.ConfigureProxiesForm.java

public void apply(AbstractWizardSequence sequence) throws Exception {
    sequence.putAttribute(ATTR_USE_SOCKS_PROXY, String.valueOf(useSOCKSProxy));
    sequence.putAttribute(ATTR_USE_HTTP_PROXY, String.valueOf(useHTTPProxy));
    sequence.putAttribute(ATTR_SOCKS_PROXY_HOSTNAME, socksProxyHostname);
    sequence.putAttribute(ATTR_SOCKS_PROXY_PORT, socksProxyPort);
    sequence.putAttribute(ATTR_SOCKS_PROXY_USERNAME, socksProxyUsername);
    sequence.putAttribute(ATTR_SOCKS_PROXY_PASSWORD, socksProxyPassword);
    sequence.putAttribute(ATTR_HTTP_PROXY_HOSTNAME, httpProxyHostname);
    sequence.putAttribute(ATTR_HTTP_PROXY_PORT, httpProxyPort);
    sequence.putAttribute(ATTR_HTTP_PROXY_USERNAME, httpProxyUsername);
    sequence.putAttribute(ATTR_HTTP_PROXY_PASSWORD, httpProxyPassword);
    sequence.putAttribute(ATTR_HTTP_NON_PROXY_HOSTS, httpNonProxyHosts);

    String socksUsername = null, socksPassword = null, httpUsername = null, httpPassword = null;

    // Configure proxy settings as entered in the wizard sequence. 
    if (sequence.getAttribute(ConfigureProxiesForm.ATTR_USE_SOCKS_PROXY, "").equals("true")) {
        if (log.isInfoEnabled())
            log.info("Configuring outgoing TCP/IP connections to use a SOCKS proxy server.");
        System.setProperty("socksProxyHost",
                (String) sequence.getAttribute(ConfigureProxiesForm.ATTR_SOCKS_PROXY_HOSTNAME, ""));
        System.setProperty("socksProxyPort",
                (String) sequence.getAttribute(ConfigureProxiesForm.ATTR_SOCKS_PROXY_PORT, "1080"));
        socksUsername = (String) sequence.getAttribute(ConfigureProxiesForm.ATTR_SOCKS_PROXY_USERNAME, "");
        socksPassword = (String) sequence.getAttribute(ConfigureProxiesForm.ATTR_SOCKS_PROXY_PASSWORD, "");
    }// ww  w  .ja v a2s.  com
    if (sequence.getAttribute(ConfigureProxiesForm.ATTR_USE_HTTP_PROXY, "").equals("true")) {
        if (log.isInfoEnabled())
            log.info("Configuring outgoing web connections to use a HTTP proxy server.");
        System.setProperty("http.proxyHost",
                (String) sequence.getAttribute(ConfigureProxiesForm.ATTR_HTTP_PROXY_HOSTNAME, ""));
        System.setProperty("com.maverick.ssl.https.HTTPProxyHostname",
                (String) sequence.getAttribute(ConfigureProxiesForm.ATTR_HTTP_PROXY_HOSTNAME, ""));
        System.setProperty("http.proxyPort",
                (String) sequence.getAttribute(ConfigureProxiesForm.ATTR_HTTP_PROXY_PORT, "3128"));
        System.setProperty("com.maverick.ssl.https.HTTPProxyPort",
                (String) sequence.getAttribute(ConfigureProxiesForm.ATTR_HTTP_PROXY_PORT, "3128"));
        PropertyList list = (PropertyList) sequence.getAttribute(ConfigureProxiesForm.ATTR_HTTP_NON_PROXY_HOSTS,
                null);
        StringBuffer hosts = new StringBuffer();
        for (Iterator i = list.iterator(); i.hasNext();) {
            if (hosts.length() != 0) {
                hosts.append("|");
            }
            hosts.append(i.next());
        }
        System.setProperty("http.nonProxyHosts", hosts.toString());
        System.setProperty("com.maverick.ssl.https.HTTPProxyNonProxyHosts", hosts.toString());
        httpUsername = (String) sequence.getAttribute(ConfigureProxiesForm.ATTR_HTTP_PROXY_USERNAME, "");
        httpPassword = (String) sequence.getAttribute(ConfigureProxiesForm.ATTR_HTTP_PROXY_PASSWORD, "");
        System.setProperty("com.maverick.ssl.https.HTTPProxySecure", "false");
    }
    if (httpUsername != null || socksUsername != null) {
        Authenticator
                .setDefault(new ProxyAuthenticator(socksUsername, socksPassword, httpUsername, httpPassword));
    }

    ExtensionStore.getInstance().resetExtensionStoreUpdate();
    try {
        ExtensionStore.getInstance().getDownloadableExtensionStoreDescriptor(true);
        sequence.removeAttribute(ATTR_EXTENSION_STORE_EXCEPTION);
    } catch (Exception e) {
        log.error("Failed to connect to extension store.", e);
        sequence.putAttribute(ATTR_EXTENSION_STORE_EXCEPTION, e);
    }
}

From source file:io.github.microcks.service.ServiceService.java

/** Download a remote HTTP URL into a temporary local file. */
private String handleRemoteFileDownload(String remoteUrl) throws IOException {
    // Build remote Url and local file.
    URL website = new URL(remoteUrl);
    String localFile = System.getProperty("java.io.tmpdir") + "/microcks-" + System.currentTimeMillis()
            + ".project";
    // Set authenticator instance.
    Authenticator.setDefault(new UsernamePasswordAuthenticator(username, password));
    ReadableByteChannel rbc = null;
    FileOutputStream fos = null;/*from  w w w.j a  v  a2 s.com*/
    try {
        rbc = Channels.newChannel(website.openStream());
        // Transfer file to local.
        fos = new FileOutputStream(localFile);
        fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
    } finally {
        if (fos != null)
            fos.close();
        if (rbc != null)
            rbc.close();
    }
    return localFile;
}

From source file:net.sf.taverna.t2.security.credentialmanager.impl.CredentialManagerImpl.java

/**
 * Connects this credential manager to the Java {@linkplain Authenticator HTTP authenticator mechanism}.
 *///from  ww w .  j  a  v a 2  s  . c  o m
public void installAuthenticator() {
    Authenticator.setDefault(new CredentialManagerAuthenticator(this));
}

From source file:gui.DownloadManagerGUI.java

public DownloadManagerGUI(String name) {
    super(name);//from  w  w  w  .j a v a2 s. com

    setLayout(new BorderLayout());

    preferences = Preferences.userRoot().node("db");
    final PreferencesDTO preferencesDTO = getPreferences();

    LookAndFeel.setLaf(preferencesDTO.getPreferencesInterfaceDTO().getLookAndFeelName());

    createFileHierarchy();

    mainToolbar = new MainToolBar();
    categoryPanel = new CategoryPanel(
            preferencesDTO.getPreferencesSaveDTO().getPreferencesDirectoryCategoryDTOs());
    downloadPanel = new DownloadPanel(this, preferencesDTO.getPreferencesSaveDTO().getDatabasePath(),
            preferencesDTO.getPreferencesConnectionDTO().getConnectionTimeOut(),
            preferencesDTO.getPreferencesConnectionDTO().getReadTimeOut());
    messagePanel = new MessagePanel(this);
    JTabbedPane mainTabPane = new JTabbedPane();
    mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, categoryPanel, mainTabPane);
    mainSplitPane.setOneTouchExpandable(true);
    statusPanel = new StatusPanel();
    addNewDownloadDialog = new AddNewDownloadDialog(this);

    mainTabPane.addTab(messagesBundle.getString("downloadManagerGUI.mainTabPane.downloadPanel"), downloadPanel);
    mainTabPane.addTab(messagesBundle.getString("downloadManagerGUI.mainTabPane.messagePanel"), messagePanel);

    preferenceDialog = new PreferenceDialog(this, preferencesDTO);

    aboutDialog = new AboutDialog(this);

    categoryPanel.setCategoryPanelListener((fileExtensions, downloadCategory) -> downloadPanel
            .setDownloadsByDownloadPath(fileExtensions, downloadCategory));

    //     preferenceDialog.setDefaults(preferencesDTO);

    addNewDownloadDialog.setAddNewDownloadListener(textUrl -> {
        Objects.requireNonNull(textUrl, "textUrl");
        if (textUrl.equals(""))
            throw new IllegalArgumentException("textUrl is empty");

        String downloadName;
        try {
            downloadName = ConnectionUtil.getRealFileName(textUrl);
        } catch (IOException e) {
            logger.error("Can't get real name of file that you want to download." + textUrl);
            messageLogger.error("Can't get real name of file that you want to download." + textUrl);
            downloadName = ConnectionUtil.getFileName(textUrl);
        }
        String fileExtension = FilenameUtils.getExtension(downloadName);
        File downloadPathFile = new File(
                preferencesDTO.getPreferencesSaveDTO().getPathByFileExtension(fileExtension));
        File downloadRangeFile = new File(preferencesDTO.getPreferencesSaveDTO().getTempDirectory());
        int maxNum = preferencesDTO.getPreferencesConnectionDTO().getMaxConnectionNumber();

        Download download = null;

        List<Download> downloads = downloadPanel.getDownloadList();
        String properDownloadName = getProperNameForDownload(downloadName, downloads, downloadPathFile);

        // todo must set stretegy pattern
        switch (ProtocolType.valueOfByDesc(textUrl.getProtocol())) {
        case HTTP:
            download = new HttpDownload(downloadPanel.getNextDownloadID(), textUrl, properDownloadName, maxNum,
                    downloadPathFile, downloadRangeFile, ProtocolType.HTTP);
            break;
        case FTP:
            // todo must be created ...
            break;
        case HTTPS:
            download = new HttpsDownload(downloadPanel.getNextDownloadID(), textUrl, properDownloadName, maxNum,
                    downloadPathFile, downloadRangeFile, ProtocolType.HTTPS);
            break;
        }

        downloadPanel.addDownload(download);
    });

    // Add panels to display.
    add(mainToolbar, BorderLayout.PAGE_START);
    add(mainSplitPane, BorderLayout.CENTER);
    add(statusPanel, BorderLayout.PAGE_END);

    setJMenuBar(initMenuBar());

    mainToolbar.setMainToolbarListener(new MainToolbarListener() {
        @Override
        public void newDownloadEventOccured() {
            addNewDownloadDialog.setVisible(true);
            addNewDownloadDialog.onPaste();
        }

        @Override
        public void pauseEventOccured() {
            downloadPanel.actionPause();
            mainToolbar.setStateOfButtonsControl(false, false, false, false, false, true); // canceled
        }

        @Override
        public void resumeEventOccured() {
            downloadPanel.actionResume();
        }

        @Override
        public void pauseAllEventOccured() {
            downloadPanel.actionPauseAll();
        }

        @Override
        public void clearEventOccured() {
            downloadPanel.actionClear();
        }

        @Override
        public void clearAllCompletedEventOccured() {
            downloadPanel.actionClearAllCompleted();
        }

        @Override
        public void reJoinEventOccured() {
            downloadPanel.actionReJoinFileParts();
        }

        @Override
        public void reDownloadEventOccured() {
            downloadPanel.actionReDownload();
        }

        @Override
        public void propertiesEventOccured() {
            downloadPanel.actionProperties();
        }

        @Override
        public void preferencesEventOccured() {
            preferenceDialog.setVisible(true);
        }
    });

    downloadPanel.setDownloadPanelListener(new DownloadPanelListener() {
        @Override
        public void stateChangedEventOccured(DownloadStatus downloadState) {
            updateButtons(downloadState);
        }

        @Override
        public void downloadSelected(Download download) {
            statusPanel.setStatus(download.getDownloadName());
        }
    });

    preferenceDialog.setPreferencesListener(new PreferencesListener() {
        @Override
        public void preferencesSet(PreferencesDTO preferenceDTO) {
            setPreferencesOS(preferenceDTO);
        }

        @Override
        public void preferenceReset() {
            PreferencesDTO resetPreferencesDTO = getPreferences();
            preferenceDialog.setPreferencesDTO(resetPreferencesDTO);
            categoryPanel.setTreeModel(
                    resetPreferencesDTO.getPreferencesSaveDTO().getPreferencesDirectoryCategoryDTOs());
        }

        @Override
        public void preferenceDefaults() {
            PreferencesDTO defaultPreferenceDTO = new PreferencesDTO();
            resetAndSetPreferencesDTOFromConf(defaultPreferenceDTO);
            preferenceDialog.setPreferencesDTO(defaultPreferenceDTO);
            categoryPanel.setTreeModel(
                    defaultPreferenceDTO.getPreferencesSaveDTO().getPreferencesDirectoryCategoryDTOs());
        }
    });

    // Handle window closing events.
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent windowEvent) {
            int action = JOptionPane.showConfirmDialog(DownloadManagerGUI.this,
                    "Do you realy want to exit the application?", "Confirm Exit", JOptionPane.OK_CANCEL_OPTION);
            if (action == JOptionPane.OK_OPTION) {
                logger.info("Window Closing");
                downloadPanel.actionPauseAll();
                dispose();
                System.gc();
            }
        }
    });

    Authenticator.setDefault(new DialogAuthenticator(this));

    setIconImage(
            Utils.createIcon(messagesBundle.getString("downloadManagerGUI.mainFrame.iconPath")).getImage());

    setMinimumSize(new Dimension(640, 480));
    // Set window size.
    pack();
    setSize(900, 580);

    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    setVisible(true);
}

From source file:io.takari.maven.testing.executor.junit.MavenVersionResolver.java

private void setHttpCredentials(final Credentials credentials) {
    Authenticator authenticator = null;
    if (credentials != null) {
        authenticator = new Authenticator() {
            @Override/* w ww.  j a  v a2  s  . c o  m*/
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(credentials.username, credentials.password.toCharArray());
            }
        };
    }
    Authenticator.setDefault(authenticator);
}

From source file:org.openbravo.test.webservice.BaseWSTest.java

/**
 * Creates a HTTP connection./*from ww  w.  j a  v  a  2s . c  o m*/
 * 
 * @param wsPart
 * @param method
 *          POST, PUT, GET or DELETE
 * @return the created connection
 * @throws Exception
 */
protected HttpURLConnection createConnection(String wsPart, String method) throws Exception {
    Authenticator.setDefault(new Authenticator() {
        @Override
        protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication(LOGIN, PWD.toCharArray());
        }
    });
    log.debug(method + ": " + getOpenbravoURL() + wsPart);
    final URL url = new URL(getOpenbravoURL() + wsPart);
    final HttpURLConnection hc = (HttpURLConnection) url.openConnection();
    hc.setRequestMethod(method);
    hc.setAllowUserInteraction(false);
    hc.setDefaultUseCaches(false);
    hc.setDoOutput(true);
    hc.setDoInput(true);
    hc.setInstanceFollowRedirects(true);
    hc.setUseCaches(false);
    hc.setRequestProperty("Content-Type", "text/xml");
    return hc;
}

From source file:net.sf.taverna.t2.security.credentialmanager.impl.HTTPAuthenticatorIT.java

@Test()
public void withAuthenticatorResetJava() throws Exception {
    assertTrue("Could not reset JVMs authCache, ignore on non-Sun JVM", credentialManager.resetAuthCache());

    assertEquals("Unexpected calls to password provider", 0,
            HTTPAuthenticatorServiceUsernameAndPasswordProvider.getCalls());
    CountingAuthenticator authenticator = new CountingAuthenticator(credentialManager);
    assertEquals("Unexpected calls to authenticator", 0, authenticator.calls);
    Authenticator.setDefault(authenticator);
    //      FixedPasswordProvider.setUsernamePassword(new UsernamePassword(
    //            USERNAME, PASSWORD));

    URL url = new URL("http://localhost:" + PORT + "/test.html");
    httpAuthProvider.setServiceUsernameAndPassword(url.toURI(), new UsernamePassword(USERNAME, PASSWORD));
    URLConnection c = url.openConnection();

    c.connect();/*from   w ww. j a  v  a  2 s . c  o m*/
    try {
        c.getContent();
    } catch (Exception ex) {
    }

    assertEquals("HTTP/1.1 200 OK", c.getHeaderField(0));

    assertEquals("Did not invoke authenticator", 1, authenticator.calls);
    assertEquals("Did not invoke our password provider", 1,
            HTTPAuthenticatorServiceUsernameAndPasswordProvider.getCalls());

    assertEquals("Unexpected prompt/realm", REALM, httpAuthProvider.getRequestMessage());
    assertEquals("Unexpected URI", url.toURI().toASCIIString() + "#" + REALM,
            HTTPAuthenticatorServiceUsernameAndPasswordProvider.getServiceURI().toASCIIString());

    // And without Java's cache:
    assertTrue("Could not reset VMs authCache, ignore on non-Sun VM", credentialManager.resetAuthCache());

    URLConnection c2 = url.openConnection();
    c2.connect();
    assertEquals("HTTP/1.1 200 OK", c2.getHeaderField(0));
    assertEquals("Did not invoke our authenticator again", 2, authenticator.calls);
    assertEquals("Did not invoke our password provider again", 2,
            HTTPAuthenticatorServiceUsernameAndPasswordProvider.getCalls());

}

From source file:org.panlab.tgw.restclient.RepoAdapter.java

public static String updateAtomic(int id, String commonName, String paramType, String defaultValue,
        String description) {/*  w  w  w  .  j a v  a2  s .co  m*/
    Client c = Client.create();
    c.setFollowRedirects(true);
    Authenticator.setDefault(new PwdAuthenticator());
    WebResource r = c.resource("http://repos.pii.tssg.org:8080/repository/rest/configParamAtomic/" + id);
    ConfigParamAtomicInstanceDocument pDoc = ConfigParamAtomicInstanceDocument.Factory.newInstance();
    pDoc.addNewConfigParamAtomicInstance();
    pDoc.getConfigParamAtomicInstance().setCommonName(commonName);
    pDoc.getConfigParamAtomicInstance().setConfigParamType(paramType);
    pDoc.getConfigParamAtomicInstance().setDefaultParamValue(defaultValue);
    pDoc.getConfigParamAtomicInstance().setDescription(description);

    String request = pDoc.toString();
    request = request.replace(" xmlns=\"http://xml.netbeans.org/schema/repo.xsd\"", "");
    request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + request;

    String resp = r.type(MediaType.TEXT_XML).put(String.class, request);
    System.out.println(resp);
    resp = addSchemaDefinition(resp);
    try {
        ConfigParamAtomicDocument pcDoc = ConfigParamAtomicDocument.Factory.parse(resp);
        return pcDoc.getConfigParamAtomic().getId();
    } catch (XmlException ex) {
        ex.printStackTrace();
        return null;
    }

}

From source file:com.hpe.application.automation.tools.common.rest.RestClient.java

public static URLConnection openConnection(final ProxyInfo proxyInfo, String urlString) throws IOException {
    Proxy proxy = null;//from   ww  w  . j  a v a  2  s .  c  o  m
    URL url = new URL(urlString);

    if (proxyInfo != null && StringUtils.isNotBlank(proxyInfo._host)
            && StringUtils.isNotBlank(proxyInfo._port)) {
        int port = Integer.parseInt(proxyInfo._port.trim());
        proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyInfo._host, port));
    }

    if (proxy != null && StringUtils.isNotBlank(proxyInfo._userName)
            && StringUtils.isNotBlank(proxyInfo._password)) {
        Authenticator authenticator = new Authenticator() {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(proxyInfo._userName, proxyInfo._password.toCharArray()); //To change body of overridden methods use File | Settings | File Templates.
            }
        };
        Authenticator.setDefault(authenticator);
    }

    if (proxy == null) {
        return url.openConnection();
    }

    return url.openConnection(proxy);
}

From source file:tasly.greathealth.erp.order.facades.DefaultOrderDeliveryStatusUpdateFacade.java

/**
 * TS-689:Hybris OMS???SAP ERP/*w ww.  ja  v a 2s  .com*/
 * Create ECC orders according to OMS orders:
 * 1. order.approve_status=1
 * 2. ?order.replication_status="N,E"
 * 3. ??order.replication_times<3
 *
 * @return processed order ID list
 * @author vincent.yin
 */
@Override
@Transactional
public List<String> createEccOrders() {
    List<TaslyOrderData> approverdOmsOrderDatas = new ArrayList<TaslyOrderData>();
    List<TaslyOrder> approverdOmsOrders = new ArrayList<TaslyOrder>();
    final String[] replication_status = { REPLICATIONSTATUS_N, REPLICATIONSTATUS_E };

    processedOmsOrderIDs = new ArrayList<String>();
    // below used for create ecc order soap client
    // baseinfo
    ZSTRUPIBASEINFO2 baseInfor = new ZSTRUPIBASEINFO2();
    // orders
    final ZSTRSDOMSSALEORDERTAB orders = new ZSTRSDOMSSALEORDERTAB();
    ZSTRSDOMSSALEORDER order = new ZSTRSDOMSSALEORDER();
    // message
    final ZSTRSDOMSSALEORDERS message = new ZSTRSDOMSSALEORDERS();
    // parameter
    final ZSDOMSSALESORDERCREATE parameters = new ZSDOMSSALESORDERCREATE();
    // request
    final ZFMSDOMSSALEORDERREQUEST orderRequest = new ZFMSDOMSSALEORDERREQUEST();

    // fetch the ERP code mapping data
    this.setErpCodeMappingMap();
    // fetch express data
    this.setExpressMap();

    // 1.get approved order list from OMS
    approverdOmsOrderDatas = orderService.getOmsApprovedOrders(CO_APPROVESTATUS, replication_status,
            CO_REPLICATIONTIME);
    // convert orderdata to order dto
    approverdOmsOrders = converters.convertAll(approverdOmsOrderDatas, orderConverter);

    LOG.info(CO_LogHead + "OMS ??: " + approverdOmsOrders.size());

    // 2.process message baseInfor
    // set baseInfor
    baseInfor = createEccBaseInfo();

    // 3.process message orderList
    // process each oms order
    for (final TaslyOrder taslyOrder : approverdOmsOrders) {
        // used to process sales and customer match
        String salsOrg = null;
        String customerOrg = null;
        LOG.info(CO_LogHead + "--------------------------------------------------");
        LOG.info(CO_LogHead + "?? :" + taslyOrder.getOrderId());

        if (null != taslyOrder.getInnerSource() || null != taslyOrder.getChannelSource()) {
            salsOrg = this.getSalesOrgMap().get(taslyOrder.getInnerSource().toString());
            customerOrg = this.getCustomerOrgMap().get(taslyOrder.getChannelSource().toString());

            LOG.info(CO_LogHead + "channelSource is: " + taslyOrder.getChannelSource().toString()
                    + ",innserSource is: " + taslyOrder.getInnerSource().toString() + ",salsOrg is:" + salsOrg
                    + ",customerOrg is: " + customerOrg);
        }
        if (null == salsOrg || null == customerOrg) {
            nullFlag = true;
            nullList.add(CO_LogHead + "[orders].inner_source or ||[orders].channel_source");

        }

        order = new ZSTRSDOMSSALEORDER();
        // this list was used to update order.replication_status later
        if (!nullFlag) {
            // create each ECC order
            order = createEccOrder(taslyOrder, salsOrg, customerOrg);
            // This order is OK,
            if (!nullFlag) {
                orders.getItem().add(order);
                processedOmsOrderIDs.add(taslyOrder.getOrderId());
            } else {
                LOG.error(
                        CO_LogHead + "? " + taslyOrder.getOrderId() + " ,:");
                LOGERROR.error(
                        CO_LogHead + "? " + taslyOrder.getOrderId() + " ,:");
                for (final String field : nullList) {
                    LOG.error(field);
                    // TS-891
                    LOGERROR.error(field);
                }
                // to process the next order
                nullFlag = false;
                nullList = new ArrayList<String>();
            }
        }
    }
    // set baseInfo attribute
    orderRequest.setBASEINFO(baseInfor);
    // set message orders attribute
    message.setORDERS(orders);
    // set message attribute
    orderRequest.setMESSAGE(message);
    // set Ecc parameters
    parameters.setIREQUEST(orderRequest);

    // SIECCOMSSALESORDERCREATEOUTAsyn serviceInterface = null;
    // 4. invoke eccSoapClient to creat new order
    if (processedOmsOrderIDs.size() > 0) {
        // // start put WSDL user name and password into Authenticator
        Authenticator.setDefault(new Authenticator() {
            // @Override
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(PIUSERNAME, PIPASSWORD.toCharArray());
            }
        });
        //
        try {
            // invoke the soap service
            LOG.info(CO_LogHead + "???PI?");

            createOrderSoapService.siECCOMSSALESORDERCREATEOUTAsyn(parameters);
            // 5. updated all of these omsorders replication_status from 'N' to 'Y'
            updateOrderReplicationStatus(processedOmsOrderIDs);

            LOG.info(CO_LogHead + "????");

        } catch (final Exception e) {
            LOG.error(CO_LogHead + "PI???!");
        }
    }
    return processedOmsOrderIDs;
}