QName portQName = new QName(NAMESPACE, "DoubleItEncryptedAttachmentsPort");
DoubleItSwaPortType port = service.getPort(portQName, DoubleItSwaPortType.class);
updateAddressPort(port, PORT);
// DOM
DoubleIt3 doubleIt = new DoubleIt3();
doubleIt.setNumberToDouble(25);
port.doubleIt3(doubleIt, "12345".getBytes());
// Streaming
enableStreaming(port);
doubleIt = new DoubleIt3();
doubleIt.setNumberToDouble(25);
port.doubleIt3(doubleIt, "12345".getBytes());
// This should fail, as the service requires that the Attachments must be encrypted
portQName = new QName(NAMESPACE, "DoubleItEncryptedAttachmentsPort2");
port = service.getPort(portQName, DoubleItSwaPortType.class);
updateAddressPort(port, PORT);
// DOM
try {
doubleIt = new DoubleIt3();
doubleIt.setNumberToDouble(25);
port.doubleIt3(doubleIt, "12345".getBytes());
fail("Failure expected on an attachment which isn't encrypted");
} catch (javax.xml.ws.soap.SOAPFaultException ex) {
String error = "EncryptedParts";
assertTrue(ex.getMessage().contains(error));
}
// Streaming
try {
enableStreaming(port);
doubleIt = new DoubleIt3();
doubleIt.setNumberToDouble(25);
port.doubleIt3(doubleIt, "12345".getBytes());
fail("Failure expected on an attachment which isn't encrypted");
} catch (javax.xml.ws.soap.SOAPFaultException ex) {
// String error = "SignedParts";
// assertTrue(ex.getMessage().contains(error));