⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calladdbommain.java

📁 Agile PLM公司的二次开发例子。 测试程序也就是二次开发例子。希望大家有用。里面有webservice的调用方法
💻 JAVA
字号:
/**
 * @Date: 2004-12-10
 * @Author: jiadongz
 * @E-mail: jiadong.zhu@agile.com
 */
 
package client.agile.com;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.methods.GetMethod;

import com.agile.px.ActionResult;

public class CallAddBOMMain {
    
    private Service service = null;
    private Call call = null;
    
    //private final String url = "https://linux-app1.sz.agilesoft.com/Agile/ws/AddBOM";
    private final String url = "http://tyler.agile.agilesoft.com/Agile/ws/AddBOM";
    private static final String WSX = "http://tyler.agile.agilesoft.com/Agile/ws/AddBOM";
    private final String USER = "admin";
    private final String PWD = "agile";
    String number = "1000";
    
    private final String METHOD = "addBOM";
    //private Object[] parameters = null;
    
    /*
     * Call remote WSX
     */
    private void callAddBOM() {
        try {
            
	    
            HttpClient client = new HttpClient();
            
            GetMethod get = new GetMethod(WSX);
            client.getState().setCredentials(
                    null,
                    null,
                    new UsernamePasswordCredentials("admin", "agile"));
	       
                  
                      
            
            service = new Service();
            call = (Call) service.createCall();
            call.setTargetEndpointAddress(url);
            call.setMaintainSession(true);
            System.out.println("WSX has been found");
            call.setUsername(USER);
            call.setPassword(PWD);
            System.out.println("User/Pwd have been validated");
            call.setOperationName(METHOD);
            System.out.println("Remote method has been found");
            call.invoke(new Object[]{number});
            System.out.println("PX call WSX ends");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }///: ~ callAddBOM() Ends

    public static void main(String[] args) {
        CallAddBOMMain go = new CallAddBOMMain();
        go.callAddBOM();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -