Java Code Examples for org.apache.cxf.service.model.BindingOperationInfo

The following examples show how to use org.apache.cxf.service.model.BindingOperationInfo. These examples are extracted from open source projects. 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 Project: cxf   Source File: PolicyAttachmentTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testAppliesToOperation() {
    BindingOperationInfo boi1 = control.createMock(BindingOperationInfo.class);
    BindingOperationInfo boi2 = control.createMock(BindingOperationInfo.class);
    DomainExpression de = control.createMock(DomainExpression.class);
    Collection<DomainExpression> des = Collections.singletonList(de);
    PolicyAttachment pa = new PolicyAttachment();
    pa.setDomainExpressions(des);

    EasyMock.expect(de.appliesTo(boi1)).andReturn(false);
    EasyMock.expect(de.appliesTo(boi2)).andReturn(true);
    control.replay();
    assertFalse(pa.appliesTo(boi1));
    assertTrue(pa.appliesTo(boi2));
    control.verify();
}
 
Example 2
Source Project: syndesis   Source File: SoapApiModelParser.java    License: Apache License 2.0 6 votes vote down vote up
private static ConnectorAction parseConnectorAction(final BindingOperationInfo bindingOperationInfo, final Map<String, Integer> idMap,
                                                    final String connectorId) throws ParserException {
    final OperationInfo operationInfo = bindingOperationInfo.getOperationInfo();
    final String description = getDescription(operationInfo,
            o -> "Invokes the operation " + getOperationName(bindingOperationInfo));
    final QName name = bindingOperationInfo.getName();

    final ConnectorAction.Builder builder = new ConnectorAction.Builder()
            .name(name.getLocalPart())
            .description(description)
            .id(getActionId(connectorId, name.getLocalPart(), idMap))
            .descriptor(new ConnectorDescriptor.Builder()
                .connectorId(connectorId)
                .putConfiguredProperty(DEFAULT_OPERATION_NAME_PROPERTY, name.getLocalPart())
                .putConfiguredProperty(DEFAULT_OPERATION_NAMESPACE_PROPERTY, name.getNamespaceURI())
                .putConfiguredProperty(DATA_FORMAT_PROPERTY, PAYLOAD_FORMAT)
                .inputDataShape(getDataShape(bindingOperationInfo.getInput()))
                .outputDataShape(getDataShape(bindingOperationInfo.getOutput()))
                // TODO handle SOAP faults
                .build())
            .pattern(Action.Pattern.To);
    return builder.build();
}
 
Example 3
Source Project: attic-stratos   Source File: StratosAuthorizingHandler.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Here we are getting the target invocation method. The method get set as a
 * properties in the
 * message by the
 * {@link org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor}
 *
 * @param message incoming message
 * @return
 */
protected Method getTargetMethod(Message message) {
    BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
    if (bop != null) {
        MethodDispatcher md =
                (MethodDispatcher) message.getExchange().get(Service.class)
                        .get(MethodDispatcher.class.getName());
        return md.getMethod(bop);
    }
    Method method = (Method) message.get("org.apache.cxf.resource.method");
    if (method != null) {
        return method;
    }
    log.error("The requested resource is not found. Please check the resource path etc..");
    throw new AccessDeniedException("Method is not available : Unauthorized");
}
 
Example 4
protected Method getTargetMethod(Message m) {
    // Used the SOAP
    BindingOperationInfo bop = m.getExchange().get(BindingOperationInfo.class);
    if (bop != null) {
        MethodDispatcher md = (MethodDispatcher)
                m.getExchange().get(Service.class).get(MethodDispatcher.class.getName());
        return md.getMethod(bop);
    }
    // Used for JAX-RS
    // This doesn't work for JAX-RS sub-resources as the lookup is only done on the original method, not the
    // sub-resource
    Method method = (Method) m.get("org.apache.cxf.resource.method");
    if (method != null) {
        return method;
    }
    throw new AccessDeniedException("Method is not available : Unauthorized");
}
 
