package com.techown.middlews.util;
import java.io.Serializable;
import java.net.MalformedURLException;
import java.rmi.RemoteException;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.log4j.Logger;
import com.techown.middlews.global.Constant;
public class WMS_Caller{
static Logger log = Logger.getLogger(WMS_Caller.class);
public static String getInstance(String pin,String formNo,String content,String methodKey) throws RemoteException{
//System.out.println("调用WebService接口时,传进来的XML报文:"+content);
Service service = new Service();
Call call = null;
try {
call= (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(Constant.WMS_SERVICE_URL) );
} catch (MalformedURLException e) {
log.info("与中间件webService的URL建立连接时,出异常!",e);
e.printStackTrace();
} catch (ServiceException e1) {
log.info("调用中间件的webservice时,createCall()出异常!",e1);
e1.printStackTrace();
}
//方法名
call.setOperationName(new QName("http://soapinterop.org/", "push"));
//Object ret = call.invoke(new Object[] {pin,formNo ,content,"add" });
//push方法的参数列表
Object ret = call.invoke(new Object[] {pin,formNo,content,methodKey});
//System.out.println("Result is '" + ret.toString() + "'");
return ret.toString();
}
}