1 22 package org.jboss.test.webservice.jbws64; 23 24 import junit.framework.Test; 25 import org.jboss.test.JBossTestCase; 26 27 import javax.xml.soap.MessageFactory ; 28 import javax.xml.soap.SOAPBody ; 29 import javax.xml.soap.SOAPConnection ; 30 import javax.xml.soap.SOAPConnectionFactory ; 31 import javax.xml.soap.SOAPElement ; 32 import javax.xml.soap.SOAPMessage ; 33 import java.io.ByteArrayInputStream ; 34 35 55 public class JBWS64TestCase extends JBossTestCase 56 { 57 59 public JBWS64TestCase(String name) 60 { 61 super(name); 62 } 63 64 65 public static Test suite() throws Exception  66 { 67 return getDeploySetup(JBWS64TestCase.class, "ws4ee-jbws64.war"); 68 } 69 70 73 public void testEndpoint() throws Exception  74 { 75 String reqMsgStr = 76 "<soapenv:Envelope" + 77 " xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'" + 78 " xmlns:xsd='http://www.w3.org/2001/XMLSchema'" + 79 " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" + 80 " <soapenv:Body>" + 81 " <publish xmlns='http://org.jboss.test.webservice/jbws64'>" + 82 " <String_1 xmlns=''>joel</String_1>" + 83 " <String_2 xmlns=''>secret</String_2>" + 84 " <String_3 xmlns=''>1</String_3>" + 85 " <String_4 xmlns=''>6</String_4>" + 86 " <String_5 xmlns=''>2</String_5>" + 87 " </publish>" + 88 " </soapenv:Body>" + 89 "</soapenv:Envelope>"; 90 91 MessageFactory msgFactory = MessageFactory.newInstance(); 92 SOAPMessage reqMsg = msgFactory.createMessage(null, new ByteArrayInputStream (reqMsgStr.getBytes())); 93 94 SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance(); 95 SOAPConnection con = factory.createConnection(); 96 SOAPMessage resMsg = con.call(reqMsg, "http://" + getServerHost() + ":8080/ws4ee-jbws64"); 97 98 SOAPBody soapBody = resMsg.getSOAPBody(); 99 SOAPElement soapBodyElement = (SOAPElement )soapBody.getChildElements().next(); 100 SOAPElement soapElement = (SOAPElement )soapBodyElement.getChildElements().next(); 101 assertEquals("joel,secret,1,6,2", soapElement.getValue()); 102 } 103 } 104 | Popular Tags |