Example 5
@Before
public void setUp() {
    exchange = mock(Exchange.class);

    BindingOperationInfo boi = mock(BindingOperationInfo.class);
    when(exchange.getBindingOperationInfo()).thenReturn(boi);

    OperationInfo oi = mock(OperationInfo.class);
    when(boi.getOperationInfo()).thenReturn(oi);

    testMetricRegistry = new MetricRegistry();
    mockMetricRegistry = mock(MetricRegistry.class);

    invokerBuilder = new InstrumentedInvokerFactory(mockMetricRegistry);
    instrumentedService = new InstrumentedService();
}
 
Example 6
Source Project: cxf   Source File: JAXRSClientMetricsTest.java    License: Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
    endpointContext = Mockito.mock(MetricsContext.class);
    operationContext = Mockito.mock(MetricsContext.class);
    resourceContext = Mockito.mock(MetricsContext.class);

    provider = new MetricsProvider() {
        public MetricsContext createEndpointContext(Endpoint endpoint, boolean asClient, String cid) {
            return endpointContext;
        }

        public MetricsContext createOperationContext(Endpoint endpoint, BindingOperationInfo boi, 
                boolean asClient, String cid) {
            return operationContext;
        }

        public MetricsContext createResourceContext(Endpoint endpoint, String resourceName, 
                boolean asClient, String cid) {
            return resourceContext;
        }
    };
}
 
Example 7
Source Project: cxf   Source File: FaultOutInterceptor.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Find the correct Fault part for a particular exception.
 *
 * @param op
 * @param class1
 */
public FaultInfo getFaultForClass(BindingOperationInfo op, Class<?> class1) {
    FaultInfo selectedFaultInfo = null;
    Class<?> selectedFaultInfoClass = null;
    for (BindingFaultInfo bfi : op.getFaults()) {

        FaultInfo faultInfo = bfi.getFaultInfo();
        Class<?> c = (Class<?>)faultInfo.getProperty(Class.class.getName());
        if (c != null && c.isAssignableFrom(class1) && (selectedFaultInfo == null
            || (selectedFaultInfoClass != null && selectedFaultInfoClass.isAssignableFrom(c)))) {
            selectedFaultInfo = faultInfo;
            selectedFaultInfoClass = c;
        }
    }
    return selectedFaultInfo;
}
 
Example 8
Source Project: cxf   Source File: ServiceProcessor.java    License: Apache License 2.0 6 votes vote down vote up
private void processBindings(JavaModel model) {
    for (BindingInfo binding : service.getBindings()) {
        bindingType = getBindingType(binding);

        if (bindingType == null) {
            org.apache.cxf.common.i18n.Message msg =
                new org.apache.cxf.common.i18n.Message("BINDING_SPECIFY_ONE_PROTOCOL",
                                                       LOG,
                                                       binding.getName());
            throw new ToolException(msg);
        }

        Collection<BindingOperationInfo> operations = binding.getOperations();
        for (BindingOperationInfo bop : operations) {
            processOperation(model, bop, binding);
        }
    }
}
 
Example 9
Source Project: cxf   Source File: PhaseInterceptorChain.java    License: Apache License 2.0 6 votes vote down vote up
private String getServiceInfo(Message message) {
    StringBuilder description = new StringBuilder();
    if (message.getExchange() != null) {
        Exchange exchange = message.getExchange();
        Service service = exchange.getService();
        if (service != null) {
            description.append('\'');
            description.append(service.getName());
            BindingOperationInfo boi = exchange.getBindingOperationInfo();
            OperationInfo opInfo = boi != null ? boi.getOperationInfo() : null;
            if (opInfo != null) {
                description.append('#').append(opInfo.getName());
            }
            description.append("\' ");
        }
    }
    return description.toString();
}
 
