扣丁書屋

webservice接口call調用方式

3年以前  |  閱讀數:178 次  |    

//call調用方式
private String send(String method,String userName,String title,String content,String tel){
    String soapaction= "http://service.msgbuss.ceair.com/";
    String endpoint  = "http://xxx.xx.xx.xx:8099/msgbuss/soap/sendMessage";
    try {
        org.apache.axis.client.Service service = new org.apache.axis.client.Service();
        Call call = (Call)service.createCall();
        QName qn = new QName("urn:messageEndpoint", "MessageRequestVO");
        call.registerTypeMapping(MessageRequestVO.class,qn,
                    new BeanSerializerFactory(MessageRequestVO.class, qn),
                    new BeanDeserializerFactory(MessageRequestVO.class, qn));
        call.setTargetEndpointAddress(endpoint);
        call.setUseSOAPAction(true);
        call.setSOAPActionURI(null);
        call.setOperationName(new QName(soapaction, "send"));

        //判斷是否是自定義手機號碼
        JSONObject obj=new JSONObject();
        if(tel!= null ||!"".equals(tel) ){
            obj.put("mobiles",tel);
        }
        obj.put("emsEnterpriseID","10090");
        obj.put("emsLoginName","admin");
        obj.put("emsPassword",MD5.toMD5("cabin123"));

        //賦值
        MessageRequestVO messageRequestVO = new MessageRequestVO();
        messageRequestVO.setBizProduct(method);
        messageRequestVO.setRequestId(UUID.randomUUID().toString());
        messageRequestVO.setToUserId(userName);
        messageRequestVO.setTitle(title);
        messageRequestVO.setContent(content);
        messageRequestVO.setExtention(obj.toString());

        String str = "<bizProduct>"+method+"</bizProduct>"
                    + "<content>"+"測試1"+"</content>"
                    + "<extention>"+obj.toString()+"</extention>"
                    + "<requestId>11111</requestId>"
                    + "<title>測試</title>"
                    + "<toUserId>chenbiqian</toUserId>";

        call.addParameter("messageRequestVO", org.apache.axis.encoding.XMLType.XSD_STRING, ParameterMode.IN);
        call.getParameterTypeByName("");
        //call.addParameter("bizProduct", org.apache.axis.encoding.XMLType.XSD_STRING, ParameterMode.IN);
        call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
        call.invoke(new Object[] {str});
        return null;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return  null;
}

相關文章:

18禁止午夜福利体验区,人与动人物xxxx毛片人与狍,色男人窝网站聚色窝
<蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <文本链> <文本链> <文本链> <文本链> <文本链> <文本链>