Search in sources :

Example 1 with BindingInput

use of javax.wsdl.BindingInput in project tdi-studio-se by Talend.

the class ComponentBuilder method buildOperation.

private OperationInfo buildOperation(OperationInfo operationInfo, BindingOperation bindingOper) {
    Operation oper = bindingOper.getOperation();
    operationInfo.setTargetMethodName(oper.getName());
    Vector operElems = findExtensibilityElement(bindingOper.getExtensibilityElements(), "operation");
    ExtensibilityElement operElem = (ExtensibilityElement) operElems.elementAt(0);
    if (operElem != null && operElem instanceof SOAPOperation) {
        SOAPOperation soapOperation = (SOAPOperation) operElem;
        operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
    } else if (operElem != null && operElem instanceof SOAP12Operation) {
        SOAP12Operation soapOperation = (SOAP12Operation) operElem;
        operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
    }
    BindingInput bindingInput = bindingOper.getBindingInput();
    BindingOutput bindingOutput = bindingOper.getBindingOutput();
    Vector bodyElems = findExtensibilityElement(bindingInput.getExtensibilityElements(), "body");
    ExtensibilityElement bodyElem = (ExtensibilityElement) bodyElems.elementAt(0);
    if (bodyElem != null && bodyElem instanceof SOAPBody) {
        SOAPBody soapBody = (SOAPBody) bodyElem;
        List styles = soapBody.getEncodingStyles();
        String encodingStyle = null;
        if (styles != null) {
            encodingStyle = styles.get(0).toString();
        }
        if (encodingStyle == null) {
            encodingStyle = DEFAULT_SOAP_ENCODING_STYLE;
        }
        operationInfo.setEncodingStyle(encodingStyle.toString());
        operationInfo.setTargetObjectURI(soapBody.getNamespaceURI());
    } else if (bodyElem != null && bodyElem instanceof SOAP12Body) {
        SOAP12Body soapBody = (SOAP12Body) bodyElem;
        String encodingStyle = null;
        if (soapBody.getEncodingStyle() != null) {
            encodingStyle = soapBody.getEncodingStyle().toString();
        }
        if (encodingStyle == null) {
            encodingStyle = DEFAULT_SOAP_ENCODING_STYLE;
        }
        operationInfo.setEncodingStyle(encodingStyle.toString());
        operationInfo.setTargetObjectURI(soapBody.getNamespaceURI());
    }
    Input inDef = oper.getInput();
    if (inDef != null) {
        Message inMsg = inDef.getMessage();
        if (inMsg != null) {
            operationInfo.setInputMessageName(inMsg.getQName().getLocalPart());
            getParameterFromMessage(operationInfo, inMsg, 1);
            operationInfo.setInmessage(inMsg);
        }
    }
    Output outDef = oper.getOutput();
    if (outDef != null) {
        Message outMsg = outDef.getMessage();
        if (outMsg != null) {
            operationInfo.setOutputMessageName(outMsg.getQName().getLocalPart());
            getParameterFromMessage(operationInfo, outMsg, 2);
            operationInfo.setOutmessage(outMsg);
        }
    }
    return operationInfo;
}
Also used : SOAPOperation(javax.wsdl.extensions.soap.SOAPOperation) BindingOutput(javax.wsdl.BindingOutput) SOAP12Body(javax.wsdl.extensions.soap12.SOAP12Body) Message(javax.wsdl.Message) Operation(javax.wsdl.Operation) SOAP12Operation(javax.wsdl.extensions.soap12.SOAP12Operation) BindingOperation(javax.wsdl.BindingOperation) SOAPOperation(javax.wsdl.extensions.soap.SOAPOperation) BindingInput(javax.wsdl.BindingInput) UnknownExtensibilityElement(javax.wsdl.extensions.UnknownExtensibilityElement) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) SOAPBody(javax.wsdl.extensions.soap.SOAPBody) Input(javax.wsdl.Input) BindingInput(javax.wsdl.BindingInput) SOAP12Operation(javax.wsdl.extensions.soap12.SOAP12Operation) BindingOutput(javax.wsdl.BindingOutput) Output(javax.wsdl.Output) List(java.util.List) ArrayList(java.util.ArrayList) Vector(java.util.Vector)