Example 10
Source Project: cxf   Source File: ServiceWSDLBuilder.java    License: Apache License 2.0 6 votes vote down vote up
protected void buildBindingOperation(Definition def, Binding binding,
                                   Collection<BindingOperationInfo> bindingOperationInfos) {
    BindingOperation bindingOperation = null;
    for (BindingOperationInfo bindingOperationInfo : bindingOperationInfos) {
        bindingOperation = def.createBindingOperation();
        addDocumentation(bindingOperation, bindingOperationInfo.getDocumentation());
        bindingOperation.setName(bindingOperationInfo.getName().getLocalPart());
        for (Operation operation
                : CastUtils.cast(binding.getPortType().getOperations(), Operation.class)) {
            if (operation.getName().equals(bindingOperation.getName())) {
                bindingOperation.setOperation(operation);
                break;
            }
        }
        buildBindingInput(def, bindingOperation, bindingOperationInfo.getInput());
        buildBindingOutput(def, bindingOperation, bindingOperationInfo.getOutput());
        buildBindingFault(def, bindingOperation, bindingOperationInfo.getFaults());
        addExtensibilityAttributes(def, bindingOperation, bindingOperationInfo.getExtensionAttributes());
        addExtensibilityElements(def, bindingOperation, getWSDL11Extensors(bindingOperationInfo));
        binding.addBindingOperation(bindingOperation);
    }
}
 
Example 11
Source Project: cxf   Source File: RPCOutInterceptor.java    License: Apache License 2.0 6 votes vote down vote up
protected String addOperationNode(NSStack nsStack, Message message,
                                  XMLStreamWriter xmlWriter,
                                  boolean output,
                                  BindingOperationInfo boi)
    throws XMLStreamException {
    String ns = boi.getName().getNamespaceURI();
    SoapBody body = null;
    if (output) {
        body = boi.getOutput().getExtensor(SoapBody.class);
    } else {
        body = boi.getInput().getExtensor(SoapBody.class);
    }
    if (body != null) {
        final String nsUri = body.getNamespaceURI(); //do it once, as it might internally use reflection...
        if (!StringUtils.isEmpty(nsUri)) {
            ns = nsUri;
        }
    }

    nsStack.add(ns);
    String prefix = nsStack.getPrefix(ns);
    String name = output ? boi.getName().getLocalPart() + "Response" : boi.getName().getLocalPart();
    StaxUtils.writeStartElement(xmlWriter, prefix, name, ns);
    return ns;
}
 
Example 12
Source Project: cxf   Source File: DispatchImpl.java    License: Apache License 2.0 6 votes vote down vote up
private void addInvokeOperation(QName operationName, boolean oneWay) {
    ServiceInfo info = client.getEndpoint().getEndpointInfo().getService();

    OperationInfo invokeOpInfo = info.getInterface()
                   .getOperation(oneWay ? INVOKE_ONEWAY_QNAME : INVOKE_QNAME);

    OperationInfo opInfo = info.getInterface().addOperation(operationName);
    opInfo.setInput(invokeOpInfo.getInputName(), invokeOpInfo.getInput());

    if (!oneWay) {
        opInfo.setOutput(invokeOpInfo.getOutputName(), invokeOpInfo.getOutput());
    }

    for (BindingInfo bind : client.getEndpoint().getEndpointInfo().getService().getBindings()) {
        BindingOperationInfo bo = new BindingOperationInfo(bind, opInfo);
        bind.addOperation(bo);
    }
}
 
Example 13
Source Project: cxf   Source File: SimpleMethodDispatcher.java    License: Apache License 2.0 6 votes vote down vote up
public void bind(OperationInfo o, Method... methods) {
    Method primary = methods[0];
    for (Method m : methods) {
        methodToOp.put(m, o);

        Map<BindingInfo, BindingOperationInfo> biToBop
            = new ConcurrentHashMap<>(4, 0.75f, 2);
        infoMap.put(m, biToBop);
    }

    opToMethod.put(o, primary);

    if (o.isUnwrappedCapable()) {
        opToMethod.put(o.getUnwrappedOperation(), primary);
    }
}
 
