javax.wsdl.Fault Java Examples

The following examples show how to use javax.wsdl.Fault. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WsdlOpFaultList.java    From hop with Apache License 2.0 6 votes vote down vote up
/**
 * Create a WsdlOpFault from the Fault.
 *
 * @param fault Fault to process.
 * @return WsdlOpFault Result of processing.
 */
@SuppressWarnings( "unchecked" )
private WsdlOpFault getFault( Fault fault ) throws HopTransformException {
  Message m = fault.getMessage();

  // a fault should only have one message part.
  Map<?, Part> partMap = m.getParts();
  if ( partMap.size() != 1 ) {
    throw new IllegalArgumentException( "Invalid part count for fault!!" );
  }
  Part faultPart = partMap.values().iterator().next();
  boolean complexType = false;

  // type of fault is specified either in Part's type or element attribute.
  QName type = faultPart.getTypeName();
  if ( type == null ) {
    type = faultPart.getElementName();
    Element schemaElement = _wsdlTypes.findNamedElement( type );
    type = _wsdlTypes.getTypeQName( schemaElement.getAttribute( "type" ) );
    complexType = true;
  }
  return new WsdlOpFault( fault.getName(), type, complexType, _wsdlTypes );
}
 
Example #2
Source File: WsdlOpFaultList.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Create a WsdlOpFault from the Fault.
 *
 * @param fault
 *          Fault to process.
 * @return WsdlOpFault Result of processing.
 */
@SuppressWarnings( "unchecked" )
private WsdlOpFault getFault( Fault fault ) throws KettleStepException {
  Message m = fault.getMessage();

  // a fault should only have one message part.
  Map<?, Part> partMap = m.getParts();
  if ( partMap.size() != 1 ) {
    throw new IllegalArgumentException( "Invalid part count for fault!!" );
  }
  Part faultPart = partMap.values().iterator().next();
  boolean complexType = false;

  // type of fault is specified either in Part's type or element attribute.
  QName type = faultPart.getTypeName();
  if ( type == null ) {
    type = faultPart.getElementName();
    Element schemaElement = _wsdlTypes.findNamedElement( type );
    type = _wsdlTypes.getTypeQName( schemaElement.getAttribute( "type" ) );
    complexType = true;
  }
  return new WsdlOpFault( fault.getName(), type, complexType, _wsdlTypes );
}
 
Example #3
Source File: OperationInfo.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
public OperationInfo(Operation operation) {
    targetMethodName = operation.getName();

    Input inDef = operation.getInput();
    if (inDef != null) {
        Message inMsg = inDef.getMessage();
        if (inMsg != null) {
            input = getParameterFromMessage(inMsg);
        }
    }
    Output outDef = operation.getOutput();
    if (outDef != null) {
        Message outMsg = outDef.getMessage();
        if (outMsg != null) {
            output = getParameterFromMessage(outMsg);
        }
    }
    for (Fault fault : (Collection<Fault>) operation.getFaults().values()) {
        Message faultMsg = fault.getMessage();
        if (faultMsg != null) {
            faults.add(getParameterFromMessage(faultMsg));
        }
    }
}
 
Example #4
Source File: WsdlOperation.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Create the fault list for this operation.
 *
 * @param op
 *          Operation
 */
@SuppressWarnings( "unchecked" )
private void loadFaults( Operation op ) throws KettleStepException {
  Map<?, Fault> faultMap = op.getFaults();
  for ( Fault fault : faultMap.values() ) {
    _faults.add( fault );
  }
}
 
Example #5
Source File: LightWeightMappingValidator.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
protected void visit(Fault fault) {
    Part message = fault.getMessage().getPart("message");
    if (message == null) {
        context.addFailure(new ValidationFailure("The fault message must contain one part named 'message' : " + fault.getName()));
    } else if (!XSD_STRING.equals(message.getTypeName())) {
        context.addFailure(new ValidationFailure("The fault message must contain one part of type 'xsd:string' : " + fault.getName()));
    }
}
 
