Methods Summary |
---|
private javax.xml.soap.SOAPMessage | createMessageFromInputStream(java.io.InputStream is)
MessageFactory mf = MessageFactory.newInstance();
return mf.createMessage(new MimeHeaders(), is);
|
private javax.xml.soap.SOAPMessage | createTestMessage(java.lang.String encoding, boolean xmlDecl)
MessageFactory factory = MessageFactory.newInstance();
SOAPMessage message = factory.createMessage();
SOAPPart sp = message.getSOAPPart();
SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
SOAPHeader header = envelope.getHeader();
ByteArrayInputStream bais =
new ByteArrayInputStream(GoodSoapMessage.getBytes(encoding));
StreamSource ssrc = new StreamSource(bais);
sp.setContent(ssrc);
message.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, encoding);
message.setProperty(SOAPMessage.WRITE_XML_DECLARATION, xmlDecl ? "true" : "false");
return message;
|
public void | testUTF16withXMLDecl()
SOAPMessage msg = createTestMessage("UTF-16", true);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
msg.writeTo(baos);
String xml = new String(baos.toByteArray(),"UTF-16");
assertTrue(xml.indexOf("UTF-16") != -1);
assertTrue(xml.indexOf("<Bozo>") != -1);
|
public void | testUTF8withXMLDecl()
SOAPMessage msg = createTestMessage("UTF-8", true);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
msg.writeTo(baos);
String xml = new String(baos.toByteArray(),"UTF-8");
assertTrue(xml.indexOf("UTF-8") != -1);
assertTrue(xml.indexOf("<Bozo>") != -1);
|