Search in sources :

Example 16 with ParamType

use of org.apache.cxf.binding.corba.wsdl.ParamType in project cxf by apache.

the class WSDLToCorbaBinding method addCorbaOperationExtElement.

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);
}
Also used : ArgType(org.apache.cxf.binding.corba.wsdl.ArgType) RaisesType(org.apache.cxf.binding.corba.wsdl.RaisesType) CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) WSDLException(javax.wsdl.WSDLException) ArrayList(java.util.ArrayList) Fault(javax.wsdl.Fault) BindingFault(javax.wsdl.BindingFault) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType) WSDLException(javax.wsdl.WSDLException) ToolException(org.apache.cxf.tools.common.ToolException) ParamType(org.apache.cxf.binding.corba.wsdl.ParamType)

Example 17 with ParamType

use of org.apache.cxf.binding.corba.wsdl.ParamType in project cxf by apache.

the class WSDLToIDLAction method createIdlAttribute.

public void createIdlAttribute(org.apache.cxf.binding.corba.wsdl.OperationType opType, String name) throws Exception {
    String attrNm = name.substring(5, name.length());
    IdlAttribute attr;
    IdlDefn idlDef = intf.lookup(attrNm);
    if (idlDef == null) {
        if (name.startsWith("_get_")) {
            ArgType t = opType.getReturn();
            attr = IdlAttribute.create(intf, attrNm, findType(t.getIdltype()), true);
        } else {
            ParamType arg = opType.getParam().iterator().next();
            attr = IdlAttribute.create(intf, attrNm, findType(arg.getIdltype()), false);
        }
        intf.addAttribute(attr);
    } else {
        attr = (IdlAttribute) idlDef;
        if (attr.readonly() && name.startsWith("_set_")) {
            attr.setReadonly(false);
        }
    }
}
Also used : ArgType(org.apache.cxf.binding.corba.wsdl.ArgType) IdlDefn(org.apache.cxf.tools.corba.common.idltypes.IdlDefn) IdlAttribute(org.apache.cxf.tools.corba.common.idltypes.IdlAttribute) IdlString(org.apache.cxf.tools.corba.common.idltypes.IdlString) ParamType(org.apache.cxf.binding.corba.wsdl.ParamType)

Example 18 with ParamType

use of org.apache.cxf.binding.corba.wsdl.ParamType in project cxf by apache.

the class WSDLToIDLAction method createIdlOperation.

public void createIdlOperation(org.apache.cxf.binding.corba.wsdl.OperationType opType, String name, boolean isOneway) throws Exception {
    IdlOperation idlOp = IdlOperation.create(intf, opType.getName(), isOneway);
    intf.holdForScope(idlOp);
    ArgType crt = opType.getReturn();
    if (crt != null) {
        IdlType rt = findType(crt.getIdltype());
        idlOp.addReturnType(rt);
    }
    for (ParamType arg : opType.getParam()) {
        IdlType type = findType(arg.getIdltype());
        String mode = arg.getMode().value();
        IdlParam param = IdlParam.create(idlOp, arg.getName(), type, mode);
        idlOp.addParameter(param);
    }
    for (RaisesType rs : opType.getRaises()) {
        IdlType type = findType(rs.getException());
        if (type instanceof IdlException) {
            idlOp.addException((IdlException) type);
        } else {
            String msgStr = type.fullName() + " is not a type.";
            org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message(msgStr, LOG);
            throw new Exception(msg.toString());
        }
    }
    root.flush();
    intf.promoteHeldToScope();
}
Also used : ArgType(org.apache.cxf.binding.corba.wsdl.ArgType) IdlException(org.apache.cxf.tools.corba.common.idltypes.IdlException) IdlString(org.apache.cxf.tools.corba.common.idltypes.IdlString) IdlType(org.apache.cxf.tools.corba.common.idltypes.IdlType) ParamType(org.apache.cxf.binding.corba.wsdl.ParamType) IdlException(org.apache.cxf.tools.corba.common.idltypes.IdlException) IdlOperation(org.apache.cxf.tools.corba.common.idltypes.IdlOperation) RaisesType(org.apache.cxf.binding.corba.wsdl.RaisesType) IdlParam(org.apache.cxf.tools.corba.common.idltypes.IdlParam)

Example 19 with ParamType

use of org.apache.cxf.binding.corba.wsdl.ParamType in project cxf by apache.

the class AttributeVisitor method generateCorbaParam.

private ParamType generateCorbaParam(AST type) {
    ParamType param = new ParamType();
    param.setName(PARAM_NAME);
    param.setMode(ModeType.IN);
    ParamTypeSpecVisitor visitor = new ParamTypeSpecVisitor(getScope(), definition, schema, wsdlVisitor);
    visitor.visit(type);
    CorbaTypeImpl corbaType = visitor.getCorbaType();
    if (corbaType != null) {
        param.setIdltype(corbaType.getQName());
    } else {
        wsdlVisitor.getDeferredActions().add(visitor.getFullyQualifiedName(), new AttributeDeferredAction(param));
    }
    return param;
}
Also used : CorbaTypeImpl(org.apache.cxf.binding.corba.wsdl.CorbaTypeImpl) ParamType(org.apache.cxf.binding.corba.wsdl.ParamType)