Example #6
Source File: ServiceWSDLBuilderTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testPingMeOperation() throws Exception {
    setupWSDL(WSDL_PATH);
    PortType portType = newDef.getPortType(new QName(newDef.getTargetNamespace(),
        "Greeter"));
    Operation pingMe = portType.getOperation("pingMe", "pingMeRequest", "pingMeResponse");
    assertNotNull(pingMe);
    assertEquals("pingMe", pingMe.getName());
    Input input = pingMe.getInput();
    assertNotNull(input);
    assertEquals("pingMeRequest", input.getName());
    Message message = input.getMessage();
    assertNotNull(message);
    assertEquals("pingMeRequest", message.getQName().getLocalPart());
    assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI());
    assertEquals(1, message.getParts().size());
    assertEquals("in", message.getPart("in").getName());
    Output output = pingMe.getOutput();
    assertNotNull(output);
    assertEquals("pingMeResponse", output.getName());
    message = output.getMessage();
    assertNotNull(message);
    assertEquals("pingMeResponse", message.getQName().getLocalPart());
    assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI());
    assertEquals(message.getParts().size(), 1);
    assertEquals("out", message.getPart("out").getName());
    assertEquals(1, pingMe.getFaults().size());
    Fault fault = pingMe.getFault("pingMeFault");
    assertNotNull(fault);
    assertEquals("pingMeFault", fault.getName());
    message = fault.getMessage();
    assertNotNull(message);
    assertEquals("pingMeFault", message.getQName().getLocalPart());
    assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI());
    assertEquals(1, message.getParts().size());
    assertEquals("faultDetail", message.getPart("faultDetail").getName());
    assertNull(message.getPart("faultDetail").getTypeName());
}
 
Example #7
Source File: PartialWSDLProcessor.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static void addSoapFaults(Operation op, BindingOperation bindingOperation, Definition wsdlDefinition,
                                  ExtensionRegistry extReg) throws Exception {
    Map<String, Fault> faults = CastUtils.cast(op.getFaults());
    for (Fault fault : faults.values()) {
        BindingFault bf = wsdlDefinition.createBindingFault();
        bf.setName(fault.getName());
        setSoapFaultExtElement(bf, extReg);
        bindingOperation.addBindingFault(bf);
    }
}
 
Example #8
Source File: WSDLToSoapProcessor.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void addSoapFaults(Operation op, BindingOperation bindingOperation) throws ToolException {
    Map<String, Fault> faults = CastUtils.cast(op.getFaults());
    for (Fault fault : faults.values()) {
        BindingFault bf = wsdlDefinition.createBindingFault();
        bf.setName(fault.getName());
        setSoapFaultExtElement(bf);
        bindingOperation.addBindingFault(bf);
    }
}
 
Example #9
Source File: JAXWSDefinitionBuilder.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void registerJaxwsExtension(ExtensionRegistry registry) {
    registerJAXWSBinding(registry, Definition.class);
    registerJAXWSBinding(registry, Service.class);
    registerJAXWSBinding(registry, Fault.class);
    registerJAXWSBinding(registry, PortType.class);
    registerJAXWSBinding(registry, Port.class);
    registerJAXWSBinding(registry, Operation.class);
    registerJAXWSBinding(registry, Binding.class);
    registerJAXWSBinding(registry, BindingOperation.class);
}
 
Example #10
Source File: FaultBeanGenerator.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected Set<Class<?>> getExceptionClasses(final Method method) {
    Set<Class<?>> exps = new HashSet<>();
    final Class<?>[] exceptionClasses = method.getExceptionTypes();
    for (int i = 0; i < exceptionClasses.length; i++) {
        boolean exclude = false;
        Class<?> exClazz = exceptionClasses[i];

        if (exClazz.equals(Exception.class)
            || Fault.class.isAssignableFrom(exClazz)
            || exClazz.equals(RuntimeException.class)
            || exClazz.equals(Throwable.class)
            || exClazz.equals(RemoteException.class)
            || exClazz.equals(ServerException.class)) {
            continue;
        }

        Method[] expMethods = exClazz.getMethods();
        for (Method expMethod : expMethods) {
            if ("getFaultInfo".equals(expMethod.getName())) {
                exclude = true;
                break;
            }
        }
        if (exclude) {
            continue;
        }
        exps.add(exClazz);
    }
    return exps;
}
 
