use of org.example.contract.doubleit.DoubleItFault in project cxf by apache.
the class DoubleItPortTypeImplJavaFirst method doubleIt.
@Policies({ @Policy(uri = "classpath:/org/apache/cxf/systest/ws/fault/SymmetricUTPolicy.xml"), @Policy(uri = "classpath:/org/apache/cxf/systest/ws/fault/SignedEncryptedPolicy.xml", placement = Placement.BINDING_OPERATION_OUTPUT) })
public int doubleIt(int numberToDouble) throws DoubleItFault {
Principal pr = wsContext.getUserPrincipal();
if ("alice".equals(pr.getName())) {
return numberToDouble * 2;
}
org.example.schema.doubleit.DoubleItFault internalFault = new org.example.schema.doubleit.DoubleItFault();
internalFault.setMajor((short) 124);
internalFault.setMinor((short) 1256);
throw new DoubleItFault("This is a fault", internalFault);
}
use of org.example.contract.doubleit.DoubleItFault in project cxf by apache.
the class DoubleIt3Impl method doubleIt3.
@Override
public DoubleItResponse doubleIt3(DoubleIt3 parameters, byte[] attachment) throws DoubleItFault {
int numberToDouble = parameters.getNumberToDouble();
if (numberToDouble == 0) {
throw new DoubleItFault("0 can't be doubled!");
}
if (!Arrays.equals(attachment, "12345".getBytes())) {
throw new DoubleItFault("Unexpected attachment value!");
}
DoubleItResponse response = new DoubleItResponse();
response.setDoubledNumber(numberToDouble * 2);
return response;
}
use of org.example.contract.doubleit.DoubleItFault in project cxf by apache.
the class DoubleIt3Impl method doubleIt3.
@Override
public DoubleItResponse doubleIt3(DoubleIt3 parameters, byte[] attachment) throws DoubleItFault {
int numberToDouble = parameters.getNumberToDouble();
if (numberToDouble == 0) {
throw new DoubleItFault("0 can't be doubled!");
}
if (!Arrays.equals(attachment, "12345".getBytes())) {
throw new DoubleItFault("Unexpected attachment value!");
}
DoubleItResponse response = new DoubleItResponse();
response.setDoubledNumber(numberToDouble * 2);
return response;
}
use of org.example.contract.doubleit.DoubleItFault in project cxf by apache.
the class DoubleItBSTImpl method doubleIt.
public int doubleIt(int numberToDouble) throws DoubleItFault {
if (numberToDouble == 0) {
throw new DoubleItFault("0 can't be doubled!");
}
List<WSHandlerResult> results = CastUtils.cast((List<?>) wsContext.getMessageContext().get(WSHandlerConstants.RECV_RESULTS));
Assert.assertNotNull("Security Results cannot be null", results);
Assert.assertTrue(!results.isEmpty());
WSHandlerResult result = results.get(0);
List<WSSecurityEngineResult> securityResults = result.getResults();
Assert.assertNotNull("Security Results cannot be null", securityResults);
Assert.assertTrue(!securityResults.isEmpty());
WSSecurityEngineResult securityResult = securityResults.get(0);
BinarySecurity binarySecurityToken = (BinarySecurity) securityResult.get(WSSecurityEngineResult.TAG_BINARY_SECURITY_TOKEN);
Assert.assertNotNull(binarySecurityToken);
Assert.assertTrue(Arrays.equals(binarySecurityToken.getToken(), "This is a token".getBytes()));
return numberToDouble * 2;
}
use of org.example.contract.doubleit.DoubleItFault in project cxf by apache.
the class DoubleItPortTypeImpl method doubleIt.
public int doubleIt(int numberToDouble) throws DoubleItFault {
Principal pr = wsContext.getUserPrincipal();
if ("alice".equals(pr.getName())) {
return numberToDouble * 2;
}
org.example.schema.doubleit.DoubleItFault internalFault = new org.example.schema.doubleit.DoubleItFault();
internalFault.setMajor((short) 124);
internalFault.setMinor((short) 1256);
throw new DoubleItFault("This is a fault", internalFault);
}
Aggregations