Search in sources :

Example 1 with CorbaStreamable

use of org.apache.cxf.binding.corba.CorbaStreamable in project cxf by apache.

the class CorbaStreamInInterceptor method prepareArguments.

protected NVList prepareArguments(CorbaMessage corbaMsg, InterfaceInfo info, OperationType opType, QName opQName, CorbaTypeMap typeMap, CorbaDestination destination, ServiceInfo service) {
    BindingInfo bInfo = destination.getBindingInfo();
    EndpointInfo eptInfo = destination.getEndPointInfo();
    BindingOperationInfo bOpInfo = bInfo.getOperation(opQName);
    OperationInfo opInfo = bOpInfo.getOperationInfo();
    Exchange exg = corbaMsg.getExchange();
    exg.put(BindingInfo.class, bInfo);
    exg.put(InterfaceInfo.class, info);
    exg.put(EndpointInfo.class, eptInfo);
    exg.put(EndpointReferenceType.class, destination.getAddress());
    exg.put(ServiceInfo.class, service);
    exg.put(BindingOperationInfo.class, bOpInfo);
    exg.put(OperationInfo.class, opInfo);
    exg.put(MessageInfo.class, opInfo.getInput());
    exg.put(String.class, opQName.getLocalPart());
    exg.setInMessage(corbaMsg);
    corbaMsg.put(MessageInfo.class, opInfo.getInput());
    List<ParamType> paramTypes = opType.getParam();
    CorbaStreamable[] arguments = new CorbaStreamable[paramTypes.size()];
    return prepareDIIArgsList(corbaMsg, bOpInfo, arguments, paramTypes, typeMap, exg.get(ORB.class), service);
}
Also used : BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) OperationInfo(org.apache.cxf.service.model.OperationInfo) Exchange(org.apache.cxf.message.Exchange) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) CorbaStreamable(org.apache.cxf.binding.corba.CorbaStreamable) BindingInfo(org.apache.cxf.service.model.BindingInfo) ParamType(org.apache.cxf.binding.corba.wsdl.ParamType) ORB(org.omg.CORBA.ORB)

Example 2 with CorbaStreamable

use of org.apache.cxf.binding.corba.CorbaStreamable in project cxf by apache.

the class CorbaStreamOutEndingInterceptor method handleOutBoundMessage.