Example 2 with BindingInput

use of javax.wsdl.BindingInput in project carbon-business-process by wso2.

the class SOAPUtils method createSOAPRequest.

/**
 * Create SOAP Request message from request submitted by ODE engine.
 *
 * @param bpelMessageContext        DTO containing details about current message flow
 * @param odePartnerMessageExchange ODE PartnerRoleMessageExchange containing information about
 *                                  current external service invocation.
 * @throws AxisFault If an error occurred while creating the SOAP request
 */
public static void createSOAPRequest(final BPELMessageContext bpelMessageContext, final PartnerRoleMessageExchange odePartnerMessageExchange) throws AxisFault {
    checkForNullValuesInRequest(bpelMessageContext, odePartnerMessageExchange);
    BindingOperation bindingOp = getBindingOperation(bpelMessageContext, odePartnerMessageExchange.getOperationName());
    BindingInput bindingInput = getBindingInput(bindingOp);
    SOAPEnvelope soapEnvelope = bpelMessageContext.getInMessageContext().getEnvelope();
    if (soapEnvelope == null) {
        soapEnvelope = bpelMessageContext.getSoapFactoryForCurrentMessageFlow().getDefaultEnvelope();
        bpelMessageContext.getInMessageContext().setEnvelope(soapEnvelope);
    }
    populateSOAPHeaders(odePartnerMessageExchange.getRequest(), soapEnvelope, bpelMessageContext.getSoapFactoryForCurrentMessageFlow(), getSOAPHeaders(bindingInput), odePartnerMessageExchange.getOperation());
    populateSOAPBody(soapEnvelope, bindingInput, bpelMessageContext.isSoap12(), bpelMessageContext.getSoapFactoryForCurrentMessageFlow(), odePartnerMessageExchange.getOperation(), odePartnerMessageExchange.getOperation().getInput().getMessage(), odePartnerMessageExchange.getRequest(), bpelMessageContext.isRPCStyleOperation(), true);
}
Also used : BindingOperation(javax.wsdl.BindingOperation) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope) BindingInput(javax.wsdl.BindingInput)

Example 3 with BindingInput

use of javax.wsdl.BindingInput in project cxf by apache.

the class SOAPBindingUtil method getBindingInputSOAPHeaders.

public static List<SoapHeader> getBindingInputSOAPHeaders(BindingOperation bop) {
    List<SoapHeader> headers = new ArrayList<>();
    BindingInput bindingInput = bop.getBindingInput();
    if (bindingInput != null) {
        for (Object obj : bindingInput.getExtensibilityElements()) {
            if (isSOAPHeader(obj)) {
                headers.add(getProxy(SoapHeader.class, obj));
            }
        }
    }
    return headers;
}
Also used : ArrayList(java.util.ArrayList) SoapHeader(org.apache.cxf.binding.soap.wsdl.extensions.SoapHeader) BindingInput(javax.wsdl.BindingInput)

Example 4 with BindingInput

use of javax.wsdl.BindingInput in project cxf by apache.

the class AttributeVisitor method generateCorbaBindingOperation.

private BindingOperation generateCorbaBindingOperation(Binding wsdlBinding, Operation op, OperationType corbaOp) {
    BindingInput bindingInput = definition.createBindingInput();
    bindingInput.setName(op.getInput().getName());
    BindingOutput bindingOutput = definition.createBindingOutput();
    bindingOutput.setName(op.getOutput().getName());
    BindingOperation bindingOperation = definition.createBindingOperation();
    bindingOperation.addExtensibilityElement((ExtensibilityElement) corbaOp);
    bindingOperation.setOperation(op);
    bindingOperation.setName(op.getName());
    bindingOperation.setBindingInput(bindingInput);
    bindingOperation.setBindingOutput(bindingOutput);
    binding.addBindingOperation(bindingOperation);
    return bindingOperation;
}
Also used : BindingOutput(javax.wsdl.BindingOutput) BindingOperation(javax.wsdl.BindingOperation) BindingInput(javax.wsdl.BindingInput)

