上面的原代码太乱了,我在发一边,这是把没用的代码过滤掉的代码
import java.util.Iterator;
import javax.xml.namespace.QName;
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.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;
//import com.chinaedu.base.util.SystemFunc;
public class TestClient {
    // targetEPR指定打包的Web Service在容器中的物理位置。
       private static EndpointReference targetEPR=new EndpointReference
         ("http://www......");
       public static OMElement getTheOMElement(){
        //创建request SOAP包。
              OMFactory fac=OMAbstractFactory.getOMFactory();
        // OMNamespace指定此SOAP文档名称空间。
              OMNamespace omNs=fac.createOMNamespace("http://tempuri.org/","");
        //创建元素SendMessage,并指定其在omNs指代的名称空间中。
              OMElement method=fac.createOMElement("SendMessage",omNs);
        //指定元素的内容。
             String []params = {"UserId","Password","Msg","Destnumbers"};
      
       String []values = {"1234","456123","hello welcome you!","13146430987"};
      
       //values[1] = SystemFunc.toMD5String(SystemFunc.toMD5String("kkkk")+values[2]);
                    
       for(int i = 0; i < params.length; i++)
       {
       OMElement value = fac.createOMElement(params[i], omNs);
       value.addChild(fac.createOMText(value,values[i]));
       method.addChild(value);
       }
       return method;
       }
       public static void main(String[] args){
              try{
                     Options options=new Options();
                     options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
                     options.setTo(targetEPR);
                     options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE); 
                     options.setTransportInProtocol(Constants.TRANSPORT_HTTP); 
                     options.setAction("http://tempuri.org/SendMessage");  
                                                          
                     ServiceClient sender=new ServiceClient();
                     sender.setOptions(options);
                     /*
                      * 调用方法
                      * */
                     OMElement SendMsg=TestClient.getTheOMElement();
                     /*
                      * 下面是Request信息
                      * */
                       System.out.println(SendMsg);
                     
            /*
             * 发出request SOAP,同时将得到的远端由SendMessage方法返回的信息保存到result。    **/    
                     OMElement result=sender.sendReceive(SendMsg);
                     System.out.println(result);
              }
              catch(Exception axisFault){
                     axisFault.printStackTrace();
              }
       }
}