use of org.omg.CORBA.TypeCode in project cxf by apache.
the class CorbaUtilsTest method testFloatTypeCode.
@Test
public void testFloatTypeCode() {
QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "float", "corba");
TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
assertNotNull(tc);
assertTrue(tc.kind().value() == TCKind._tk_float);
assertTrue(CorbaUtils.isPrimitiveIdlType(type));
}
use of org.omg.CORBA.TypeCode in project cxf by apache.
the class CorbaUtilsTest method testWCharTypeCode.
@Test
public void testWCharTypeCode() {
QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "wchar", "corba");
TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
assertNotNull(tc);
assertTrue(tc.kind().value() == TCKind._tk_wchar);
assertTrue(CorbaUtils.isPrimitiveIdlType(type));
}
use of org.omg.CORBA.TypeCode in project cxf by apache.
the class CorbaUtilsTest method testShortTypeCode.
@Test
public void testShortTypeCode() {
QName type = new QName(CorbaConstants.NU_WSDL_CORBA, "short", "corba");
TypeCode tc = CorbaUtils.getPrimitiveTypeCode(orb, type);
assertNotNull(tc);
assertTrue(tc.kind().value() == TCKind._tk_short);
assertTrue(CorbaUtils.isPrimitiveIdlType(type));
}
use of org.omg.CORBA.TypeCode in project cxf by apache.
the class CorbaConduit method buildRequest.
public void buildRequest(CorbaMessage message, OperationType opType) throws Exception {
ServiceInfo service = message.getExchange().getEndpoint().getEndpointInfo().getService();
NVList nvlist = getArguments(message);
NamedValue ret = getReturn(message);
Map<TypeCode, RaisesType> exceptions = getOperationExceptions(opType, typeMap);
ExceptionList exList = getExceptionList(exceptions, message, opType);
Request request = getRequest(message, opType.getName(), nvlist, ret, exList);
if (request == null) {
throw new CorbaBindingException("Couldn't build the corba request");
}
Exception ex = null;
try {
request.invoke();
ex = request.env().exception();
} catch (SystemException sysex) {
ex = sysex;
}
if (ex != null) {
if (ex instanceof SystemException) {
message.setContent(Exception.class, new Fault(ex));
message.setSystemException((SystemException) ex);
return;
}
if (ex instanceof UnknownUserException) {
UnknownUserException userEx = (UnknownUserException) ex;
Any except = userEx.except;
RaisesType raises = exceptions.get(except.type());
if (raises == null) {
throw new CorbaBindingException("Couldn't find the exception type code to unmarshall");
}
QName elName = new QName("", raises.getException().getLocalPart());
CorbaObjectHandler handler = CorbaHandlerUtils.initializeObjectHandler(orb, elName, raises.getException(), typeMap, service);
CorbaStreamable exStreamable = message.createStreamableObject(handler, elName);
exStreamable._read(except.create_input_stream());
message.setStreamableException(exStreamable);
message.setContent(Exception.class, new Fault(userEx));
} else {
message.setContent(Exception.class, new Fault(ex));
}
}
}
use of org.omg.CORBA.TypeCode in project cxf by apache.
the class SystemExceptionHelper method _type.
public TypeCode _type() {
if (typeCode == null) {
ORB orb = ORB.init();
StructMember[] smBuf = new StructMember[2];
TypeCode minortc = orb.get_primitive_tc(TCKind.tk_long);
smBuf[0] = new StructMember("minor", minortc, null);
String[] csLabels = { "COMPLETED_YES", "COMPLETED_NO", "COMPLETED_MAYBE" };
TypeCode completedtc = orb.create_enum_tc("IDL:omg.org/CORBA/CompletionStatus:1.0", "CompletionStatus", csLabels);
smBuf[1] = new StructMember("completed", completedtc, null);
String id;
String name;
if (value == null) {
name = "SystemException";
id = "IDL:omg.org/CORBA/SystemException:1.0";
} else {
String className = value.getClass().getName();
name = className.substring(className.lastIndexOf('.') + 1);
id = "IDL:omg.org/CORBA/" + name + ":1.0";
}
typeCode = orb.create_exception_tc(id, name, smBuf);
}
return typeCode;
}
Aggregations