URL wsdl = PartsTest.class.getResource("DoubleItParts.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
// Successful invocation
QName portQName = new QName(NAMESPACE, "DoubleItSignedAttachmentsPort");
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 signed
portQName = new QName(NAMESPACE, "DoubleItSignedAttachmentsPort2");
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 signed");
} catch (javax.xml.ws.soap.SOAPFaultException ex) {
String error = "SignedParts";
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 signed");
} catch (javax.xml.ws.soap.SOAPFaultException ex) {
// String error = "SignedParts";
// assertTrue(ex.getMessage().contains(error));
}