/** * Find the correct Fault part for a particular exception. * * @param op * @param class1 * @return */ public FaultInfo getFaultForClass(OperationInfo op, Class class1) { for (Iterator itr = op.getFaults().iterator(); itr.hasNext(); ) { FaultInfo faultInfo = (FaultInfo) itr.next(); if (faultInfo.getExceptionClass().isAssignableFrom(class1)) { return faultInfo; } } return null; }
public void testVisitor() throws Exception { WSDLServiceBuilder builder = new WSDLServiceBuilder(getResourceAsStream("extendedWrappedTypes.wsdl")); builder.setBindingProvider(new MessageBindingProvider()); builder.build(); Map serviceMap = builder.getServices(); assertEquals(1, serviceMap.size()); Collection services = builder.getAllServices(); assertEquals(1, services.size()); Service service = (Service) services.iterator().next(); Collection operations = service.getServiceInfo().getOperations(); assertEquals(2, operations.size()); OperationInfo opInfo = (OperationInfo) operations.iterator().next(); assertEquals(1, opInfo.getInputMessage().size()); assertEquals(1, opInfo.getOutputMessage().size()); }