Example 14
Source Project: cxf   Source File: SOAPLoggingTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testSoap() {
    DefaultLogEventMapper mapper = new DefaultLogEventMapper();
    Message message = new MessageImpl();
    ExchangeImpl exchange = new ExchangeImpl();
    ServiceInfo service = new ServiceInfo();
    BindingInfo info = new BindingInfo(service, "bindingId");
    SoapBinding value = new SoapBinding(info);
    exchange.put(Binding.class, value);
    OperationInfo opInfo = new OperationInfo();
    opInfo.setName(new QName("http://my", "Operation"));
    BindingOperationInfo boi = new BindingOperationInfo(info, opInfo);
    exchange.put(BindingOperationInfo.class, boi);
    message.setExchange(exchange);
    LogEvent event = mapper.map(message);
    Assert.assertEquals("{http://my}Operation", event.getOperationName());
}
 
Example 15
Source Project: cxf   Source File: ServiceModelUtilsTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testGetOperationInputPartNamesWrapped() throws Exception {
    getService(getClass().getResource("/wsdl/hello_world.wsdl"),
               GreeterImpl.class,
               new QName("http://apache.org/hello_world_soap_http", "SoapPort"));

    BindingOperationInfo operation = ServiceModelUtil.getOperation(message.getExchange(), "greetMe");
    assertNotNull(operation);
    List<String> names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
    assertNotNull(names);
    assertEquals(1, names.size());
    assertEquals("requestType", names.get(0));

    operation = ServiceModelUtil.getOperation(message.getExchange(), "sayHi");
    assertNotNull(operation);
    names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
    assertNotNull(names);
    assertEquals(0, names.size());
}
 
Example 16
Source Project: cxf   Source File: ServiceModelUtilsTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testGetOperationInputPartNamesBare() throws Exception {
    getService(getClass().getResource("/wsdl/hello_world_xml_bare.wsdl"),
               org.apache.hello_world_xml_http.bare.GreeterImpl.class,
               new QName("http://apache.org/hello_world_xml_http/bare", "XMLPort"));
    BindingOperationInfo operation = ServiceModelUtil.getOperation(message.getExchange(), "greetMe");
    assertNotNull(operation);
    List<String> names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
    assertNotNull(names);
    assertEquals(1, names.size());
    assertEquals("requestType", names.get(0));

    operation = ServiceModelUtil.getOperation(message.getExchange(), "sayHi");
    assertNotNull(operation);
    names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
    assertNotNull(names);
    assertEquals(0, names.size());
}
 
Example 17
Source Project: cxf   Source File: DispatchTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testFindOperationWithSource() throws Exception {
    ServiceImpl service =
        new ServiceImpl(getBus(), getClass().getResource("/wsdl/hello_world.wsdl"), SERVICE_NAME, null);

    Dispatch<Source> disp = service.createDispatch(PORT_NAME, Source.class, Service.Mode.MESSAGE);
    disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS);
    disp.getRequestContext().put("find.dispatch.operation", Boolean.TRUE);

    d.setMessageObserver(new MessageReplayObserver("/org/apache/cxf/jaxws/sayHiResponse.xml"));

    BindingOperationVerifier bov = new BindingOperationVerifier();
    ((DispatchImpl<?>)disp).getClient().getOutInterceptors().add(bov);

    Document doc = StaxUtils.read(getResourceAsStream("/org/apache/cxf/jaxws/sayHi2.xml"));
    DOMSource source = new DOMSource(doc);
    Source res = disp.invoke(source);
    assertNotNull(res);

    BindingOperationInfo boi = bov.getBindingOperationInfo();
    assertNotNull(boi);

    assertEquals(new QName("http://apache.org/hello_world_soap_http", "sayHi"), boi.getName());
}
 
