SOAP WebService SMS interface docking

import java.util.ArrayList;import java.util.Date;import java.util.HashMap;import java. util.List;import java.util.Map;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 org.dom4j.Document;import org.dom4j.DocumentHelper;import org.dom4j.Element;import org.springframework.stereotype .Controller;import org.springframework.web.bind.annotation.RequestMapping;/** * SMS API */@Controllerpublic class Sms {/** * SMS sending interface docking* @param phone * @param message */ @RequestMapping( value = "sendSms") public String sendSms(String phone, String message) {String nameSpace = "http://tempuri.org/"; String sendMessage = "SendMessage"; String url = "http://192.168.1.25: 9090/WebServ ice.asmx?wsdl"; String localPart = "soapHeader"; List list = new ArrayList(); Map map=new HashMap(); map.put( "phone", phone); map.put("message", message); map.put("taskname", "task name"); map.put("bankMessagid", "[Construction Bank]"); try { //Create service Service serv = new Service(); SOAPHeaderElement soapHeaderElement = new SOAPHeaderElement(nameSpace, localPart); Call call = (Call) serv.createCall(); Map roleMap = new HashMap (); roleMap.put("password", "123456"); for (Map.Entry entry: roleMap.entrySet()){ soapHeaderElement.addChildElement(entry.getKey()).setValue(entry. getValue()); soapHeaderElement.addChildElement(entry.getKey()).setValue(entry.getValue());} soapHeaderElement.setNamespaceURI(nameSpace); call.addHeader(soapHeaderElement); //Set to call The interface address call.setTargetEndpointAddress(url); //Set the interface method to be called call.setOperationName(new QName(nameSpace,sendMessage)); call.setSOAPActionURI(nameSpace+sendMessage); //Set the parameter name and the second parameter indicates Entry parameter type, the third parameter represents the entry parameter for (Map.Entry entry: map.entrySet()) {if (entry.getValue() instanceof String) {call.addParameter(new QName(nameSpace, entry.getKey()), XMLType.XSD_STRING, ParameterMode.IN);} else if (entry.getValue() instanceof Long) {call.addParameter(new QName(nameSpace, entry.getKey()), XMLType.XSD_LONG, ParameterMode .IN);} else if (entry.getValue() instanceof Double) {call.addParameter(new QName(nameSpace, entry.getKey()), XMLType.XSD_DOUBLE, ParameterMode.IN);} else if (entry.getValue( ) instanceof Float) {call.addParameter(new QName(nameSpace, entry.getKey() ), XMLType.XSD_FLOAT, ParameterMode.IN);} else if (entry.getValue() instanceof Integer) {call.addParameter(new QName(nameSpace, entry.getKey()), XMLType.XSD_INTEGER, ParameterMode.IN);} else if (entry.getValue() instanceof Date) {call.addParameter(new QName(nameSpace, entry.getKey()), XMLType.XSD_DATETIME, ParameterMode.IN);} else if (entry.getValue() instanceof Boolean) { call.addParameter(new QName(nameSpace, entry.getKey()), XMLType.XSD_BOOLEAN, ParameterMode.IN);} list.add(entry.getValue());} //Return parameter type call.setReturnType(XMLType.XSD_STRING ); call.setEncodingStyle("UTF-8"); //Start calling String result = (String) call.invoke(list.toArray()); //dom4j Document doc = DocumentHelper.parseText(""+ result + ""); Element root = doc.getRootElement();//root //Get the node content returned by the interface System.out.println("rtMessage1==="+root.element("rtMessage1").getText()); System.out .println("rtMessage2==="+root.element("rtMessage2").getText()); System.out.println("rtMessage3==="+root.element("rtMessage3").getText()) ; return "";} catch (Exception e) {e.printStackTrace();} return ""; }}

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3472 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.