use of javax.wsdl.Input 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;
}
use of javax.wsdl.Input in project Lucee by lucee.
the class JaxWSClient method toDumpData.
private DumpData toDumpData(BindingOperation bo) {
Map<QName, Message> messages = wsdl.getMessages();
DumpTable table = new DumpTable("#99cc99", "#ccffcc", "#000000");
DumpTable attributes = new DumpTable("#99cc99", "#ccffcc", "#000000");
String returns = "void";
attributes.appendRow(3, new SimpleDumpData("name"), new SimpleDumpData("type"));
Operation op = bo.getOperation();
// attributes
Input in = op.getInput();
Message msg = in.getMessage();
// msg=WSUtil.getMessageByLocalName(messages,bo.getBindingInput().getName());
// print.e(msg.getQName());
List<Part> parts = msg.getOrderedParts(null);
Iterator<Part> it = parts.iterator();
Part p;
QName en;
QName type;
while (it.hasNext()) {
p = it.next();
en = p.getElementName();
if (en != null) {
type = en;
Types types = wsdl.getTypes();
} else
type = p.getTypeName();
attributes.appendRow(0, new SimpleDumpData(en + ":" + p.getName()), new SimpleDumpData(toLuceeType(type)));
}
// return
msg = bo.getOperation().getOutput().getMessage();
msg = wsdl.getMessage(msg.getQName());
parts = msg.getOrderedParts(null);
it = parts.iterator();
while (it.hasNext()) {
p = it.next();
returns = toLuceeType(p.getTypeName());
}
table.appendRow(1, new SimpleDumpData("arguments"), attributes);
table.appendRow(1, new SimpleDumpData("return type"), new SimpleDumpData(returns));
return table;
}
use of javax.wsdl.Input in project carbon-apimgt by wso2.
the class WSDL11ProcessorImpl method getParameters.
/**
* Returns parameters, given http binding operation, verb and content type
*
* @param bindingOperation {@link BindingOperation} object
* @param verb HTTP verb
* @param contentType Content type
* @return parameters, given http binding operation, verb and content type
*/
private List<WSDLOperationParam> getParameters(BindingOperation bindingOperation, String verb, String contentType) {
List<WSDLOperationParam> params = new ArrayList<>();
Operation operation = bindingOperation.getOperation();
// or content type is not provided
if (APIMWSDLUtils.canContainBody(verb) && !APIMWSDLUtils.hasFormDataParams(contentType)) {
WSDLOperationParam param = new WSDLOperationParam();
param.setName("Payload");
param.setParamType(WSDLOperationParam.ParamTypeEnum.BODY);
params.add(param);
if (log.isDebugEnabled()) {
log.debug("Adding default Param for operation:" + operation.getName() + ", contentType: " + contentType);
}
return params;
}
if (operation != null) {
Input input = operation.getInput();
if (input != null) {
Message message = input.getMessage();
if (message != null) {
Map map = message.getParts();
map.forEach((name, partObj) -> {
WSDLOperationParam param = new WSDLOperationParam();
param.setName(name.toString());
if (log.isDebugEnabled()) {
log.debug("Identified param for operation: " + operation.getName() + " param: " + name);
}
if (APIMWSDLUtils.canContainBody(verb)) {
if (log.isDebugEnabled()) {
log.debug("Operation " + operation.getName() + " can contain a body.");
}
// In POST, PUT operations, parameters always in body according to HTTP Binding spec
if (APIMWSDLUtils.hasFormDataParams(contentType)) {
param.setParamType(WSDLOperationParam.ParamTypeEnum.FORM_DATA);
if (log.isDebugEnabled()) {
log.debug("Param " + name + " type was set to formData.");
}
}
// no else block since if content type is not form-data related, there can be only one
// parameter which is payload body. This is handled in the first if block which is
// if (canContainBody(verb) && !hasFormDataParams(contentType)) { .. }
} else {
// In GET operations, parameters always query or path as per HTTP Binding spec
if (isUrlReplacement(bindingOperation)) {
param.setParamType(WSDLOperationParam.ParamTypeEnum.PATH);
if (log.isDebugEnabled()) {
log.debug("Param " + name + " type was set to Path.");
}
} else {
param.setParamType(WSDLOperationParam.ParamTypeEnum.QUERY);
if (log.isDebugEnabled()) {
log.debug("Param " + name + " type was set to Query.");
}
}
}
Part part = (Part) partObj;
param.setDataType(part.getTypeName().getLocalPart());
if (log.isDebugEnabled()) {
log.debug("Param " + name + " data type was set to " + param.getDataType());
}
params.add(param);
});
}
}
}
return params;
}
use of javax.wsdl.Input in project carbon-business-process by wso2.
the class AxisServiceUtils method getWSAInputAction.
/**
* Attempts to extract the WS-Addressing "Action" attribute value from the operation definition.
* When WS-Addressing is being used by a service provider, the "Action" is specified in the
* portType->operation instead of the SOAP binding->operation.
*
* @param partnerMessageContext BPELMessageContext
* @return the SOAPAction value if one is specified, otherwise empty string
*/
public static String getWSAInputAction(BPELMessageContext partnerMessageContext) {
BindingOperation bop = partnerMessageContext.getWsdlBindingForCurrentMessageFlow().getBindingOperation(partnerMessageContext.getOperationName(), null, null);
if (bop == null) {
return "";
}
Input input = bop.getOperation().getInput();
if (input != null) {
Object action = input.getExtensionAttribute(new QName(Namespaces.WS_ADDRESSING_NS, "Action"));
if (action instanceof String) {
return ((String) action);
}
action = input.getExtensionAttribute(new QName(BPELConstants.WS_ADDRESSING_NS2, "Action"));
if (action instanceof String) {
return ((String) action);
}
action = input.getExtensionAttribute(new QName(BPELConstants.WS_ADDRESSING_NS3, "Action"));
if (action instanceof String) {
return ((String) action);
}
action = input.getExtensionAttribute(new QName(BPELConstants.WS_ADDRESSING_NS4, "Action"));
if (action instanceof String) {
return ((String) action);
}
}
return "";
}
use of javax.wsdl.Input in project teiid by teiid.
the class WSDLMetadataProcessor method buildSoapOperation.
private void buildSoapOperation(MetadataFactory mf, BindingOperation bindingOperation) {
Operation operation = bindingOperation.getOperation();
// add input
String inputXML = null;
Input input = operation.getInput();
if (input != null) {
Message message = input.getMessage();
if (message != null) {
inputXML = message.getQName().getLocalPart();
}
}
// add output
String outXML = null;
Output output = operation.getOutput();
if (output != null) {
Message message = output.getMessage();
if (message != null) {
outXML = message.getQName().getLocalPart();
}
}
// $NON-NLS-1$
ExtensibilityElement operationExtension = getExtensibilityElement(bindingOperation.getExtensibilityElements(), "operation");
if (!(operationExtension instanceof SOAPOperation) && !(operationExtension instanceof SOAP12Operation)) {
return;
}
if (operationExtension instanceof SOAPOperation) {
// soap:operation
SOAPOperation soapOperation = (SOAPOperation) operationExtension;
String style = soapOperation.getStyle();
if (style.equalsIgnoreCase("rpc")) {
// $NON-NLS-1$
LogManager.logInfo(LogConstants.CTX_CONNECTOR, WSExecutionFactory.UTIL.gs(WSExecutionFactory.Event.TEIID15004, operation.getName()));
return;
}
} else if (operationExtension instanceof SOAP12Operation) {
// soap:operation
SOAP12Operation soapOperation = (SOAP12Operation) operationExtension;
String style = soapOperation.getStyle();
if (style.equalsIgnoreCase("rpc")) {
// $NON-NLS-1$
LogManager.logInfo(LogConstants.CTX_CONNECTOR, WSExecutionFactory.UTIL.gs(WSExecutionFactory.Event.TEIID15004, operation.getName()));
return;
}
}
Procedure procedure = mf.addProcedure(operation.getName());
procedure.setVirtual(false);
procedure.setNameInSource(operation.getName());
mf.addProcedureParameter(inputXML, TypeFacility.RUNTIME_NAMES.XML, Type.In, procedure);
// $NON-NLS-1$
ProcedureParameter param = mf.addProcedureParameter("stream", TypeFacility.RUNTIME_NAMES.BOOLEAN, Type.In, procedure);
// $NON-NLS-1$
param.setAnnotation("If the result should be streamed.");
param.setNullType(NullType.Nullable);
// $NON-NLS-1$
param.setDefaultValue("false");
mf.addProcedureParameter(outXML, TypeFacility.RUNTIME_NAMES.XML, Type.ReturnValue, procedure);
}
Aggregations