private void handleOutBoundMessage(CorbaMessage message, BindingOperationInfo boi) {
    OperationInfo opInfo = boi.getOperationInfo();
    OperationType opType = boi.getExtensor(OperationType.class);
    List<ParamType> paramTypes = opType.getParam();
    MessageInfo outMsgInfo = opInfo.getOutput();
    String wrapNSUri = null;
    boolean wrap = false;
    if (boi.isUnwrappedCapable()) {
        wrap = true;
        if (outMsgInfo != null) {
            wrapNSUri = getWrappedParamNamespace(outMsgInfo);
            if (!CorbaUtils.isElementFormQualified(service, wrapNSUri)) {
                wrapNSUri = "";
            }
        }
    }
    CorbaStreamWriter writer = (CorbaStreamWriter) message.getContent(XMLStreamWriter.class);
    CorbaObjectHandler[] objs = writer.getCorbaObjects();
    int count = 0;
    int msgIndex = 0;
    ArgType returnParam = opType.getReturn();
    if (returnParam != null) {
        QName retName;
        if (wrap) {
            retName = new QName(wrapNSUri, returnParam.getName());
        } else {
            retName = getMessageParamQName(outMsgInfo, returnParam.getName(), msgIndex);
        }
        QName retIdlType = returnParam.getIdltype();
        CorbaObjectHandler obj = CorbaHandlerUtils.initializeObjectHandler(orb, retName, retIdlType, typeMap, service);
        CorbaStreamable streamable = message.createStreamableObject(obj, retName);
        message.setStreamableReturn(streamable);
        msgIndex++;
    }
    for (Iterator<ParamType> iter = paramTypes.iterator(); iter.hasNext(); ) {
        ParamType param = iter.next();
        QName idlType = param.getIdltype();
        QName paramName;
        final CorbaObjectHandler obj;
        if (param.getMode().equals(ModeType.OUT)) {
            if (wrap) {
                paramName = new QName(wrapNSUri, param.getName());
            } else {
                paramName = getMessageParamQName(outMsgInfo, param.getName(), msgIndex);
            }
            obj = CorbaHandlerUtils.initializeObjectHandler(orb, paramName, idlType, typeMap, service);
            msgIndex++;
        } else {
            obj = objs[count++];
            paramName = obj.getName();
        }
        CorbaStreamable streamable = message.createStreamableObject(obj, paramName);
        ModeType paramMode = param.getMode();
        if ("in".equals(paramMode.value())) {
            streamable.setMode(org.omg.CORBA.ARG_IN.value);
        } else if ("inout".equals(paramMode.value())) {
            streamable.setMode(org.omg.CORBA.ARG_INOUT.value);
        }
        // default mode is out
        message.addStreamableArgument(streamable);
    }
}
Also used : BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) OperationInfo(org.apache.cxf.service.model.OperationInfo) ArgType(org.apache.cxf.binding.corba.wsdl.ArgType) CorbaStreamable(org.apache.cxf.binding.corba.CorbaStreamable) QName(javax.xml.namespace.QName) ParamType(org.apache.cxf.binding.corba.wsdl.ParamType) MessageInfo(org.apache.cxf.service.model.MessageInfo) CorbaStreamWriter(org.apache.cxf.binding.corba.runtime.CorbaStreamWriter) XMLStreamWriter(javax.xml.stream.XMLStreamWriter) CorbaObjectHandler(org.apache.cxf.binding.corba.types.CorbaObjectHandler) ModeType(org.apache.cxf.binding.corba.wsdl.ModeType) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType)

Example 3 with CorbaStreamable

use of org.apache.cxf.binding.corba.CorbaStreamable in project cxf by apache.

the class CorbaStreamFaultOutInterceptor method setUserExceptionFromFaultDetail.

protected void setUserExceptionFromFaultDetail(CorbaMessage message, org.w3c.dom.Element faultDetail, RaisesType exType, OperationInfo opInfo, DataWriter<XMLStreamWriter> writer, ServiceInfo service) throws Exception {
    QName exIdlType = exType.getException();
    QName elName = new QName("", exIdlType.getLocalPart());
    MessagePartInfo faultPart = getFaultMessagePartInfo(opInfo, elName);
    // faultDetailt.getFirstChild() skips the "detail" element
    Object fault = extractPartsInfoFromDetail((Element) faultDetail.getFirstChild(), exType);
    CorbaFaultStreamWriter faultWriter = new CorbaFaultStreamWriter(orb, exType, message.getCorbaTypeMap(), service);
    writer.write(fault, faultPart, faultWriter);
    CorbaObjectHandler[] objs = faultWriter.getCorbaObjects();
    CorbaStreamable streamable = message.createStreamableObject(objs[0], elName);
    message.setStreamableException(streamable);
}
Also used : CorbaStreamable(org.apache.cxf.binding.corba.CorbaStreamable) QName(javax.xml.namespace.QName) CorbaFaultStreamWriter(org.apache.cxf.binding.corba.runtime.CorbaFaultStreamWriter) CorbaObjectHandler(org.apache.cxf.binding.corba.types.CorbaObjectHandler) MessagePartInfo(org.apache.cxf.service.model.MessagePartInfo)

Example 4 with CorbaStreamable

use of org.apache.cxf.binding.corba.CorbaStreamable in project cxf by apache.

the class CorbaStreamFaultOutInterceptor method setUserException.