Example #11
Source File: WSDLToCorbaBinding.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void addCorbaOperationExtElement(BindingOperation bo, Operation op)
    throws Exception {

    OperationType operationType = null;
    try {
        operationType = (OperationType)extReg.createExtension(BindingOperation.class,
                                                              CorbaConstants.NE_CORBA_OPERATION);
    } catch (WSDLException wse) {
        LOG.log(Level.SEVERE, "Failed to create a Binding Operation extension", wse);
        throw new Exception(LOG.toString(), wse);
    }

    operationType.setName(op.getName());
    List<ParamType> params = new ArrayList<>();
    List<ArgType> returns = new ArrayList<>();

    wsdlParameter.processParameters(this, op, def, xmlSchemaList, params, returns, true);

    for (ParamType paramtype : params) {
        operationType.getParam().add(paramtype);
    }
    for (ArgType retType : returns) {
        operationType.setReturn(retType);
    }

    Collection<Fault> faults = CastUtils.cast(op.getFaults().values());
    for (Fault fault : faults) {
        RaisesType raisestype = new RaisesType();
        CorbaType extype = convertFaultToCorbaType(xmlSchemaType, fault);
        if (extype != null) {
            raisestype.setException(helper.createQNameCorbaNamespace(extype.getName()));
            operationType.getRaises().add(raisestype);
        }
    }

    bo.addExtensibilityElement((ExtensibilityElement)operationType);
}
 
Example #12
Source File: WSDLToCorbaBinding.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void addBindingOperations(Definition definition, PortType portType, Binding binding)
    throws Exception {

    List<Operation> ops = CastUtils.cast(portType.getOperations());
    for (Operation op : ops) {
        try {
            BindingOperation bindingOperation = definition.createBindingOperation();
            addCorbaOperationExtElement(bindingOperation, op);
            bindingOperation.setName(op.getName());
            if (op.getInput() != null) {
                BindingInput bindingInput = definition.createBindingInput();
                bindingInput.setName(op.getInput().getName());
                bindingOperation.setBindingInput(bindingInput);
            }
            if (op.getOutput() != null) {
                BindingOutput bindingOutput = definition.createBindingOutput();
                bindingOutput.setName(op.getOutput().getName());
                bindingOperation.setBindingOutput(bindingOutput);
            }
            // add Faults
            if (op.getFaults() != null && op.getFaults().size() > 0) {
                Collection<Fault> faults = CastUtils.cast(op.getFaults().values());
                for (Fault fault : faults) {
                    BindingFault bindingFault = definition.createBindingFault();
                    bindingFault.setName(fault.getName());
                    bindingOperation.addBindingFault(bindingFault);
                }
            }
            bindingOperation.setOperation(op);
            binding.addBindingOperation(bindingOperation);
        } catch (Exception ex) {
            LOG.warning("Operation " + op.getName() + " not mapped to CORBA binding.");
        }
    }
}
 
Example #13
Source File: OperationVisitor.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void createFaultMessage(CorbaTypeImpl corbaType,
                                Operation operation,
                                BindingOperation bindingOperation,
                                QName elementQName) {
    String exceptionName = corbaType.getQName().getLocalPart();

    Definition faultDef = manager.getWSDLDefinition(elementQName.getNamespaceURI());
    if (faultDef == null) {
        faultDef = definition;
    }
    Message faultMsg = faultDef.getMessage(new QName(faultDef.getTargetNamespace(), exceptionName));
    if (faultMsg == null) {
        throw new RuntimeException("Fault message for exception " + exceptionName + " not found");
    }

    // porttype - operation - fault
    Fault fault = definition.createFault();
    fault.setMessage(faultMsg);
    fault.setName(faultMsg.getQName().getLocalPart());
    operation.addFault(fault);

    // binding - operation - corba:operation - corba:raises
    RaisesType raisesType = new RaisesType();
    raisesType.setException(new QName(typeMap.getTargetNamespace(),
                                      exceptionName));
    corbaOperation.getRaises().add(raisesType);

    // binding - operation - fault
    BindingFault bindingFault = definition.createBindingFault();
    bindingFault.setName(faultMsg.getQName().getLocalPart());
    bindingOperation.addBindingFault(bindingFault);

    //add the fault element namespace to the definition
    String nsURI = elementQName.getNamespaceURI();
    manager.addWSDLDefinitionNamespace(definition, mapper.mapNSToPrefix(nsURI), nsURI);
}
 