Example 18
Source Project: cxf   Source File: SoapBindingFactory.java    License: Apache License 2.0 6 votes vote down vote up
private void setupHeaders(BindingOperationInfo op,
                          BindingMessageInfo bMsg,
                          BindingMessageInfo unwrappedBMsg,
                          MessageInfo msg,
                          SoapBindingConfiguration config) {
    List<MessagePartInfo> parts = new ArrayList<>();
    for (MessagePartInfo part : msg.getMessageParts()) {
        if (config.isHeader(op, part)) {
            SoapHeaderInfo headerInfo = new SoapHeaderInfo();
            headerInfo.setPart(part);
            headerInfo.setUse(config.getUse());

            bMsg.addExtensor(headerInfo);
        } else {
            parts.add(part);
        }
    }
    unwrappedBMsg.setMessageParts(parts);
}
 
Example 19
Source Project: cxf   Source File: ClientImpl.java    License: Apache License 2.0 5 votes vote down vote up
public void invokeWrapped(ClientCallback callback,
                          QName operationName,
                          Object... params)
    throws Exception {
    BindingOperationInfo op = getEndpoint().getEndpointInfo().getBinding().getOperation(operationName);
    if (op == null) {
        throw new UncheckedException(
            new org.apache.cxf.common.i18n.Message("NO_OPERATION", LOG, operationName));
    }
    invoke(callback, op, params);
}
 
Example 20
Source Project: cxf   Source File: PolicyEngineTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testSetEffectiveClientResponsePolicy() throws Exception {
    engine = new PolicyEngineImpl();
    EndpointInfo ei = createMockEndpointInfo();
    BindingOperationInfo boi = createMockBindingOperationInfo();
    EffectivePolicy epi = control.createMock(EffectivePolicy.class);
    control.replay();
    engine.setEffectiveClientResponsePolicy(ei, boi, epi);
    assertSame(epi, engine.getEffectiveClientResponsePolicy(ei, boi, msg));
    control.verify();
}
 
Example 21
Source Project: cxf   Source File: PolicyEngineTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testSetEffectiveServerResponsePolicy() throws Exception {
    engine = new PolicyEngineImpl();
    EndpointInfo ei = createMockEndpointInfo();
    BindingOperationInfo boi = createMockBindingOperationInfo();
    EffectivePolicy effectivePolicy = control.createMock(EffectivePolicy.class);
    control.replay();
    engine.setEffectiveServerResponsePolicy(ei, boi, effectivePolicy);
    assertSame(effectivePolicy,
               engine.getEffectiveServerResponsePolicy(ei, boi, (Destination)null, null, msg));
    control.verify();
}
 
Example 22
Source Project: cxf   Source File: PolicyEngineTest.java    License: Apache License 2.0 5 votes vote down vote up
private BindingOperationInfo createMockBindingOperationInfo() throws Exception {
    OperationInfo info = new OperationInfo();
    return new BindingOperationInfo(null, info) {
        public boolean isUnwrapped() {
            return false;
        }
    };
}
 
