soap 返回简单数据类型 wsdl webservice

soap 返回简单数据类型 wsdl webservice

import java.net.URL;

 

import javax.xml.namespace.QName;

import javax.xml.rpc.ParameterMode;

 

import org.apache.axis.client.Call;

import org.apache.axis.client.Service;

import org.apache.axis.encoding.XMLType;

 

import org.apache.axis.message.SOAPHeaderElement;

import javax.xml.soap.SOAPElement;

 

public class SendSMSBJ2 implements Runnable {

    public String phones = null;//”15345667766″

    public String msg = null;// “kkk测试”;

 

    public int T_count = 0;

    public int tname = 0;

 

    public void run() {

        // System.out.println(“[TN:”+tname+”] “+T_count);

        long s = System.currentTimeMillis();

        String r = send2BJ(username,  password,  mobile,  smscontent);

        long e = System.currentTimeMillis();

        String time = (e – s) / 1000 == 0 ? (e – s) + “毫秒” : (e – s) / 1000

                + “秒” + (e – s) % 1000 + “毫秒”;

        System.out.println(“[TN:” + tname + “] P:” + phones + ” ST->” + time

                + “,R->” + r);

        // System.out.println(“ST->”+time+”,R->”+r );

    }

     

 

         

 

 

    public static String send2BJ(String username,String password,String mobile,String smscontent) {

        String ret = null;

        String md5 = null;

        try {

           

            String nameSpace = “http://tempuri.org/”;

            String endPoint = “http://www.ldsm.com/Service.asmx”;

 

            Service service = new Service();

            Call call = null;

             

            call = (Call) service.createCall();

            call.setTargetEndpointAddress(new URL(endPoint));

             

            call.setOperationName(new QName(nameSpace, “SendSMS”));

            call.addParameter(new QName(“http://DefaultNamespace”, “username”),

                    XMLType.XSD_STRING, ParameterMode.IN);

            call.addParameter(new QName(“http://DefaultNamespace”, “password”),

                    XMLType.XSD_STRING, ParameterMode.IN);

            call.addParameter(new QName(“http://DefaultNamespace”, “mobile”),

                    XMLType.XSD_STRING, ParameterMode.IN);

            call.addParameter(new QName(“http://DefaultNamespace”, “smscontent”),

                    XMLType.XSD_STRING, ParameterMode.IN);

 

            call.setReturnType(XMLType.XSD_INT);

 

            call.setUseSOAPAction(true);

            call.setSOAPActionURI(nameSpace + “SendSMS”);

 

            System.out.println(call.invoke(new Object[] { username,  password,  mobile,  smscontent}));

 

        } catch (Exception e) {

            e.printStackTrace();

        }

        return ret;

 

    }

 

  

    static String username=”saaa”;

    static String password=”123456″;

    static String smscontent=”abc测试”;

 

 

    static String mobile = “159211156331”;

     

    static String SendTime = “”;

 

    public static void main(String[] a) {

 

        send2BJ(  username,  password,  mobile,  smscontent);

 

 

    }

}

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/100559.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • JavaScript 正则表达式全面总结

    JavaScript 正则表达式全面总结如果您发现错误,请一定要告诉我,拯救一个辣鸡(但很帅)的少年就靠您了!本文适合有JavaScript基础&&面向搜索引擎书写正则的人群。正则表达式是用于匹配字符串中字符组合

    2022年7月3日
    21
  • header中Content-Disposition的作用

    header中Content-Disposition的作用

    2021年9月22日
    84
  • EasyPlayer简介

    EasyPlayer简介EasyPlayer简介EasyPlayer是一款基于EasyRTSPClient实现的AndroidRTSP播放器。目前实现的功能有:播放视频视频画面放大,拖动(类似360小水滴的拖动功能)开启、关闭声音抓拍录像保存视频缩略图

    2022年6月16日
    67
  • Jquery Ajax 跨域调用asmx类型 WebService范例

    Jquery Ajax 跨域调用asmx类型 WebService范例Ajax在Web2.0时代起着非常重要的作用,然而有时因为同源策略(SOP)(俗称:跨域问题(crossdomain))它的作用会受到限制。在本文中,将学习如何克服合作限制。本文以asmx方式搭建webservice作为测试用后端,给出完整的前后端调用解决方案、范例代码。

    2022年6月3日
    40
  • java中什么是过滤器_JAVAweb过滤器

    java中什么是过滤器_JAVAweb过滤器【扩展】过滤器:Filter概念:对目标资源的请求和响应进行过滤截取。在请求到达servlet之前,进行逻辑判断,判断是否放行到servlet;也可以在一个响应response到达客户端之前进行过滤,判断是否允许返回客户端。场景:(用户授权的过滤器:判断用户是否有权限请求界面)(日志信息的过滤器:过滤用户在网站的所有请求,记录轨迹 )(负责解码的过滤器:规定请求的解码方式)备注:过滤…

    2022年8月23日
    5
  • FastJson TypeReference 缓存「建议收藏」

    FastJson TypeReference 缓存「建议收藏」一直用FastJson做rest接口的序列化,FastJson对泛型的支持也非常好。经过一段时间使用后发现不定时的会报JsonObjectcan’tcovertto****的错误,但是重启之后就好了。排查过程不赘述,直接上代码演示StringitemJsonStr="{\"models\":{\"_defaultModel\":{\"id\":824,\&q

    2022年6月18日
    54

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号