Example #14
Source File: WSIBPValidator.java    From cxf with Apache License 2.0 5 votes vote down vote up
public boolean checkR2205() {
    Collection<Binding> bindings = CastUtils.cast(def.getBindings().values());
    for (Binding binding : bindings) {

        if (!SOAPBindingUtil.isSOAPBinding(binding)) {
            System.err.println("WSIBP Validator found <"
                               + binding.getQName() + "> is NOT a SOAP binding");
            continue;
        }
        if (binding.getPortType() == null) {
            //will error later
            continue;
        }

        for (Iterator<?> ite2 = binding.getPortType().getOperations().iterator(); ite2.hasNext();) {
            Operation operation = (Operation)ite2.next();
            Collection<Fault> faults = CastUtils.cast(operation.getFaults().values());
            if (CollectionUtils.isEmpty(faults)) {
                continue;
            }

            for (Fault fault : faults) {
                Message message = fault.getMessage();
                Collection<Part> parts = CastUtils.cast(message.getParts().values());
                for (Part part : parts) {
                    if (part.getElementName() == null) {
                        addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2205") + "In Message "
                            + message.getQName() + ", part " + part.getName()
                                + " must specify a 'element' attribute");
                        return false;
                    }
                }
            }
        }
    }
    return true;
}
 
Example #15
Source File: PublishMetadataRunnable.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private Collection<String> getAllPaths() throws URISyntaxException {
    final Set<String> paths = new HashSet<String>();
    final Set<QName> portTypes = new HashSet<QName>();
    final Set<QName> alreadyCreated = new HashSet<QName>();
    for (Binding binding : (Collection<Binding>) wsdlDefinition.getAllBindings().values()) {
        final QName portType = binding.getPortType().getQName();
        if (portTypes.add(portType)) {
            for (BindingOperation operation : (Collection<BindingOperation>) binding.getBindingOperations()) {
                Operation oper = operation.getOperation();
                Input inDef = oper.getInput();
                if (inDef != null) {
                    Message inMsg = inDef.getMessage();
                    addParamsToPath(portType, oper, inMsg, paths, alreadyCreated);
                }

                Output outDef = oper.getOutput();
                if (outDef != null) {
                    Message outMsg = outDef.getMessage();
                    addParamsToPath(portType, oper, outMsg, paths, alreadyCreated);
                }
                for (Fault fault : (Collection<Fault>) oper.getFaults().values()) {
                    Message faultMsg = fault.getMessage();
                    addParamsToPath(portType, oper, faultMsg, paths, alreadyCreated);
                }
            }
        }
    }
    return paths;
}
 
Example #16
Source File: WSDLDocCreator.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Operation addRROperation2PT( Definition def, PortType pt, RequestResponseOperationDeclaration op ) {
	Operation wsdlOp = def.createOperation();

	wsdlOp.setName( op.id() );
	wsdlOp.setStyle( OperationType.REQUEST_RESPONSE );
	wsdlOp.setUndefined( false );

	// creating input
	Input in = def.createInput();
	Message msg_req = addRequestMessage( localDef, op );
	in.setMessage( msg_req );
	wsdlOp.setInput( in );

	// creating output
	Output out = def.createOutput();
	Message msg_resp = addResponseMessage( localDef, op );
	out.setMessage( msg_resp );
	wsdlOp.setOutput( out );

	// creating faults
	for( Entry< String, TypeDefinition > curFault : op.faults().entrySet() ) {
		Fault fault = localDef.createFault();
		fault.setName( curFault.getKey() );
		Message flt_msg = addFaultMessage( localDef, curFault.getValue() );
		fault.setMessage( flt_msg );
		wsdlOp.addFault( fault );

	}
	pt.addOperation( wsdlOp );

	return wsdlOp;
}
 
Example #17
Source File: WsdlOperation.java    From hop with Apache License 2.0 5 votes vote down vote up
/**
 * Create the fault list for this operation.
 *
 * @param op Operation
 */
@SuppressWarnings( "unchecked" )
private void loadFaults( Operation op ) throws HopTransformException {
  Map<?, Fault> faultMap = op.getFaults();
  for ( Fault fault : faultMap.values() ) {
    _faults.add( fault );
  }
}
 