Example 23
Source Project: cxf   Source File: ColocOutInterceptorTest.java    License: Apache License 2.0 5 votes vote down vote up
private void verifyIsColocatedWithDifferentOperation() {
    //Funtion Param
    Server s1 = control.createMock(Server.class);
    List<Server> list = new ArrayList<>();
    list.add(s1);
    Endpoint sep = control.createMock(Endpoint.class);
    BindingOperationInfo sboi = control.createMock(BindingOperationInfo.class);
    //Local var
    Service ses = control.createMock(Service.class);
    ServiceInfo ssi = control.createMock(ServiceInfo.class);
    EndpointInfo sei = control.createMock(EndpointInfo.class);
    TestBindingInfo rbi = new TestBindingInfo(ssi, "testBinding");
    Endpoint rep = control.createMock(Endpoint.class);
    Service res = control.createMock(Service.class);
    EndpointInfo rei = control.createMock(EndpointInfo.class);

    EasyMock.expect(sep.getService()).andReturn(ses);
    EasyMock.expect(sep.getEndpointInfo()).andReturn(sei);
    EasyMock.expect(s1.getEndpoint()).andReturn(rep);
    EasyMock.expect(rep.getService()).andReturn(res);
    EasyMock.expect(rep.getEndpointInfo()).andReturn(rei);
    EasyMock.expect(ses.getName()).andReturn(new QName("A", "B"));
    EasyMock.expect(res.getName()).andReturn(new QName("A", "B"));
    EasyMock.expect(rei.getName()).andReturn(new QName("C", "D"));
    EasyMock.expect(sei.getName()).andReturn(new QName("C", "D"));
    EasyMock.expect(rei.getBinding()).andReturn(rbi);
    EasyMock.expect(sboi.getName()).andReturn(new QName("E", "F"));
    //Causes ConcurrentModification intermittently
    //QName op = new QName("E", "F");
    //EasyMock.expect(rbi.getOperation(op).andReturn(null);

    control.replay();
    Server val = colocOut.isColocated(list, sep, sboi);
    assertEquals("Is not a colocated call",
                 null,
                 val);
    assertEquals("BindingOperation.getOperation was not called",
                 1, rbi.getOpCount());
    control.reset();
}
 
Example 24
Source Project: cxf   Source File: RPCInInterceptorTest.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    super.setUp();
    ServiceInfo si = getMockedServiceModel(this.getClass()
                                           .getResource("/wsdl_soap/hello_world_rpc_lit.wsdl")
            .toString());
    BindingInfo bi = si.getBinding(new QName(TNS, "Greeter_SOAPBinding_RPCLit"));
    BindingOperationInfo boi = bi.getOperation(new QName(TNS, OPNAME));
    boi.getOperationInfo().getInput().getMessagePartByIndex(0).setTypeClass(MyComplexStruct.class);
    boi.getOperationInfo().getInput().getMessagePartByIndex(0).setIndex(1);
    boi.getOperationInfo().getOutput().getMessagePartByIndex(0).setTypeClass(MyComplexStruct.class);
    boi.getOperationInfo().getOutput().getMessagePartByIndex(0).setIndex(0);
    soapMessage.getExchange().put(BindingOperationInfo.class, boi);

    control.reset();
    Service service = control.createMock(Service.class);
    JAXBDataBinding dataBinding = new JAXBDataBinding(MyComplexStruct.class);
    service.getDataBinding();
    EasyMock.expectLastCall().andReturn(dataBinding).anyTimes();
    service.getServiceInfos();
    List<ServiceInfo> list = Arrays.asList(si);
    EasyMock.expectLastCall().andReturn(list).anyTimes();
    EasyMock.expect(service.isEmpty()).andReturn(true).anyTimes();

    soapMessage.getExchange().put(Service.class, service);
    soapMessage.getExchange().put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.FALSE);
    control.replay();
}
 
Example 25
Source Project: attic-stratos   Source File: StratosAuthorizingHandler.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Here we are getting the target invocation method. The method get set as a property in the
 * message by the {@link org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor}
 *
 * @param message incoming message
 * @return
 */
protected Method getTargetMethod(Message message) {
    BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
    if (bop != null) {
        MethodDispatcher md = (MethodDispatcher)
                message.getExchange().get(Service.class).get(MethodDispatcher.class.getName());
        return md.getMethod(bop);
    }
    Method method = (Method) message.get("org.apache.cxf.resource.method");
    if (method != null) {
        return method;
    }
    log.error("The requested resource is not found. Please check the resource path, etc");
    throw new AccessDeniedException("Method is not available: Unauthorized");
}
 
