Search in sources :

Example 6 with OperationType

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

the class CorbaConduitTest method testBuildRequest.

@Test
public void testBuildRequest() throws Exception {
    CorbaConduit conduit = setupCorbaConduit(false);
    CorbaMessage message = control.createMock(CorbaMessage.class);
    Exchange exchange = control.createMock(Exchange.class);
    EasyMock.expect(message.getExchange());
    EasyMock.expectLastCall().andReturn(exchange);
    ServiceInfo service = control.createMock(ServiceInfo.class);
    EasyMock.expect(exchange.get(ServiceInfo.class)).andReturn(service);
    List<CorbaTypeMap> list = control.createMock(List.class);
    CorbaTypeMap typeMap = control.createMock(CorbaTypeMap.class);
    EasyMock.expect(service.getExtensors(CorbaTypeMap.class)).andReturn(list);
    OperationType opType = control.createMock(OperationType.class);
    conduit.getArguments(message);
    EasyMock.expectLastCall().andReturn(null);
    conduit.getReturn(message);
    EasyMock.expectLastCall().andReturn(null);
    conduit.getExceptionList(conduit.getOperationExceptions(opType, typeMap), message, opType);
    EasyMock.expectLastCall().andReturn(null);
    conduit.getRequest(message, "Hello", null, null, null);
    EasyMock.expectLastCall();
}
Also used : Exchange(org.apache.cxf.message.Exchange) ServiceInfo(org.apache.cxf.service.model.ServiceInfo) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType) Test(org.junit.Test)

Example 7 with OperationType

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

the class CorbaConduitTest method testBuildExceptionListWithExceptions.

@Test
public void testBuildExceptionListWithExceptions() throws Exception {
    CorbaConduit conduit = setupCorbaConduit(false);
    Message msg = new MessageImpl();
    CorbaMessage message = new CorbaMessage(msg);
    TestUtils testUtils = new TestUtils();
    CorbaDestination destination = testUtils.getExceptionTypesTestDestination();
    EndpointInfo endpointInfo2 = destination.getEndPointInfo();
    QName name = new QName("http://schemas.apache.org/idl/except", "review_data", "");
    BindingOperationInfo bInfo = destination.getBindingInfo().getOperation(name);
    OperationType opType = bInfo.getExtensor(OperationType.class);
    CorbaTypeMap typeMap = null;
    List<TypeMappingType> corbaTypes = endpointInfo2.getService().getDescription().getExtensors(TypeMappingType.class);
    if (corbaTypes != null) {
        typeMap = CorbaUtils.createCorbaTypeMap(corbaTypes);
    }
    ExceptionList exList = conduit.getExceptionList(conduit.getOperationExceptions(opType, typeMap), message, opType);
    assertNotNull("ExceptionList is not null", exList != null);
    assertNotNull("TypeCode is not null", exList.item(0) != null);
    assertEquals("ID should be equal", exList.item(0).id(), "IDL:BadRecord:1.0");
    assertEquals("ID should be equal", exList.item(0).name(), "BadRecord");
    assertEquals("ID should be equal", exList.item(0).member_count(), 2);
    assertEquals("ID should be equal", exList.item(0).member_name(0), "reason");
    assertNotNull("Member type is not null", exList.item(0).member_type(0) != null);
}
Also used : BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) Message(org.apache.cxf.message.Message) QName(javax.xml.namespace.QName) ExceptionList(org.omg.CORBA.ExceptionList) TypeMappingType(org.apache.cxf.binding.corba.wsdl.TypeMappingType) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType) MessageImpl(org.apache.cxf.message.MessageImpl) Test(org.junit.Test)

Example 8 with OperationType

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

the class AttributeVisitor method generateCorbaOperation.

/**
 * Generates a corba:operation in the corba:binding container within a wsdl:binding.
 *
 * Only one (or none) corba parameter and only one (or none) corba return parameter are supported.
 *
 * @param op is the wsdl operation to bind.
 * @param param is the corba parameter, none if null.
 * @param arg is the corba return parameter, none if null.
 * @return the generated corba:operation.
 */
private OperationType generateCorbaOperation(Operation op, ParamType param, ArgType arg) {
    final OperationType operation;
    try {
        operation = (OperationType) extReg.createExtension(BindingOperation.class, CorbaConstants.NE_CORBA_OPERATION);
    } catch (WSDLException ex) {
        throw new RuntimeException(ex);
    }
    operation.setName(op.getName());
    if (param != null) {
        operation.getParam().add(param);
    }
    if (arg != null) {
        operation.setReturn(arg);
    }
    return operation;
}
Also used : WSDLException(javax.wsdl.WSDLException) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType)