Example #18
Source File: WSDLRefValidator.java    From cxf with Apache License 2.0 4 votes vote down vote up
private void collectValidationPointsForPortTypes() {
    for (QName ptName : portTypeRefNames) {
        PortType portType = getPortType(ptName);
        if (portType == null) {
            vResults.addError(new Message("NO_PORTTYPE", LOG, ptName));
            continue;
        }

        XNode vPortTypeNode = getXNode(portType);
        for (Operation operation : getOperations(portType).values()) {
            XNode vOperationNode = getOperationXNode(vPortTypeNode, operation.getName());
            if (operation.getInput() == null) {
                vResults.addError(new Message("WRONG_MEP", LOG, operation.getName(),
                                              portType.getQName()));
                continue;
            }
            javax.wsdl.Message inMsg = operation.getInput().getMessage();
            if (inMsg == null) {
                addWarning("Operation " + operation.getName() + " in PortType: "
                           + portType.getQName() + " has no input message");
            } else {
                XNode vInMsgNode = getXNode(inMsg);
                vInMsgNode.setFailurePoint(getInputXNode(vOperationNode, operation.getInput().getName()));
                vNodes.add(vInMsgNode);
                messageRefNames.add(inMsg.getQName());
            }

            if (operation.getOutput() != null) {
                javax.wsdl.Message outMsg = operation.getOutput().getMessage();

                if (outMsg == null) {
                    addWarning("Operation " + operation.getName() + " in PortType: "
                               + portType.getQName() + " has no output message");
                } else {
                    XNode vOutMsgNode = getXNode(outMsg);
                    vOutMsgNode.setFailurePoint(getOutputXNode(vOperationNode,
                                                               operation.getOutput().getName()));
                    vNodes.add(vOutMsgNode);
                    messageRefNames.add(outMsg.getQName());
                }
            }
            for (Iterator<?> iter = operation.getFaults().values().iterator(); iter.hasNext();) {
                Fault fault = (Fault) iter.next();
                javax.wsdl.Message faultMsg = fault.getMessage();
                XNode vFaultMsgNode = getXNode(faultMsg);
                vFaultMsgNode.setFailurePoint(getFaultXNode(vOperationNode, fault.getName()));
                vNodes.add(vFaultMsgNode);
                messageRefNames.add(faultMsg.getQName());
            }
        }
    }
}
 
Example #19
Source File: ServiceWSDLBuilder.java    From cxf with Apache License 2.0 4 votes vote down vote up
protected void buildPortTypeOperation(PortType portType,
                                      Collection<OperationInfo> operationInfos,
                                      final Definition def) {
    for (OperationInfo operationInfo : operationInfos) {
        Operation operation = null;
        try {
            operation = operationInfo.getProperty(
                WSDLServiceBuilder.WSDL_OPERATION, Operation.class);
        } catch (ClassCastException e) {
            // do nothing
        }

        if (operation == null) {
            operation = def.createOperation();
            addDocumentation(operation, operationInfo.getDocumentation());
            operation.setUndefined(false);
            operation.setName(operationInfo.getName().getLocalPart());
            addNamespace(operationInfo.getName().getNamespaceURI(), def);
            if (operationInfo.isOneWay()) {
                operation.setStyle(OperationType.ONE_WAY);
            }
            addExtensibilityElements(def, operation, getWSDL11Extensors(operationInfo));
            Input input = def.createInput();
            addDocumentation(input, operationInfo.getInput().getDocumentation());
            input.setName(operationInfo.getInputName());
            Message message = def.createMessage();
            buildMessage(message, operationInfo.getInput(), def);
            this.addExtensibilityAttributes(def, input, getInputExtensionAttributes(operationInfo));
            this.addExtensibilityElements(def, input, getWSDL11Extensors(operationInfo.getInput()));
            input.setMessage(message);
            operation.setInput(input);
            operation.setParameterOrdering(operationInfo.getParameterOrdering());

            if (operationInfo.getOutput() != null) {
                Output output = def.createOutput();
                addDocumentation(output, operationInfo.getOutput().getDocumentation());
                output.setName(operationInfo.getOutputName());
                message = def.createMessage();
                buildMessage(message, operationInfo.getOutput(), def);
                this.addExtensibilityAttributes(def, output, getOutputExtensionAttributes(operationInfo));
                this.addExtensibilityElements(def, output, getWSDL11Extensors(operationInfo.getOutput()));
                output.setMessage(message);
                operation.setOutput(output);
            }
            //loop to add fault
            Collection<FaultInfo> faults = operationInfo.getFaults();
            Fault fault = null;
            for (FaultInfo faultInfo : faults) {
                fault = def.createFault();
                addDocumentation(fault, faultInfo.getDocumentation());
                fault.setName(faultInfo.getFaultName().getLocalPart());
                message = def.createMessage();
                buildMessage(message, faultInfo, def);
                this.addExtensibilityAttributes(def, fault, faultInfo.getExtensionAttributes());
                this.addExtensibilityElements(def, fault, getWSDL11Extensors(faultInfo));
                fault.setMessage(message);
                operation.addFault(fault);
            }
        }
        portType.addOperation(operation);
    }
}
 