Example 26
Source Project: cxf   Source File: CorbaDSIServant.java    License: Apache License 2.0 5 votes vote down vote up
public void invoke(ServerRequest request) throws CorbaBindingException {
    String opName = request.operation();
    QName requestOperation = operationMap.get(opName);

    MessageImpl msgImpl = new MessageImpl();
    msgImpl.setDestination(getDestination());
    Exchange exg = new ExchangeImpl();
    exg.put(String.class, requestOperation.getLocalPart());
    exg.put(ORB.class, getOrb());
    exg.put(ServerRequest.class, request);
    msgImpl.setExchange(exg);
    CorbaMessage msg = new CorbaMessage(msgImpl);
    msg.setCorbaTypeMap(typeMap);

    // If there's no output message part in our operation then it's a oneway op
    BindingMessageInfo bindingMsgOutputInfo = null;
    BindingOperationInfo bindingOpInfo = null;
    try {
        bindingOpInfo = this.destination.getEndPointInfo().getBinding().getOperation(requestOperation);
    } catch (Exception ex) {
        throw new CorbaBindingException("Invalid Request. Operation unknown: " + opName);
    }
    if (bindingOpInfo != null) {
        bindingMsgOutputInfo = bindingOpInfo.getOutput();
        if (bindingMsgOutputInfo == null) {
            exg.setOneWay(true);
        }
    }

    // invokes the interceptors
    getObserver().onMessage(msg);
}
 
Example 27
Source Project: jea   Source File: SoapClient.java    License: Apache License 2.0 5 votes vote down vote up
private QName getQName(Endpoint endpoint, String methodName){
       BindingInfo bindingInfo = endpoint.getEndpointInfo().getBinding();
       QName opName = new QName(endpoint.getService().getName().getNamespaceURI(), methodName);
       
       if (bindingInfo.getOperation(opName) == null) {
           for (BindingOperationInfo operationInfo : bindingInfo.getOperations()) {
               if (methodName.equals(operationInfo.getName().getLocalPart())) {
                   opName = operationInfo.getName();
                   break;
               }
           }
       }
       return opName;
}
 
Example 28
Source Project: cxf   Source File: XMLMessageOutInterceptorTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testBareOutSingle() throws Exception {

    MyComplexStructType myComplexStruct = new MyComplexStructType();
    myComplexStruct.setElem1("elem1");
    myComplexStruct.setElem2("elem2");
    myComplexStruct.setElem3(45);
    params.add(myComplexStruct);

    common("/wsdl/hello_world_xml_bare.wsdl", new QName(bareNs, "XMLPort"),
                    MyComplexStructType.class);

    BindingInfo bi = super.serviceInfo.getBinding(new QName(bareNs, "Greeter_XMLBinding"));
    BindingOperationInfo boi = bi.getOperation(new QName(bareNs, "sendReceiveData"));
    xmlMessage.getExchange().put(BindingOperationInfo.class, boi);

    out.handleMessage(xmlMessage);

    XMLStreamReader reader = getXMLReader();
    DepthXMLStreamReader dxr = new DepthXMLStreamReader(reader);
    StaxUtils.nextEvent(dxr);
    StaxUtils.toNextElement(dxr);

    assertEquals(bareMyComplexStructTypeQName.getLocalPart(), dxr.getLocalName());
    StaxUtils.toNextElement(dxr);
    StaxUtils.toNextText(dxr);
    assertEquals(myComplexStruct.getElem1(), dxr.getText());
}
 
Example 29
Source Project: cxf   Source File: ClientImpl.java    License: Apache License 2.0 5 votes vote down vote up
public void invoke(ClientCallback callback,
                   BindingOperationInfo oi,
                   Object[] params,
                   Map<String, Object> context,
                   Exchange exchange) throws Exception {
    doInvoke(callback, oi, params, context, exchange);
}
 
Example 30
Source Project: cxf   Source File: SimpleMethodDispatcher.java    License: Apache License 2.0 5 votes vote down vote up
private BindingOperationInfo getRealOperation(OperationInfo o, BindingOperationInfo bop) {
    BindingOperationInfo unwrappedOp = bop.getUnwrappedOperation();
    if (unwrappedOp != null
        && unwrappedOp.getOperationInfo().equals(o.getUnwrappedOperation())) {
        return unwrappedOp;
    }
    return bop;
}