本文整理汇总了Java中javax.wsdl.Operation类的典型用法代码示例。如果您正苦于以下问题:Java Operation类的具体用法?Java Operation怎么用?Java Operation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Operation类属于javax.wsdl包,在下文中一共展示了Operation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPortTypeOperations
import javax.wsdl.Operation; //导入依赖的package包/类
/**
* 参考SoapMessageBuilder.SoapMessageBuilder(URL wsdlUrl)方法
* 获取portType中的所有operation
*
* @param wsdlUrl
* @return
*/
private static List<Operation> getPortTypeOperations(String wsdlUrl) {
List<Operation> operationList = new ArrayList();
try {
WSDLReader reader = new WSDLReaderImpl();
reader.setFeature("javax.wsdl.verbose", false);
Definition definition = reader.readWSDL(wsdlUrl.toString());
Map<String, PortTypeImpl> defMap = definition.getAllPortTypes();
Collection<PortTypeImpl> collection = defMap.values();
for (PortTypeImpl portType : collection) {
operationList.addAll(portType.getOperations());
}
} catch (WSDLException e) {
System.out.println("get wsdl operation fail.");
e.printStackTrace();
}
return operationList;
}
示例2: addWsdlPortTypeOperation
import javax.wsdl.Operation; //导入依赖的package包/类
private static void addWsdlPortTypeOperation(Definition definition, QName portTypeQName, String operationName, String operationComment, QName inputQName, QName ouptutQName) {
Message inputMessage = definition.createMessage();
inputMessage.setQName(inputQName);
Input input = definition.createInput();
input.setMessage(inputMessage);
Message outpuMessage = definition.createMessage();
outpuMessage.setQName(ouptutQName);
Output output = definition.createOutput();
output.setMessage(outpuMessage);
Operation operation = definition.createOperation();
operation.setName(operationName);
operation.setInput(input);
operation.setOutput(output);
operation.setUndefined(false);
addWsdLDocumentation(definition, operation, operationComment);
PortType portType = definition.getPortType(portTypeQName);
portType.addOperation(operation);
}
示例3: test
import javax.wsdl.Operation; //导入依赖的package包/类
@Test
@RunAsClient
public void test() throws Exception
{
File destDir = new File(TEST_DIR, "wsprovide" + FS + "java");
String absOutput = destDir.getAbsolutePath();
String command = JBOSS_HOME + FS + "bin" + FS + "wsprovide" + EXT + " -k -w -o " + absOutput + " --classpath " + CLASSES_DIR + " " + ENDPOINT_CLASS;
Map<String, String> env = new HashMap<>();
env.put("JAVA_OPTS", System.getProperty("additionalJvmArgs"));
executeCommand(command, null, "wsprovide", env);
URL wsdlURL = new File(destDir, "JBWS2528EndpointService.wsdl").toURI().toURL();
WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
Definition wsdlDefinition = wsdlReader.readWSDL(wsdlURL.toString());
PortType portType = wsdlDefinition.getPortType(new QName("http://jbws2528.jaxws.ws.test.jboss.org/", "JBWS2528Endpoint"));
Operation op = (Operation)portType.getOperations().get(0);
@SuppressWarnings("unchecked")
List<String> parOrder = op.getParameterOrdering();
assertEquals("id", parOrder.get(0));
assertEquals("Name", parOrder.get(1));
assertEquals("Employee", parOrder.get(2));
}
示例4: addOWOperation2PT
import javax.wsdl.Operation; //导入依赖的package包/类
private Operation addOWOperation2PT(Definition def, PortType pt, OneWayOperationDeclaration op) {
Operation wsdlOp = def.createOperation();
wsdlOp.setName(op.id());
wsdlOp.setStyle(OperationType.ONE_WAY);
wsdlOp.setUndefined(false);
Input in = def.createInput();
Message msg_req = addRequestMessage(localDef, op);
msg_req.setUndefined(false);
in.setMessage(msg_req);
wsdlOp.setInput(in);
wsdlOp.setUndefined(false);
pt.addOperation(wsdlOp);
return wsdlOp;
}
示例5: getOperations
import javax.wsdl.Operation; //导入依赖的package包/类
/**
* The method is here only for compatibility with other modules and will be removed as soon as other modules are updated.
*
* @return a list of all SOAP operations found in the WSDL (including all imported definitions)
* @deprecated
*/
@Deprecated
List<Operation> getOperations() {
List<Operation> operations = new ArrayList<Operation>();
Collection<Binding> bindings = definition.getAllBindings().values();
for (Binding binding : bindings) {
List<ExtensibilityElement> bindingExElements = binding.getExtensibilityElements();
for (ExtensibilityElement bindingExElement : bindingExElements) {
if (bindingExElement instanceof SOAPBinding ||
bindingExElement instanceof SOAP12Binding) {
List<BindingOperation> bindingOperations = binding.getBindingOperations();
for (BindingOperation bindingOperation : bindingOperations) {
Operation operation = bindingOperation.getOperation();
if (operation != null) {
operations.add(operation);
}
}
}
}
}
return operations;
}
示例6: getBindingOperation
import javax.wsdl.Operation; //导入依赖的package包/类
private BindingOperation getBindingOperation(String portName, String operationName) throws UnknownOperationException {
BindingOperation bindingOperation = null;
for(BindingOperation bOperation : getBindingOperations(portName)) {
Operation operation = bOperation.getOperation();
if (operationName.equals(operation.getName())) {
if (bindingOperation == null) {
bindingOperation = bOperation;
} else {
logger.log(Level.WARNING, "overloaded operation detected ({0})", operationName);
break;
}
}
}
if (bindingOperation == null) {
throw new UnknownOperationException("no '" + operationName + "' operation found in a '" + portName + "' port");
}
return bindingOperation;
}
示例7: getWrapperNamespace
import javax.wsdl.Operation; //导入依赖的package包/类
private String getWrapperNamespace(String operationName, boolean input) {
String ns = null;
if (_wsdlPort != null) {
Operation operation = WSDLUtil.getOperationByName(_wsdlPort, operationName);
if (!_documentStyle) {
ns = input ? operation.getInput().getMessage().getQName().getNamespaceURI()
: operation.getOutput().getMessage().getQName().getNamespaceURI();
} else {
// Note: WS-I Profile allows only one child under SOAPBody.
Part part = input ? (Part)operation.getInput().getMessage().getParts().values().iterator().next()
: (Part)operation.getOutput().getMessage().getParts().values().iterator().next();
if (part.getElementName() != null) {
ns = part.getElementName().getNamespaceURI();
} else if (part.getTypeName() != null) {
ns = part.getTypeName().getNamespaceURI();
}
}
}
return ns;
}
示例8: getOperationByElement
import javax.wsdl.Operation; //导入依赖的package包/类
/**
* Get the SOAP {@link Operation} instance for the specified message element.
*
* @param port The WSDL port.
* @param elementName The SOAP Body element QName.
* @param documentStyle true if it is 'document', false if 'rpc'.
* @return The Operation instance, or null if the operation was not found on the port.
*/
public static Operation getOperationByElement(Port port, QName elementName, Boolean documentStyle) {
List<Operation> operations = port.getBinding().getPortType().getOperations();
for (Operation operation : operations) {
if (!documentStyle && (elementName.getLocalPart().equals(operation.getName()))) {
return operation;
} else {
if ((operation.getInput() != null)
&& (operation.getInput().getMessage() != null)
&& (operation.getInput().getMessage().getParts() != null)
&& !operation.getInput().getMessage().getParts().isEmpty()) {
// Note: WS-I Profile allows only one child under SOAPBody.
Part part = (Part)operation.getInput().getMessage().getParts().values().iterator().next();
if ((part.getElementName() != null) && elementName.equals(part.getElementName())
|| (part.getTypeName() != null) && elementName.equals(part.getTypeName())) {
return operation;
} else if (elementName.getLocalPart().equals(operation.getName())) {
return operation;
}
// }
}
}
}
return null;
}
示例9: addParamsToPath
import javax.wsdl.Operation; //导入依赖的package包/类
private static void addParamsToPath(final QName portType, Operation oper, Message msg, final Set<String> paths,
final Set<QName> alreadyCreated) throws URISyntaxException {
if (msg != null) {
List<QName> messageParts = getMessageParts(msg);
if (messageParts.isEmpty()) {
return;
}
for(QName messagePart : messageParts) {
if (alreadyCreated.add(messagePart)) {
String folderPath = FolderNameUtil.getImportedXmlSchemaPath(messagePart.getNamespaceURI(),
portType.getLocalPart(), oper.getName());
paths.add(folderPath);
}
}
}
}
示例10: OperationInfo
import javax.wsdl.Operation; //导入依赖的package包/类
public OperationInfo(Operation operation) {
targetMethodName = operation.getName();
Input inDef = operation.getInput();
if (inDef != null) {
Message inMsg = inDef.getMessage();
if (inMsg != null) {
input = getParameterFromMessage(inMsg);
}
}
Output outDef = operation.getOutput();
if (outDef != null) {
Message outMsg = outDef.getMessage();
if (outMsg != null) {
output = getParameterFromMessage(outMsg);
}
}
for (Fault fault : (Collection<Fault>) operation.getFaults().values()) {
Message faultMsg = fault.getMessage();
if (faultMsg != null) {
faults.add(getParameterFromMessage(faultMsg));
}
}
}
示例11: parseSoapFault
import javax.wsdl.Operation; //导入依赖的package包/类
public static Fault parseSoapFault(Element odeMsgEl, SOAPEnvelope envelope, Operation operation)
throws AxisFault {
SOAPFault flt = envelope.getBody().getFault();
SOAPFaultDetail detail = flt.getDetail();
Fault fdef = inferFault(operation, flt);
if (fdef == null) {
return null;
}
Part pdef = (Part) fdef.getMessage().getParts().values().iterator().next();
Element partel = odeMsgEl.getOwnerDocument().createElementNS(null, pdef.getName());
odeMsgEl.appendChild(partel);
if (detail.getFirstChildWithName(pdef.getElementName()) != null) {
partel.appendChild(odeMsgEl.getOwnerDocument().importNode(
OMUtils.toDOM(detail.getFirstChildWithName(pdef.getElementName())), true));
} else {
partel.appendChild(odeMsgEl.getOwnerDocument().importNode(OMUtils.toDOM(detail), true));
}
return fdef;
}
示例12: processSoapHeaderParts
import javax.wsdl.Operation; //导入依赖的package包/类
private void processSoapHeaderParts(WSDLAwareMessage message, BindingInput bindingInput,
Operation op) throws AxisFault {
/* TODO: Analyze the header handling implementation */
List<SOAPHeader> headerDefs = getSOAPHeaders(bindingInput);
org.apache.axiom.soap.SOAPHeader soapHeader = inMessageCtx.getEnvelope().getHeader();
for (SOAPHeader headerDef : headerDefs) {
handleSoapHeaderPartDef(message, headerDef, op.getInput().getMessage(), soapHeader);
}
if (soapHeader != null) {
Iterator headersIter = soapHeader.getChildElements();
while (headersIter.hasNext()) {
OMElement header = (OMElement) headersIter.next();
String partName = findHeaderPartName(headerDefs, header.getQName());
//The following commented fix, avoids adding any of the headers. So that reverting
// back to old fix
// if (partName != null) {
// Fix for JIRA https://wso2.org/jira/browse/CARBON-5499
message.addHeaderPart(partName, header);
// }
}
}
}
示例13: getNameFromInputElement
import javax.wsdl.Operation; //导入依赖的package包/类
/**
* Get the name of the specified Input element using the rules defined in WSDL 1.1
* Section 2.4.5 http://www.w3.org/TR/wsdl#_names
*/
private static String getNameFromInputElement(Operation op, Input input) {
// Get the name from the input element if specified.
String result = input.getName();
// If not we'll have to generate it.
if (result == null) {
// If Request-Response or Solicit-Response do something special per
// WSDL 1.1 Section 2.4.5
OperationType operationType = op.getStyle();
if (null != operationType) {
if (operationType.equals(OperationType.REQUEST_RESPONSE)) {
result = op.getName() + REQUEST;
} else if (operationType.equals(OperationType.SOLICIT_RESPONSE)) {
result = op.getName() + RESPONSE;
}
}
// If the OperationType was not available for some reason, assume on-way or notification
if (result == null) {
result = op.getName();
}
}
return result;
}
示例14: generateActionFromOutputElement
import javax.wsdl.Operation; //导入依赖的package包/类
/**
* Generate the Action for an Output using the Default Action Pattern
* <p/>
* Pattern is defined as [target namespace][delimiter][port type name][delimiter][output name]
*
* @param def is required to obtain the targetNamespace
* @param wsdl4jPortType is required to obtain the portType name
* @param op is required to generate the output name if not explicitly specified
* @param output is required for its name if specified
* @return a wsa:Action value based on the Default Action Pattern and the provided objects
*/
public static String generateActionFromOutputElement(Definition def, PortType wsdl4jPortType,
Operation op, Output output) {
// Get the targetNamespace of the wsdl:definition
String targetNamespace = def.getTargetNamespace();
// Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/".
// Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/"
// character), the default action value may not conform to the rules of the IRI scheme. Authors
// are advised to specify explicit values in the WSDL in this case.'
String delimiter = SLASH;
if (targetNamespace.toLowerCase().startsWith(URN)) {
delimiter = COLON;
}
// Get the portType name (as a string to be included in the action)
String portTypeName = wsdl4jPortType.getQName().getLocalPart();
// Get the name of the output element (and generate one if none explicitly specified)
String outputName = getNameFromOutputElement(op, output);
// Append the bits together
StringBuffer sb = new StringBuffer();
sb.append(targetNamespace);
// Deal with the problem that the targetNamespace may or may not have a trailing delimiter
if (!targetNamespace.endsWith(delimiter)) {
sb.append(delimiter);
}
sb.append(portTypeName);
sb.append(delimiter);
sb.append(outputName);
// Resolve the action from the StringBuffer
String result = sb.toString();
if (log.isTraceEnabled()) {
log.trace("generateActionFromOutputElement result: " + result);
}
return result;
}
示例15: getNameFromOutputElement
import javax.wsdl.Operation; //导入依赖的package包/类
/**
* Get the name of the specified Output element using the rules defined in WSDL 1.1
* Section 2.4.5 http://www.w3.org/TR/wsdl#_names
*/
private static String getNameFromOutputElement(Operation op, Output output) {
// Get the name from the output element if specified.
String result = output.getName();
// If not we'll have to generate it.
if (result == null) {
// If Request-Response or Solicit-Response do something special per
// WSDL 1.1 Section 2.4.5
OperationType operationType = op.getStyle();
if (null != operationType) {
if (operationType.equals(OperationType.REQUEST_RESPONSE)) {
return op.getName() + RESPONSE;
} else if (operationType.equals(OperationType.SOLICIT_RESPONSE)) {
return op.getName() + SOLICIT;
}
}
// If the OperationType was not available for some reason, assume on-way or notification
if (result == null) {
result = op.getName();
}
}
return result;
}