⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 messagetest.java

📁 openacs source for CPE wan management
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package open.acs.test;import java.io.ByteArrayInputStream;import java.io.IOException;import javax.xml.soap.MessageFactory;import javax.xml.soap.SOAPException;import javax.xml.soap.SOAPMessage;import junit.framework.TestCase;import org.openacs.Message;/** * * @author Administrator */public class MessageTest extends TestCase {        public MessageTest(String testName) {        super(testName);    }                @Override    protected void setUp() throws Exception {        super.setUp();    }    @Override    protected void tearDown() throws Exception {        super.tearDown();    }    // TODO add test methods here. The name must begin with 'test'. For example:    // public void testHello() {}        public void testGetRPCResponse () throws SOAPException, IOException {        String msg = "<SOAP-ENV:Envelope"+                        "xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\""+ "xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\""+ "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""+ "xmlns:cwmp=\"urn:dslforum-org:cwmp-1-0\">"+  "<SOAP-ENV:Header><cwmp:ID SOAP-ENV:mustUnderstand=\"1\">intrnl.unset.id.1218901372619</cwmp:ID></SOAP-ENV:Header>"+  "<SOAP-ENV:Body><cwmp:GetRPCMethodsResponse><MethodList SOAP-ENC:arrayType=\"xsd:string[14  ]\">"+      "<string>GetRPCMethods</string>"+      "<string>GetParamterNames</string>"+      "<string>GetParameterValues</string>"+      "<string>SetParameterValues</string>"+      "<string>GetParameterAttributes</string>"+      "<string>SetParameterAttributes</string>"+      "<string>AddObject</string>"+      "<string>DeleteObject</string>"+      "<string>Download</string>"+      "<string>Upload</string>"+      "<string>Reboot</string>"+      "<string>FactoryReset</string>"+      "<string>GetQueuedTransfers</string>"+      "<string>ScheduleInform</string></MethodList></cwmp:GetRPCMethodsResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>";        messageTest (msg);    }        private void messageTest (String m) throws SOAPException, IOException {       MessageFactory mf;       mf = MessageFactory.newInstance();       ByteArrayInputStream f = new ByteArrayInputStream (m.getBytes());       SOAPMessage soapMsg = mf.createMessage(null, f);        String reqname = Message.getRequestName(soapMsg);        System.out.println("Request is " + reqname);        Message msg = null;        try {                msg = (Message) Class.forName("org.openacs.message." + reqname).newInstance();        } catch (IllegalAccessException ex) {            ex.printStackTrace();            return;        } catch (InstantiationException ex) {            ex.printStackTrace();            return;        } catch (ClassNotFoundException ex) {            ex.printStackTrace();            return;        }            }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -