客户端
package cn.flyingsoft.oais.service.webService.client;
import java.io.File;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMText;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
public class LineFileInteropServiceStub1 {
private static EndpointReference targetEPR =new EndpointReference("http://127.0.0.1:8080/esoaisapp/services/LineFileInteropService");
public static OMElement getMethod(DataHandler dh,String filePath,String fileName,String fileType) {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://webService.service.oais.flyingsoft.cn", "tns");
OMElement method = fac.createOMElement("lineFileUpload", omNs);
OMElement value1 = fac.createOMElement("dh", omNs);
OMElement value2= fac.createOMElement("fileContent", omNs);
OMElement value3 = fac.createOMElement("fileName", omNs);
OMElement value4 = fac.createOMElement("fileType", omNs);
value1.addChild(fac.createOMText(dh, true));
value2.addChild(fac.createOMText(value2, filePath));
value3.addChild(fac.createOMText(value3, fileName));
value4.addChild(fac.createOMText(value4, fileType));
method.addChild(value2);
method.addChild(value3);
method.addChild(value4);
method.addChild(value1);
return method;
}
public static void main(String[] args) {
try {
String filePath="d:/2012-09-24 13-23-05.zip";
String fileName="2012-09-24 13-23-05";
String fileType="zip";
DataHandler dh = new DataHandler(new FileDataSource(filePath)); // ftpPath为 服务器名+虚拟路径