protected void setUserException(CorbaMessage message, Throwable ex, RaisesType exType, OperationInfo opInfo, DataWriter<XMLStreamWriter> writer, ServiceInfo service) throws Exception {
    QName exIdlType = exType.getException();
    QName elName = new QName("", exIdlType.getLocalPart());
    MessagePartInfo faultPart = getFaultMessagePartInfo(opInfo, elName);
    if (faultPart == null) {
        throw new CorbaBindingException("Coulnd't find the message fault part : " + elName);
    }
    Method faultMethod = ex.getClass().getMethod("getFaultInfo");
    if (faultMethod == null) {
        return;
    }
    Object fault = faultMethod.invoke(ex);
    // one has not been created on the servant side which throws the UserException.
    if (fault == null) {
        Class<?> faultClass = faultMethod.getReturnType();
        fault = faultClass.newInstance();
    }
    CorbaFaultStreamWriter faultWriter = new CorbaFaultStreamWriter(orb, exType, message.getCorbaTypeMap(), service);
    writer.write(fault, faultPart, faultWriter);
    CorbaObjectHandler[] objs = faultWriter.getCorbaObjects();
    CorbaStreamable streamable = message.createStreamableObject(objs[0], elName);
    message.setStreamableException(streamable);
}
Also used : CorbaBindingException(org.apache.cxf.binding.corba.CorbaBindingException) CorbaStreamable(org.apache.cxf.binding.corba.CorbaStreamable) QName(javax.xml.namespace.QName) CorbaFaultStreamWriter(org.apache.cxf.binding.corba.runtime.CorbaFaultStreamWriter) CorbaObjectHandler(org.apache.cxf.binding.corba.types.CorbaObjectHandler) Method(java.lang.reflect.Method) MessagePartInfo(org.apache.cxf.service.model.MessagePartInfo)

Example 5 with CorbaStreamable

use of org.apache.cxf.binding.corba.CorbaStreamable in project cxf by apache.

the class CorbaUtils method nvListFromStreamables.

public static NVList nvListFromStreamables(ORB orb, CorbaStreamable[] streamables) {
    final NVList list;
    if (streamables != null && streamables.length > 0) {
        list = orb.create_list(streamables.length);
        for (CorbaStreamable streamable : streamables) {
            Any value = orb.create_any();
            value.insert_Streamable(streamable);
            list.add_value(streamable.getName(), value, streamable.getMode());
        }
    } else {
        list = orb.create_list(0);
    }
    return list;
}
Also used : CorbaStreamable(org.apache.cxf.binding.corba.CorbaStreamable) NVList(org.omg.CORBA.NVList) Any(org.omg.CORBA.Any)

Aggregations

CorbaStreamable (org.apache.cxf.binding.corba.CorbaStreamable)12 QName (javax.xml.namespace.QName)10 CorbaPrimitiveHandler (org.apache.cxf.binding.corba.types.CorbaPrimitiveHandler)5 Test (org.junit.Test)5 TypeCode (org.omg.CORBA.TypeCode)5 CorbaObjectHandler (org.apache.cxf.binding.corba.types.CorbaObjectHandler)4 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)4 OperationInfo (org.apache.cxf.service.model.OperationInfo)4 ParamType (org.apache.cxf.binding.corba.wsdl.ParamType)3 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)2 CorbaBindingException (org.apache.cxf.binding.corba.CorbaBindingException)2 CorbaFaultStreamWriter (org.apache.cxf.binding.corba.runtime.CorbaFaultStreamWriter)2 CorbaStreamWriter (org.apache.cxf.binding.corba.runtime.CorbaStreamWriter)2 ArgType (org.apache.cxf.binding.corba.wsdl.ArgType)2 ModeType (org.apache.cxf.binding.corba.wsdl.ModeType)2 OperationType (org.apache.cxf.binding.corba.wsdl.OperationType)2 MessageInfo (org.apache.cxf.service.model.MessageInfo)2 MessagePartInfo (org.apache.cxf.service.model.MessagePartInfo)2 InputStream (org.omg.CORBA.portable.InputStream)2 OutputStream (org.omg.CORBA.portable.OutputStream)2