Example #20
Source File: HeavyweightOperationInfoBuilder.java    From tomee with Apache License 2.0 4 votes vote down vote up
public HeavyweightOperationInfoBuilder(BindingOperation bindingOperation, ServiceEndpointMethodMapping methodMapping, JavaWsdlMapping mapping, XmlSchemaInfo schemaInfo) throws OpenEJBException {
    Operation operation = bindingOperation.getOperation();
    this.operationName = operation.getName();
    this.operationStyle = JaxRpcOperationInfo.OperationStyle.valueOf(operation.getStyle().toString());
    this.outputMessage = operation.getOutput() == null ? null : operation.getOutput().getMessage();
    this.inputMessage = operation.getInput().getMessage();

    // faults
    for (Object o : operation.getFaults().values()) {
        faults.add((Fault) o);
    }

    this.mapping = mapping;
    this.methodMapping = methodMapping;
    this.schemaInfo = schemaInfo;

    // index types - used to process build exception class constructor args
    for (JavaXmlTypeMapping javaXmlTypeMapping : mapping.getJavaXmlTypeMapping()) {
        String javaClassName = javaXmlTypeMapping.getJavaType();
        if (javaXmlTypeMapping.getAnonymousTypeQname() != null) {
            String anonymousTypeQName = javaXmlTypeMapping.getAnonymousTypeQname();
            anonymousTypes.put(anonymousTypeQName, javaClassName);
        } else if (javaXmlTypeMapping.getRootTypeQname() != null) {
            QName qname = javaXmlTypeMapping.getRootTypeQname();
            publicTypes.put(qname, javaClassName);
        }
    }

    // BindingStyle
    if (methodMapping.getWrappedElement() != null) {
        bindingStyle = BindingStyle.DOCUMENT_LITERAL_WRAPPED;
    } else {
        BindingInput bindingInput = bindingOperation.getBindingInput();

        SOAPOperation soapOperation = JaxRpcServiceInfoBuilder.getExtensibilityElement(SOAPOperation.class, bindingOperation.getExtensibilityElements());
        String styleString = soapOperation.getStyle();
        if (styleString == null) {
            SOAPBinding soapBinding = JaxRpcServiceInfoBuilder.getExtensibilityElement(SOAPBinding.class, bindingInput.getExtensibilityElements());
            styleString = soapBinding.getStyle();
        }

        SOAPBody soapBody = JaxRpcServiceInfoBuilder.getExtensibilityElement(SOAPBody.class, bindingInput.getExtensibilityElements());
        String useString = soapBody.getUse();

        bindingStyle = BindingStyle.getBindingStyle(styleString, useString);
    }
}
 
Example #21
Source File: HeavyweightOperationInfoBuilder.java    From tomee with Apache License 2.0 4 votes vote down vote up
public JaxRpcOperationInfo buildOperationInfo() throws OpenEJBException {
    if (operationInfo != null) {
        return operationInfo;
    }

    operationInfo = new JaxRpcOperationInfo();
    operationInfo.name = operationName;

    // Binding style rpc/encoded, doc/lit, wrapped, etc.
    operationInfo.bindingStyle = bindingStyle;

    // Operation style one way, request response, etc/
    operationInfo.operationStyle = operationStyle;

    // Java method name
    operationInfo.javaMethodName = methodMapping.getJavaMethodName();

    //
    // Map the parameters
    //
    mapParameters();

    //
    // Map return
    //
    if (methodMapping.getWsdlReturnValueMapping() != null) {
        mapReturnType();
    }

    // Validate output mapping is complete
    if (outputMessage != null && bindingStyle.isWrapped()) {
        Part inputPart = getWrappedPart(outputMessage);

        QName wrapperName = inputPart.getElementName();
        XmlElementInfo wraperElement = schemaInfo.elements.get(wrapperName);
        XmlTypeInfo wrapperType = schemaInfo.types.get(wraperElement.xmlType);

        Set<String> expectedOutParams = new HashSet<>();
        for (XmlElementInfo expectedOutParam : wrapperType.elements.values()) {
            expectedOutParams.add(expectedOutParam.qname.getLocalPart());
        }
        if (!outParamNames.equals(expectedOutParams)) {
            throw new OpenEJBException("Not all wrapper children were mapped to parameters or a return value for operation " + operationName);
        }
    } else if (null != outputMessage) {
        if (!outParamNames.equals(outputMessage.getParts().keySet())) {
            throw new OpenEJBException("Not all output message parts were mapped to parameters or a return value for operation " + operationName);
        }
    }

    //
    // Map faults (exception)
    //
    for (Fault fault : faults) {
        JaxRpcFaultInfo faultInfo = mapFaults(fault);
        operationInfo.faults.add(faultInfo);
    }

    return operationInfo;
}
 