Example 20 with ParamType

use of org.apache.cxf.binding.corba.wsdl.ParamType in project cxf by apache.

the class CorbaStreamInInterceptor method prepareDIIArgsList.

protected NVList prepareDIIArgsList(CorbaMessage corbaMsg, BindingOperationInfo boi, CorbaStreamable[] streamables, List<ParamType> paramTypes, CorbaTypeMap map, ORB orb, ServiceInfo service) {
    try {
        // Build the list of DII arguments, returns, and exceptions
        NVList list = orb.create_list(streamables.length);
        OperationInfo opInfo = boi.getOperationInfo();
        MessageInfo input = opInfo.getInput();
        MessageInfo output = opInfo.getOutput();
        String inWrapNSUri = null;
        String outWrapNSUri = null;
        boolean wrap = false;
        if (boi.isUnwrappedCapable()) {
            wrap = true;
            if (input != null) {
                inWrapNSUri = getWrappedParamNamespace(input);
                if (!CorbaUtils.isElementFormQualified(service, inWrapNSUri)) {
                    inWrapNSUri = "";
                }
            }
            if (output != null) {
                outWrapNSUri = getWrappedParamNamespace(output);
                if (!CorbaUtils.isElementFormQualified(service, outWrapNSUri)) {
                    outWrapNSUri = "";
                }
            }
        }
        int inMsgIndex = 0;
        int outMsgIndex = 0;
        for (int i = 0; i < paramTypes.size(); i++) {
            ParamType param = paramTypes.get(i);
            QName paramIdlType = param.getIdltype();
            QName paramName;
            ModeType paramMode = param.getMode();
            if (paramMode.value().equals("in")) {
                if (wrap) {
                    paramName = new QName(inWrapNSUri, param.getName());
                } else {
                    paramName = getMessageParamQName(input, param.getName(), inMsgIndex);
                    inMsgIndex++;
                }
            } else {
                if (wrap) {
                    paramName = new QName(outWrapNSUri, param.getName());
                } else {
                    paramName = getMessageParamQName(output, param.getName(), outMsgIndex);
                    outMsgIndex++;
                }
            }
            CorbaObjectHandler obj = CorbaHandlerUtils.initializeObjectHandler(orb, paramName, paramIdlType, map, service);
            streamables[i] = corbaMsg.createStreamableObject(obj, paramName);
            Any value = CorbaAnyHelper.createAny(orb);
            if (paramMode.value().equals("in")) {
                streamables[i].setMode(org.omg.CORBA.ARG_IN.value);
                streamables[i].getObject().setIntoAny(value, streamables[i], false);
            } else if (paramMode.value().equals("out")) {
                streamables[i].setMode(org.omg.CORBA.ARG_OUT.value);
                streamables[i].getObject().setIntoAny(value, streamables[i], true);
            } else {
                streamables[i].setMode(org.omg.CORBA.ARG_INOUT.value);
                streamables[i].getObject().setIntoAny(value, streamables[i], false);
            }
            list.add_value(streamables[i].getName(), value, streamables[i].getMode());
            corbaMsg.addStreamableArgument(streamables[i]);
        }
        return list;
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
}
Also used : BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) OperationInfo(org.apache.cxf.service.model.OperationInfo) QName(javax.xml.namespace.QName) Any(org.omg.CORBA.Any) Endpoint(org.apache.cxf.endpoint.Endpoint) ParamType(org.apache.cxf.binding.corba.wsdl.ParamType) MessageInfo(org.apache.cxf.service.model.MessageInfo) BindingMessageInfo(org.apache.cxf.service.model.BindingMessageInfo) ModeType(org.apache.cxf.binding.corba.wsdl.ModeType) CorbaObjectHandler(org.apache.cxf.binding.corba.types.CorbaObjectHandler) NVList(org.omg.CORBA.NVList)

Aggregations

ParamType (org.apache.cxf.binding.corba.wsdl.ParamType)21 QName (javax.xml.namespace.QName)9 ArgType (org.apache.cxf.binding.corba.wsdl.ArgType)8 OperationType (org.apache.cxf.binding.corba.wsdl.OperationType)8 Message (javax.wsdl.Message)4 CorbaStreamWriter (org.apache.cxf.binding.corba.runtime.CorbaStreamWriter)4 ModeType (org.apache.cxf.binding.corba.wsdl.ModeType)4 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)4 OperationInfo (org.apache.cxf.service.model.OperationInfo)4 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)4 ArrayList (java.util.ArrayList)3 BindingOperation (javax.wsdl.BindingOperation)3 Part (javax.wsdl.Part)3 CorbaStreamable (org.apache.cxf.binding.corba.CorbaStreamable)3 CorbaObjectHandler (org.apache.cxf.binding.corba.types.CorbaObjectHandler)3 MessageInfo (org.apache.cxf.service.model.MessageInfo)3 File (java.io.File)2 Binding (javax.wsdl.Binding)2 Definition (javax.wsdl.Definition)2 Input (javax.wsdl.Input)2