java调.net写的webservice要写SOAPAction的,否则就出这个错误      
   String sa = webservice的SOAPAction的值
      call.setUseSOAPAction(true);
      call.setSOAPActionURI(sa);

解决方案 »

  1.   

    15
    以java 为客户端的话, 有多种技术可以访问我们的Web Service。以下演示在J2SE 1.4.2 版本下访问Web
    Service 的2 种方式。
    Axis
    需要下载axis, 地址为:http://apache.linuxforum.net/dist/ws/axis/1_1/axis-1_1-src.zip
    代码如下:
    import org.apache.axis.client.Service;
    import org.apache.axis.client.Call;
    import javax.xml.namespace.QName;
    import javax.xml.rpc.ParameterMode;
    public class t2 {
    public static void main(String[] args) {
    long time=System.currentTimeMillis();
    try {
    String endpoint="http://localhost/UserX/biz.asmx";
    Service service = new Service();
    Call call = (Call)service.createCall();
    8848.com Web Service 说明文档
    call.setTargetEndpointAddress(new java.net.URL(endpoint));
    call.setOperationName(new
    QName("http://localhost/UserX/bizinfo","get_count"));
    call.addParameter("ID", org.apache.axis.Constants.XSD_STRING,
    ParameterMode.IN);
    call.addParameter("pwd",org.apache.axis.Constants.XSD_STRING,
    ParameterMode.IN);
    call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
    call.setUseSOAPAction(true);
    call.setSOAPActionURI("http://localhost/UserX/bizinfo/get_count");
    String day = (String)call.invoke(new Object[] {"111", "s111"});
    System.out.println(day);
    } catch (Exception e) {
    System.err.println(e.toString());
    }
    System.out.println("Total time is: "+(System.currentTimeMillis()-time));
    }
    }