Example #22
Source File: WsdlVisitor.java    From tomee with Apache License 2.0 4 votes vote down vote up
public void walkTree() {
    begin();
    try {
        visit(definition);
        for (Iterator iterator = definition.getImports().entrySet().iterator(); iterator.hasNext(); ) {
            Map.Entry entry = (Map.Entry) iterator.next();
            String namespaceURI = (String) entry.getKey();
            List importsForNamespace = (List) entry.getValue();
            for (Iterator iterator1 = importsForNamespace.iterator(); iterator1.hasNext(); ) {
                Import anImport = (Import) iterator1.next();
                visit(anImport);
            }
        }
        visit(definition.getTypes());
        Collection messages = definition.getMessages().values();
        for (Iterator iterator = messages.iterator(); iterator.hasNext(); ) {
            Message message = (Message) iterator.next();
            visit(message);
            Collection parts = message.getParts().values();
            for (Iterator iterator2 = parts.iterator(); iterator2.hasNext(); ) {
                Part part = (Part) iterator2.next();
                visit(part);
            }
        }
        Collection services = definition.getServices().values();
        for (Iterator iterator = services.iterator(); iterator.hasNext(); ) {
            Service service = (Service) iterator.next();
            visit(service);
            Collection ports = service.getPorts().values();
            for (Iterator iterator1 = ports.iterator(); iterator1.hasNext(); ) {
                Port port = (Port) iterator1.next();
                visit(port);
                Binding binding = port.getBinding();
                visit(binding);
                List bindingOperations = binding.getBindingOperations();
                for (int i = 0; i < bindingOperations.size(); i++) {
                    BindingOperation bindingOperation = (BindingOperation) bindingOperations.get(i);
                    visit(bindingOperation);
                    visit(bindingOperation.getBindingInput());
                    visit(bindingOperation.getBindingOutput());
                    Collection bindingFaults = bindingOperation.getBindingFaults().values();
                    for (Iterator iterator2 = bindingFaults.iterator(); iterator2.hasNext(); ) {
                        BindingFault bindingFault = (BindingFault) iterator2.next();
                        visit(bindingFault);
                    }

                }
                PortType portType = binding.getPortType();
                visit(portType);
                List operations = portType.getOperations();
                for (int i = 0; i < operations.size(); i++) {
                    Operation operation = (Operation) operations.get(i);
                    visit(operation);
                    {
                        Input input = operation.getInput();
                        visit(input);
                    }
                    {
                        Output output = operation.getOutput();
                        visit(output);
                    }
                    Collection faults = operation.getFaults().values();
                    for (Iterator iterator2 = faults.iterator(); iterator2.hasNext(); ) {
                        Fault fault = (Fault) iterator2.next();
                        visit(fault);
                    }

                }
            }
        }
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
    } finally {
        end();
    }
}
 
Example #23
Source File: WsdlVisitor.java    From tomee with Apache License 2.0 4 votes vote down vote up
protected void visit(Fault fault) {
}
 
Example #24
Source File: WsdlOpFaultList.java    From pentaho-kettle with Apache License 2.0 2 votes vote down vote up
/**
 * Add a fault to this list.
 *
 * @param fault
 *          Fault to add.
 * @return true if this collection was modified as a result of this call.
 */
protected boolean add( Fault fault ) throws KettleStepException {
  return add( getFault( fault ) );
}
 
Example #25
Source File: WsdlOpFaultList.java    From hop with Apache License 2.0 2 votes vote down vote up
/**
 * Add a fault to this list.
 *
 * @param fault Fault to add.
 * @return true if this collection was modified as a result of this call.
 */
protected boolean add( Fault fault ) throws HopTransformException {
  return add( getFault( fault ) );
}