本文整理汇总了Java中javax.wsdl.extensions.soap.SOAPOperation类的典型用法代码示例。如果您正苦于以下问题:Java SOAPOperation类的具体用法?Java SOAPOperation怎么用?Java SOAPOperation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SOAPOperation类属于javax.wsdl.extensions.soap包,在下文中一共展示了SOAPOperation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSoapActionForOperation
import javax.wsdl.extensions.soap.SOAPOperation; //导入依赖的package包/类
private String getSoapActionForOperation( String operationName )
throws IOException
{
String soapAction = null;
Port port = getWSDLPort();
if ( port != null ) {
BindingOperation bindingOperation = port.getBinding().getBindingOperation( operationName, null, null );
for( ExtensibilityElement element : (List<ExtensibilityElement>) bindingOperation.getExtensibilityElements() ) {
if ( element instanceof SOAPOperation ) {
soapAction = ((SOAPOperation) element).getSoapActionURI();
}
}
}
if ( soapAction == null ) {
soapAction = getStringParameter( "namespace" ) + "/" + operationName;
}
return soapAction;
}
示例2: getSoapAction
import javax.wsdl.extensions.soap.SOAPOperation; //导入依赖的package包/类
/**
* Get the soapAction value for a given operation.
*
* @param operation The WSDL BindingOperation.
* @return the soapAction value if it exists.
*/
public static String getSoapAction(final BindingOperation operation) {
String soapActionUri = "";
if (operation != null) {
List<ExtensibilityElement> extElements = operation.getExtensibilityElements();
for (ExtensibilityElement extElement : extElements) {
if (extElement instanceof SOAPOperation) {
soapActionUri = ((SOAPOperation) extElement).getSoapActionURI();
break;
} else if (extElement instanceof SOAP12Operation) {
SOAP12Operation soapOperation = ((SOAP12Operation) extElement);
Boolean soapActionRequired = soapOperation.getSoapActionRequired();
if ((soapActionRequired == null) || soapActionRequired) {
soapActionUri = soapOperation.getSoapActionURI();
}
break;
}
}
}
return soapActionUri;
}
示例3: getSOAPAction
import javax.wsdl.extensions.soap.SOAPOperation; //导入依赖的package包/类
public String getSOAPAction(QName serviceQname) {
Binding binding = getFirstPortBinding(serviceQname);
if (binding == null) {
return null;
}
List operations = binding.getBindingOperations();
for (Object opObj : operations) {
BindingOperation operation = (BindingOperation)opObj;
List exElements = operation.getExtensibilityElements();
for (Object elObj : exElements) {
ExtensibilityElement exElement = (ExtensibilityElement)elObj;
if (isSoapOperation(exElement)) {
SOAPOperation soapOperation = (SOAPOperation)exElement;
return soapOperation.getSoapActionURI();
}
}
}
return null;
}
示例4: getStyle
import javax.wsdl.extensions.soap.SOAPOperation; //导入依赖的package包/类
private String getStyle(BindingOperation bindingOperation) {
String style = null;
List<ExtensibilityElement> extensibilityElements = bindingOperation.getExtensibilityElements();
for (ExtensibilityElement extensibilityElement : extensibilityElements) {
if (extensibilityElement instanceof SOAPOperation) {
SOAPOperation soapOperation = (SOAPOperation) extensibilityElement;
style = soapOperation.getStyle();
}
}
return style;
}
示例5: getSOAPActionURI
import javax.wsdl.extensions.soap.SOAPOperation; //导入依赖的package包/类
private String getSOAPActionURI(BindingOperation bindingOperation) {
List<ExtensibilityElement> extensibilityElements = bindingOperation.getExtensibilityElements();
for (ExtensibilityElement extensibilityElement : extensibilityElements) {
if (extensibilityElement instanceof SOAPOperation) {
SOAPOperation soapOperation = (SOAPOperation) extensibilityElement;
return soapOperation.getSoapActionURI();
}
}
return null;
}
示例6: getSOAPStyle
import javax.wsdl.extensions.soap.SOAPOperation; //导入依赖的package包/类
/**
* A util method that returns the SOAP style included in the binding
* operation
*
* @param bindingOp
*/
private String getSOAPStyle(BindingOperation bindingOp) {
List extensibilityElements = bindingOp.getExtensibilityElements();
for (int i = 0; i < extensibilityElements.size(); i++) {
Object extElement = extensibilityElements.get(i);
if (extElement instanceof SOAPOperation) {
return ((SOAPOperation) extElement).getStyle();
} else if (extElement instanceof SOAP12Operation) {
return ((SOAP12Operation) extElement).getStyle();
}
}
return null;
}
示例7: getSOAPAction
import javax.wsdl.extensions.soap.SOAPOperation; //导入依赖的package包/类
/**
* Get the Soap Action URI from the operation's soap:operation extensiblity element.
*
* @param operation A WSDL Operation.
* @return Soap action URI as string, null if not defined.
*/
protected static String getSOAPAction(BindingOperation operation) {
ExtensibilityElement e = findExtensibilityElement(operation, SOAP_OPERATION_ELEMENT_NAME);
if (e != null) {
if (e instanceof SOAP12Operation) {
return ((SOAP12Operation)e).getSoapActionURI();
} else {
return ((SOAPOperation) e).getSoapActionURI();
}
}
return null;
}
示例8: getSOAPAction
import javax.wsdl.extensions.soap.SOAPOperation; //导入依赖的package包/类
/**
* Get the Soap Action URI from the operation's soap:operation extensiblity element.
*
* @param operation
* A WSDL Operation.
* @return Soap action URI as string, null if not defined.
*/
protected static String getSOAPAction( BindingOperation operation ) {
ExtensibilityElement e = findExtensibilityElement( operation, SOAP_OPERATION_ELEMENT_NAME );
if ( e != null ) {
if ( e instanceof SOAP12Operation ) {
return ( (SOAP12Operation) e ).getSoapActionURI();
} else {
return ( (SOAPOperation) e ).getSoapActionURI();
}
}
return null;
}
示例9: addOperationSOAPBinding
import javax.wsdl.extensions.soap.SOAPOperation; //导入依赖的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();
}
}
示例10: populateComponent
import javax.wsdl.extensions.soap.SOAPOperation; //导入依赖的package包/类
private static ServiceInfo populateComponent(Service service) {
ServiceInfo serviceInfo = new ServiceInfo();
serviceInfo.setServiceName(service.getQName());
Collection<Port> ports = service.getPorts().values();
for (Port port : ports) {
String soapLocation = null;
SOAPAddress soapAddress = findExtensibilityElement(port.getExtensibilityElements(), SOAPAddress.class);
if (null != soapAddress) {
soapLocation = soapAddress.getLocationURI();
} else {
SOAP12Address soap12Address = findExtensibilityElement(port.getExtensibilityElements(), SOAP12Address.class);
if (null != soap12Address) {
soapLocation = soap12Address.getLocationURI();
}
}
Binding binding = port.getBinding();
for (BindingOperation operation : (Collection<BindingOperation>) binding.getBindingOperations()) {
SOAPOperation soapOperation = findExtensibilityElement(operation.getExtensibilityElements(), SOAPOperation.class);
if (null != soapOperation && OPERATION_TYPE_RPC.equalsIgnoreCase(soapOperation.getStyle())) {
// TESB-6151 disable display of unsupported RPC type.
serviceInfo.setHasRpcOperation(true);
continue;
}
OperationInfo operationInfo = new OperationInfo(operation.getOperation());
operationInfo.setPortName(port.getName());
operationInfo.setNamespaceURI(binding.getPortType().getQName().getNamespaceURI());
if (soapOperation != null) {
operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
} else {
SOAP12Operation soap12Operation = findExtensibilityElement(operation.getExtensibilityElements(),
SOAP12Operation.class);
if (soap12Operation != null) {
operationInfo.setSoapActionURI(soap12Operation.getSoapActionURI());
}
}
operationInfo.setTargetURL(soapLocation);
serviceInfo.addOperation(operationInfo);
}
}
return serviceInfo;
}
示例11: getWSDLBindingOperation
import javax.wsdl.extensions.soap.SOAPOperation; //导入依赖的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;
}
示例12: postProcessBeanFactory
import javax.wsdl.extensions.soap.SOAPOperation; //导入依赖的package包/类
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
Assert.notNull(wsdlResource,
"Missing either WSDL location system property setting or explicit WSDL resource for scenario auto generation");
Definition wsdl = getWsdlDefinition(wsdlResource);
XmlObject wsdlObject = compileWsdl(wsdlResource);
SchemaTypeSystem schemaTypeSystem = compileXsd(wsdlObject);
for (Object item : wsdl.getBindings().values()) {
Binding binding = (Binding) item;
for (Object operationItem : binding.getBindingOperations()) {
BindingOperation operation = (BindingOperation) operationItem;
SchemaType requestElem = getSchemaType(schemaTypeSystem, operation.getName(), operation.getOperation().getInput().getName());
SchemaType responseElem = getSchemaType(schemaTypeSystem, operation.getName(), operation.getOperation().getOutput().getName());
String soapAction = "";
List extensions = operation.getExtensibilityElements();
if (extensions != null) {
for (int i = 0; i < extensions.size(); i++) {
ExtensibilityElement extElement = (ExtensibilityElement) extensions.get(i);
if (extElement instanceof SOAPOperation) {
SOAPOperation soapOp = (SOAPOperation) extElement;
soapAction = soapOp.getSoapActionURI();
}
}
}
String scenarioName;
switch (namingStrategy) {
case INPUT:
scenarioName = operation.getOperation().getInput().getName();
break;
case OPERATION:
scenarioName = operation.getOperation().getName();
break;
case SOAP_ACTION:
scenarioName = soapAction;
break;
default:
throw new SimulatorException("Unknown scenario naming strategy");
}
if (beanFactory instanceof BeanDefinitionRegistry) {
log.info("Register auto generated scenario as bean definition: " + scenarioName);
BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(WsdlOperationScenario.class)
.addConstructorArgValue(operation)
.addPropertyValue("soapAction", soapAction)
.addPropertyValue("input", generateRequest(operation, SampleXmlUtil.createSampleForType(requestElem)))
.addPropertyValue("output", generateResponse(operation, SampleXmlUtil.createSampleForType(responseElem)));
if (beanFactory.containsBeanDefinition("inboundXmlDataDictionary")) {
beanDefinitionBuilder.addPropertyReference("inboundDataDictionary", "inboundXmlDataDictionary");
}
if (beanFactory.containsBeanDefinition("outboundXmlDataDictionary")) {
beanDefinitionBuilder.addPropertyReference("outboundDataDictionary", "outboundXmlDataDictionary");
}
((BeanDefinitionRegistry) beanFactory).registerBeanDefinition(scenarioName, beanDefinitionBuilder.getBeanDefinition());
} else {
log.info("Register auto generated scenario as singleton: " + scenarioName);
WsdlOperationScenario scenario = createScenario(operation, soapAction, generateRequest(operation, SampleXmlUtil.createSampleForType(requestElem)), generateResponse(operation, SampleXmlUtil.createSampleForType(responseElem)));
beanFactory.registerSingleton(scenarioName, scenario);
}
}
}
}
示例13: buildOperations
import javax.wsdl.extensions.soap.SOAPOperation; //导入依赖的package包/类
private List buildOperations(Binding binding) {
System.out.println("进入buildOperations(Binding binding)方法,构建服务所有的操作对象List buildOperations");
List operationInfos = new ArrayList();
List operations=binding.getBindingOperations();
if (operations!= null && !operations.isEmpty()) {
Vector soapBindingElems = findExtensibilityElement(binding
.getExtensibilityElements(), "binding");
String style = "document"; // default
ExtensibilityElement soapBindingElem = (ExtensibilityElement) soapBindingElems
.elementAt(0);
if (soapBindingElem != null
&& soapBindingElem instanceof SOAPBinding) {
//SOAPBinding类代表的就是<wsdl:binding>下的子元素:<wsdlsoap:binding元素>
SOAPBinding soapBinding = (SOAPBinding) soapBindingElem;
style = soapBinding.getStyle();
}
Iterator opIter = operations.iterator();
while (opIter.hasNext()) {
//BindingOperation类代表的就是<wsdl:binding>下的子元素:<wsdlsoap:operation元素>
BindingOperation oper = (BindingOperation) opIter.next();
Vector operElems = findExtensibilityElement(oper
.getExtensibilityElements(), "operation");
ExtensibilityElement operElem = (ExtensibilityElement) operElems
.elementAt(0);
//SOAPOperation类代表的就是<wsdlsoap:operation>下的子元素:<wsdlsoap:operation/>
if (operElem != null && operElem instanceof SOAPOperation) {
OperationInfo operationInfo = new OperationInfo(style);
buildOperation(operationInfo, oper);
operationInfos.add(operationInfo);
}
}
}
return operationInfos;
}
示例14: buildOperation
import javax.wsdl.extensions.soap.SOAPOperation; //导入依赖的package包/类
private OperationInfo buildOperation(OperationInfo operationInfo,
BindingOperation bindingOper) {
System.out.println("从一个BindingOperation对象(<wsdl:operation>)构建OperationInfo对象");
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());
}
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());
}
Input inDef = oper.getInput();
System.out.println("开始转移到了<wsdl:portTyp>结点下的<wsdl:input>");
if (inDef != null) {
Message inMsg = inDef.getMessage();
if (inMsg != null) {
operationInfo.setInputMessageName(inMsg.getQName().getLocalPart());
//输入消息的参数构建
getParameterFromMessage(operationInfo, inMsg, 1);
System.out.println("***操作:"+operationInfo.getTargetMethodName()+"的所有输入参数已经构建完毕***");
System.out.println("");
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);
System.out.println("***操作:"+operationInfo.getTargetMethodName()+"的所有输出参数已经构建完毕***");
System.out.println("");
operationInfo.setOutmessage(outMsg);
}
}
return operationInfo;
}
示例15: HeavyweightOperationInfoBuilder
import javax.wsdl.extensions.soap.SOAPOperation; //导入依赖的package包/类
public HeavyweightOperationInfoBuilder(BindingOperation bindingOperation, ServiceEndpointMethodMapping methodMapping, JavaWsdlMapping mapping, XmlSchemaInfo schemaInfo) throws OpenEJBException {
Operation operation = bindingOperation.getOperation();
this.operationName = operation.getName();
this.operationStyle = JaxRpcOperationInfo.OperationStyle.valueOf(operation.getStyle().toString());
this.outputMessage = operation.getOutput() == null ? null : operation.getOutput().getMessage();
this.inputMessage = operation.getInput().getMessage();
// faults
for (Object o : operation.getFaults().values()) {
faults.add((Fault) o);
}
this.mapping = mapping;
this.methodMapping = methodMapping;
this.schemaInfo = schemaInfo;
// index types - used to process build exception class constructor args
for (JavaXmlTypeMapping javaXmlTypeMapping : mapping.getJavaXmlTypeMapping()) {
String javaClassName = javaXmlTypeMapping.getJavaType();
if (javaXmlTypeMapping.getAnonymousTypeQname() != null) {
String anonymousTypeQName = javaXmlTypeMapping.getAnonymousTypeQname();
anonymousTypes.put(anonymousTypeQName, javaClassName);
} else if (javaXmlTypeMapping.getRootTypeQname() != null) {
QName qname = javaXmlTypeMapping.getRootTypeQname();
publicTypes.put(qname, javaClassName);
}
}
// BindingStyle
if (methodMapping.getWrappedElement() != null) {
bindingStyle = BindingStyle.DOCUMENT_LITERAL_WRAPPED;
} else {
BindingInput bindingInput = bindingOperation.getBindingInput();
SOAPOperation soapOperation = JaxRpcServiceInfoBuilder.getExtensibilityElement(SOAPOperation.class, bindingOperation.getExtensibilityElements());
String styleString = soapOperation.getStyle();
if (styleString == null) {
SOAPBinding soapBinding = JaxRpcServiceInfoBuilder.getExtensibilityElement(SOAPBinding.class, bindingInput.getExtensibilityElements());
styleString = soapBinding.getStyle();
}
SOAPBody soapBody = JaxRpcServiceInfoBuilder.getExtensibilityElement(SOAPBody.class, bindingInput.getExtensibilityElements());
String useString = soapBody.getUse();
bindingStyle = BindingStyle.getBindingStyle(styleString, useString);
}
}