Example 5 with BindingInput

use of javax.wsdl.BindingInput in project cxf by apache.

the class JAXWSDefinitionBuilderTest method testBuildDefinitionWithXMLBinding.

@Test
public void testBuildDefinitionWithXMLBinding() {
    String qname = "http://apache.org/hello_world_xml_http/bare";
    String wsdlUrl = getClass().getResource("resources/hello_world_xml_bare.wsdl").toString();
    JAXWSDefinitionBuilder builder = new JAXWSDefinitionBuilder();
    builder.setBus(BusFactory.getDefaultBus());
    builder.setContext(env);
    Definition def = builder.build(wsdlUrl);
    assertNotNull(def);
    Map<?, ?> services = def.getServices();
    assertNotNull(services);
    assertEquals(1, services.size());
    Service service = (Service) services.get(new QName(qname, "XMLService"));
    assertNotNull(service);
    Map<?, ?> ports = service.getPorts();
    assertNotNull(ports);
    assertEquals(1, ports.size());
    Port port = service.getPort("XMLPort");
    assertNotNull(port);
    assertEquals(1, port.getExtensibilityElements().size());
    Object obj = port.getExtensibilityElements().get(0);
    if (obj instanceof JAXBExtensibilityElement) {
        obj = ((JAXBExtensibilityElement) obj).getValue();
    }
    assertTrue(obj.getClass().getName() + " is not an AddressType", obj instanceof AddressType);
    Binding binding = port.getBinding();
    assertNotNull(binding);
    assertEquals(new QName(qname, "Greeter_XMLBinding"), binding.getQName());
    BindingOperation operation = binding.getBindingOperation("sayHi", null, null);
    assertNotNull(operation);
    BindingInput input = operation.getBindingInput();
    assertNotNull(input);
    assertEquals(1, input.getExtensibilityElements().size());
    obj = input.getExtensibilityElements().get(0);
    if (obj instanceof JAXBExtensibilityElement) {
        obj = ((JAXBExtensibilityElement) obj).getValue();
    }
    assertTrue(obj.getClass().getName() + " is not an XMLBindingMessageFormat", obj instanceof XMLBindingMessageFormat);
}
Also used : Binding(javax.wsdl.Binding) JAXBExtensibilityElement(org.apache.cxf.wsdl.JAXBExtensibilityElement) QName(javax.xml.namespace.QName) Port(javax.wsdl.Port) Definition(javax.wsdl.Definition) Service(javax.wsdl.Service) BindingInput(javax.wsdl.BindingInput) BindingOperation(javax.wsdl.BindingOperation) XMLBindingMessageFormat(org.apache.cxf.bindings.xformat.XMLBindingMessageFormat) AddressType(org.apache.cxf.wsdl.http.AddressType) JAXWSDefinitionBuilder(org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder) Test(org.junit.Test)

Aggregations

BindingInput (javax.wsdl.BindingInput)22 BindingOperation (javax.wsdl.BindingOperation)16 Binding (javax.wsdl.Binding)7 QName (javax.xml.namespace.QName)7 BindingOutput (javax.wsdl.BindingOutput)6 SOAPBinding (javax.wsdl.extensions.soap.SOAPBinding)6 SOAPBody (javax.wsdl.extensions.soap.SOAPBody)6 ToolException (org.apache.cxf.tools.common.ToolException)5 Test (org.junit.Test)5 File (java.io.File)4 Message (javax.wsdl.Message)4 Operation (javax.wsdl.Operation)4 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)4 SOAP12Binding (javax.wsdl.extensions.soap12.SOAP12Binding)4 SoapBinding (org.apache.cxf.binding.soap.wsdl.extensions.SoapBinding)4 SoapBody (org.apache.cxf.binding.soap.wsdl.extensions.SoapBody)4 SoapOperation (org.apache.cxf.binding.soap.wsdl.extensions.SoapOperation)4 ArrayList (java.util.ArrayList)3 Input (javax.wsdl.Input)3 SOAPOperation (javax.wsdl.extensions.soap.SOAPOperation)3