本文整理汇总了Java中javax.wsdl.BindingOperation.setBindingInput方法的典型用法代码示例。如果您正苦于以下问题:Java BindingOperation.setBindingInput方法的具体用法?Java BindingOperation.setBindingInput怎么用?Java BindingOperation.setBindingInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.wsdl.BindingOperation
的用法示例。
在下文中一共展示了BindingOperation.setBindingInput方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addWsdlBindingOperation
import javax.wsdl.BindingOperation; //导入方法依赖的package包/类
private static void addWsdlBindingOperation(Definition definition, QName bindingQName, String projectName, String operationName, String operationComment) {
SOAPBodyImpl soapInputBody = new SOAPBodyImpl();
soapInputBody.setUse("literal");
BindingInput bindingInput = definition.createBindingInput();
bindingInput.addExtensibilityElement(soapInputBody);
SOAPBodyImpl soapOutputBody = new SOAPBodyImpl();
soapOutputBody.setUse("literal");
BindingOutput bindingOutput = definition.createBindingOutput();
bindingOutput.addExtensibilityElement(soapOutputBody);
SOAPOperationImpl soapOperation = new SOAPOperationImpl();
soapOperation.setSoapActionURI(projectName + "?" + operationName);
BindingOperation bindingOperation = definition.createBindingOperation();
bindingOperation.setName(operationName);
bindingOperation.addExtensibilityElement(soapOperation);
bindingOperation.setBindingInput(bindingInput);
bindingOperation.setBindingOutput(bindingOutput);
addWsdLDocumentation(definition, bindingOperation, operationComment);
Binding binding = definition.getBinding(bindingQName);
binding.addBindingOperation(bindingOperation);
}
示例2: addOperationSOAPBinding
import javax.wsdl.BindingOperation; //导入方法依赖的package包/类
private void addOperationSOAPBinding(Definition localDef, PortType portType, Operation wsdlOp, Binding bind) {
try {
// creating operation binding
BindingOperation bindOp = localDef.createBindingOperation();
bindOp.setName(wsdlOp.getName());
// adding soap extensibility elements
SOAPOperation soapOperation = (SOAPOperation) extensionRegistry.createExtension(BindingOperation.class, new QName(NameSpacesEnum.SOAP.getNameSpaceURI(), "operation"));
soapOperation.setStyle("document");
//NOTA-BENE: Come settare SOAPACTION? jolie usa SOAP1.1 o 1.2? COme usa la SoapAction?
soapOperation.setSoapActionURI(wsdlOp.getName());
bindOp.addExtensibilityElement(soapOperation);
bindOp.setOperation(wsdlOp);
// adding input
BindingInput bindingInput = localDef.createBindingInput();
SOAPBody body = (SOAPBody) extensionRegistry.createExtension(BindingInput.class, new QName(NameSpacesEnum.SOAP.getNameSpaceURI(), "body"));
body.setUse("literal");
bindingInput.addExtensibilityElement(body);
bindOp.setBindingInput(bindingInput);
// adding output
BindingOutput bindingOutput = localDef.createBindingOutput();
bindingOutput.addExtensibilityElement(body);
bindOp.setBindingOutput(bindingOutput);
// adding fault
if (!wsdlOp.getFaults().isEmpty()) {
Iterator it = wsdlOp.getFaults().entrySet().iterator();
while (it.hasNext()) {
BindingFault bindingFault = localDef.createBindingFault();
SOAPFault soapFault = (SOAPFault) extensionRegistry.createExtension(BindingFault.class, new QName(NameSpacesEnum.SOAP.getNameSpaceURI(), "fault"));
soapFault.setUse("literal");
String faultName = ((Entry) it.next()).getKey().toString();
bindingFault.setName(faultName);
soapFault.setName(faultName);
bindingFault.addExtensibilityElement(soapFault);
bindOp.addBindingFault(bindingFault);
}
}
bind.addBindingOperation(bindOp);
} catch (WSDLException ex) {
ex.printStackTrace();
}
}
示例3: getWSDLBindingOperation
import javax.wsdl.BindingOperation; //导入方法依赖的package包/类
/**
* generates the soap11 binding operation for the soap 11 binding.
*
* @param definition
* @param wsdlOperation
* @param operation
* @return
* @throws SchemaGenerationException
*/
public BindingOperation getWSDLBindingOperation(Definition definition,
javax.wsdl.Operation wsdlOperation,
Operation operation)
throws SchemaGenerationException {
BindingOperation bindingOperation = definition.createBindingOperation();
bindingOperation.setName(operation.getName());
bindingOperation.setOperation(wsdlOperation);
BindingInput bindingInput = definition.createBindingInput();
bindingOperation.setBindingInput(bindingInput);
BindingOutput bindingOutput = definition.createBindingOutput();
bindingOperation.setBindingOutput(bindingOutput);
ExtensionRegistry extensionRegistry = null;
try {
extensionRegistry = WSDLFactory.newInstance().newPopulatedExtensionRegistry();
SOAPOperation soapOperation = (SOAPOperation) extensionRegistry.createExtension(
BindingOperation.class, new QName("http://schemas.xmlsoap.org/wsdl/soap/", "operation"));
soapOperation.setSoapActionURI("urn:" + operation.getName());
soapOperation.setStyle("document");
bindingOperation.addExtensibilityElement(soapOperation);
SOAPBody inputSoapBody = (SOAPBody) extensionRegistry.createExtension(
BindingInput.class, new QName("http://schemas.xmlsoap.org/wsdl/soap/", "body"));
inputSoapBody.setUse("literal");
bindingInput.addExtensibilityElement(inputSoapBody);
SOAPBody outputSoapBody = (SOAPBody) extensionRegistry.createExtension(
BindingOutput.class, new QName("http://schemas.xmlsoap.org/wsdl/soap/", "body"));
outputSoapBody.setUse("literal");
bindingOutput.addExtensibilityElement(outputSoapBody);
// adding fault messages
Class[] exceptionClasses = operation.getJavaMethod().getExceptionTypes();
BindingFault bindingFault;
String faultName;
for (int i = 0; i < exceptionClasses.length; i++) {
faultName = exceptionClasses[i].getName();
faultName = faultName.substring(faultName.lastIndexOf(".") + 1);
bindingFault = definition.createBindingFault();
bindingFault.setName("fault" + faultName);
bindingOperation.addBindingFault(bindingFault);
SOAPFault soapFault = (SOAPFault) extensionRegistry.createExtension(
BindingFault.class, new QName("http://schemas.xmlsoap.org/wsdl/soap/", "fault"));
soapFault.setUse("literal");
soapFault.setName("fault" + faultName);
bindingFault.addExtensibilityElement(soapFault);
}
} catch (WSDLException e) {
throw new SchemaGenerationException("Can not crete a wsdl factory");
}
return bindingOperation;
}