Example 9 with OperationType

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

the class AttributeVisitor method generateSetter.

private void generateSetter(AST typeNode, AST nameNode) {
    // generate wrapped doc element in parameter
    XmlSchemaElement inParameters = generateWrappedDocElement(typeNode, SETTER_PREFIX + nameNode.toString(), PARAM_NAME);
    // generate wrapped doc element out parameter
    XmlSchemaElement outParameters = generateWrappedDocElement(null, SETTER_PREFIX + nameNode.toString() + RESULT_POSTFIX, RETURN_PARAM_NAME);
    // generate input message
    Message inMsg = generateMessage(inParameters, SETTER_PREFIX + nameNode.toString());
    // generate output message
    Message outMsg = generateMessage(outParameters, SETTER_PREFIX + nameNode.toString() + RESPONSE_POSTFIX);
    // generate operation
    String name = SETTER_PREFIX + nameNode.toString();
    Operation op = generateOperation(name, inMsg, outMsg);
    // generate corba return param
    ParamType corbaParam = generateCorbaParam(typeNode);
    // generate corba operation
    OperationType corbaOp = generateCorbaOperation(op, corbaParam, null);
    // generate binding
    generateCorbaBindingOperation(binding, op, corbaOp);
}
Also used : Message(javax.wsdl.Message) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) Operation(javax.wsdl.Operation) BindingOperation(javax.wsdl.BindingOperation) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType) ParamType(org.apache.cxf.binding.corba.wsdl.ParamType)

Example 10 with OperationType

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

the class AttributeVisitor method generateGetter.

private void generateGetter(AST typeNode, AST nameNode) {
    // generate wrapped doc element in parameter
    XmlSchemaElement inParameters = generateWrappedDocElement(null, GETTER_PREFIX + nameNode.toString(), PARAM_NAME);
    // generate wrapped doc element out parameter
    XmlSchemaElement outParameters = generateWrappedDocElement(typeNode, GETTER_PREFIX + nameNode.toString() + RESULT_POSTFIX, RETURN_PARAM_NAME);
    // generate input message
    Message inMsg = generateMessage(inParameters, GETTER_PREFIX + nameNode.toString());
    // generate output message
    Message outMsg = generateMessage(outParameters, GETTER_PREFIX + nameNode.toString() + RESPONSE_POSTFIX);
    // generate operation
    String name = GETTER_PREFIX + nameNode.toString();
    Operation op = generateOperation(name, inMsg, outMsg);
    // generate corba return param
    ArgType corbaReturn = generateCorbaReturnParam(typeNode);
    // generate corba operation
    OperationType corbaOp = generateCorbaOperation(op, null, corbaReturn);
    // generate binding
    generateCorbaBindingOperation(binding, op, corbaOp);
}
Also used : ArgType(org.apache.cxf.binding.corba.wsdl.ArgType) Message(javax.wsdl.Message) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) Operation(javax.wsdl.Operation) BindingOperation(javax.wsdl.BindingOperation) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType)

Aggregations

OperationType (org.apache.cxf.binding.corba.wsdl.OperationType)31 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)14 BindingOperation (javax.wsdl.BindingOperation)11 QName (javax.xml.namespace.QName)9 Test (org.junit.Test)9 ParamType (org.apache.cxf.binding.corba.wsdl.ParamType)8 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)8 ArgType (org.apache.cxf.binding.corba.wsdl.ArgType)6 BindingType (org.apache.cxf.binding.corba.wsdl.BindingType)5 Binding (javax.wsdl.Binding)4 Definition (javax.wsdl.Definition)4 CorbaStreamWriter (org.apache.cxf.binding.corba.runtime.CorbaStreamWriter)4 Fixed (org.apache.cxf.binding.corba.wsdl.Fixed)4 Exchange (org.apache.cxf.message.Exchange)4 WSDLToCorbaBinding (org.apache.cxf.tools.corba.processors.wsdl.WSDLToCorbaBinding)4 ArrayList (java.util.ArrayList)3 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)3 RaisesType (org.apache.cxf.binding.corba.wsdl.RaisesType)3 File (java.io.File)2 OutputStream (java.io.OutputStream)2