本文整理汇总了Java中javax.wsdl.Binding类的典型用法代码示例。如果您正苦于以下问题:Java Binding类的具体用法?Java Binding怎么用?Java Binding使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Binding类属于javax.wsdl包,在下文中一共展示了Binding类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testWsdl
import javax.wsdl.Binding; //导入依赖的package包/类
@Test
@RunAsClient
public void testWsdl() throws Exception
{
URL wsdlURL = new URL(baseURL + "/jaxws-jbws2183/TestServiceImpl?wsdl");
WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
Definition wsdlDefinition = wsdlReader.readWSDL(wsdlURL.toString());
assertNotNull(wsdlDefinition);
for (Iterator<?> it = wsdlDefinition.getAllBindings().values().iterator(); it.hasNext(); )
{
List<?> extElements = ((Binding)it.next()).getExtensibilityElements();
boolean found = false;
for (int i = 0; i < extElements.size(); i++)
{
ExtensibilityElement extElement = (ExtensibilityElement)extElements.get(i);
if (extElement instanceof SOAP12Binding)
found = true;
else if (extElement instanceof SOAPBinding)
fail("SOAP 1.1 Binding found!");
}
assertTrue("SOAP 1.2 Binding not found!",found);
}
}
示例2: addWsdlBindingOperation
import javax.wsdl.Binding; //导入依赖的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);
}
示例3: createBindingSOAP
import javax.wsdl.Binding; //导入依赖的package包/类
private Binding createBindingSOAP(Definition def, PortType pt, String bindingName) {
Binding bind = def.getBinding(new QName(bindingName));
if (bind == null) {
bind = def.createBinding();
bind.setQName(new QName(tns, bindingName));
}
bind.setPortType(pt);
bind.setUndefined(false);
try {
SOAPBinding soapBinding = (SOAPBinding) extensionRegistry.createExtension(Binding.class, new QName(NameSpacesEnum.SOAP.getNameSpaceURI(), "binding"));
soapBinding.setTransportURI(NameSpacesEnum.SOAPoverHTTP.getNameSpaceURI());
soapBinding.setStyle("document");
bind.addExtensibilityElement(soapBinding);
} catch (WSDLException ex) {
System.out.println((ex.getStackTrace()));
}
def.addBinding(bind);
return bind;
}
示例4: createService
import javax.wsdl.Binding; //导入依赖的package包/类
public Service createService(Definition localdef, String serviceName, Binding bind, String mySOAPAddress) {
Port p = localDef.createPort();
p.setName(serviceName + "Port");
try {
SOAPAddress soapAddress = (SOAPAddress) extensionRegistry.createExtension(Port.class, new QName(NameSpacesEnum.SOAP.getNameSpaceURI(), "address"));
soapAddress.setLocationURI(mySOAPAddress);
p.addExtensibilityElement(soapAddress);
} catch (WSDLException ex) {
ex.printStackTrace();
}
p.setBinding(bind);
Service s = new ServiceImpl();
QName serviceQName = new QName(serviceName);
s.setQName(serviceQName);
s.addPort(p);
localDef.addService(s);
return s;
}
示例5: _toDumpData
import javax.wsdl.Binding; //导入依赖的package包/类
private DumpData _toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) throws RPCException {
DumpTable functions = new DumpTable("webservice","#99cc99","#ccffcc","#000000");
functions.setTitle("Web Service (JAX WS)");
if(dp.getMetainfo())functions.setComment(wsdlUrl);
Port port = WSUtil.getSoapPort(service);
Binding binding = port.getBinding();
List<BindingOperation> operations = binding.getBindingOperations();
Iterator<BindingOperation> it = operations.iterator();
BindingOperation bo;
while(it.hasNext()){
bo=it.next();
functions.appendRow(1, new SimpleDumpData(bo.getName()), toDumpData(bo));
}
return functions;
}
示例6: getOperations
import javax.wsdl.Binding; //导入依赖的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;
}
示例7: getOperationStyle
import javax.wsdl.Binding; //导入依赖的package包/类
@Override
public String getOperationStyle(String portName, String operationName) throws UnknownOperationException {
if (portName == null) {
portName = findPort(operationName);
}
BindingOperation bindingOperation = getBindingOperation(portName, operationName);
String style = getStyle(bindingOperation);
if (style == null) {
Port port = getPort(portName);
Binding binding = port.getBinding();
style = getStyle(binding);
}
return style;
}
示例8: getBindingOperations
import javax.wsdl.Binding; //导入依赖的package包/类
private List<BindingOperation> getBindingOperations(String portName) {
Port port = getPort(portName);
if (port != null) {
Binding binding = port.getBinding();
if (binding != null) {
List<ExtensibilityElement> bindingExElements = binding.getExtensibilityElements();
for (ExtensibilityElement bindingExElement : bindingExElements) {
if (bindingExElement instanceof SOAPBinding ||
bindingExElement instanceof SOAP12Binding) {
return binding.getBindingOperations();
}
}
}
}
return Collections.EMPTY_LIST;
}
示例9: getStyle
import javax.wsdl.Binding; //导入依赖的package包/类
private String getStyle(Binding binding) {
String style = null;
List<ExtensibilityElement> bindingExElements = binding.getExtensibilityElements();
for (ExtensibilityElement bindingExElement : bindingExElements) {
if (bindingExElement instanceof SOAPBinding) {
SOAPBinding soapBinding = (SOAPBinding)bindingExElement;
style = soapBinding.getStyle();
break;
} else if (bindingExElement instanceof SOAP12Binding) {
SOAP12Binding soap12Binding = (SOAP12Binding)bindingExElement;
style = soap12Binding.getStyle();
break;
}
}
return style != null ? style : "document";
}
示例10: extractBindingInformation
import javax.wsdl.Binding; //导入依赖的package包/类
private static Binding extractBindingInformation(final AxisService service,
final Definition wsdlOfService,
final MessageContext inMessageContext) {
AxisEndpoint currentEndpoint = (AxisEndpoint) inMessageContext
.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
if (currentEndpoint == null) {
String defaultEndpointName = service.getEndpointName();
currentEndpoint = service.getEndpoints().get(defaultEndpointName);
if (currentEndpoint == null) {
throw new NullPointerException("AxisEndpoint cannot be null.");
}
}
AxisBinding currentAxisBinding = currentEndpoint.getBinding();
QName bindingQName = currentAxisBinding.getName();
return wsdlOfService.getBinding(bindingQName);
}
示例11: getBindingExtension
import javax.wsdl.Binding; //导入依赖的package包/类
/**
* Look up the ExtensibilityElement defining the binding for the given Port or
* throw an {@link IllegalArgumentException} if multiple bindings found.
*
* @param binding WSDL binding
* @return an instance of {@link SOAPBinding} or {@link HTTPBinding} or null
* @throws IllegalArgumentException if multiple bindings found.
*/
public static ExtensibilityElement getBindingExtension(Binding binding) {
Collection bindings = new ArrayList();
CollectionsX.filter(bindings, binding.getExtensibilityElements(), HTTPBinding.class);
CollectionsX.filter(bindings, binding.getExtensibilityElements(), SOAPBinding.class);
CollectionsX.filter(bindings, binding.getExtensibilityElements(), SOAP12Binding.class);
if (bindings.size() == 0) {
return null;
} else if (bindings.size() > 1) {
// exception if multiple bindings found
throw new IllegalArgumentException("Multiple bindings: " + binding.getQName());
} else {
// retrieve the single element
return (ExtensibilityElement) bindings.iterator().next();
}
}
示例12: getBinding
import javax.wsdl.Binding; //导入依赖的package包/类
public Binding getBinding() throws FaultException {
Service serviceDef = hiWSDL.getService(serviceName);
if (serviceDef == null) {
throw new FaultException(BPEL4PeopleConstants.B4P_FAULT,
"Service definition is not available for service " + serviceName);
}
Port port = serviceDef.getPort(getServicePort());
if (port == null) {
throw new FaultException(BPEL4PeopleConstants.B4P_FAULT,
"Service port is not available for service " + serviceName + " and port " +
getServicePort());
}
Binding binding = port.getBinding();
if (binding == null) {
throw new FaultException(BPEL4PeopleConstants.B4P_FAULT,
"Service binding is not available for service " + serviceName + " and port " +
getServicePort());
}
return binding;
}
示例13: getSoapFactory
import javax.wsdl.Binding; //导入依赖的package包/类
public SOAPFactory getSoapFactory() throws FaultException {
Binding binding = getBinding();
ExtensibilityElement bindingType = SOAPHelper.getBindingExtension(binding);
if (!(bindingType instanceof SOAPBinding || bindingType instanceof SOAP12Binding ||
bindingType instanceof HTTPBinding)) {
throw new FaultException(BPEL4PeopleConstants.B4P_FAULT,
"Service binding is not supported for service " + serviceName + " and port " +
getServicePort());
}
if (bindingType instanceof SOAPBinding) {
return OMAbstractFactory.getSOAP11Factory();
} else {
return OMAbstractFactory.getSOAP12Factory();
}
}
示例14: testHelloWorld_UDDIBindingModel
import javax.wsdl.Binding; //导入依赖的package包/类
@Test
public void testHelloWorld_UDDIBindingModel() throws WSDLException, JAXBException, Exception {
// Reading the WSDL
Definition wsdlDefinition = rw.readWSDL("bpel/HelloWorld.wsdl");
@SuppressWarnings("unchecked")
Map<QName,Binding> bindings = (Map<QName,Binding>) wsdlDefinition.getAllBindings();
Set<TModel> bindingTModels = bpel2UDDI.createWSDLBindingTModels(wsdlDefinition.getDocumentBaseURI(), bindings);
for (TModel tModel : bindingTModels) {
System.out.println("***** UDDI Binding TModel: " + tModel.getName().getValue());
if (serialize)
System.out.println(pTModel.print(tModel));
}
Assert.assertEquals(1,bindingTModels.size());
}
示例15: testWSDLBindingModel
import javax.wsdl.Binding; //导入依赖的package包/类
@Test
public void testWSDLBindingModel() throws WSDLException, JAXBException, ConfigurationException, Exception {
// Reading the WSDL
Definition wsdlDefinition = rw.readWSDL("wsdl/HelloWorld.wsdl");
String wsdlURL = wsdlDefinition.getDocumentBaseURI();
Properties properties = new Properties();
properties.put("keyDomain", "juddi.apache.org");
WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
Set<TModel> tModels = new HashSet<TModel>();
@SuppressWarnings("unchecked")
Map<QName,Binding> bindings= (Map<QName,Binding>) wsdlDefinition.getAllBindings();
Set<TModel> bindingTModels = wsdl2UDDI.createWSDLBindingTModels(wsdlURL, bindings);
tModels.addAll(bindingTModels);
for (TModel tModel : tModels) {
System.out.println("UDDI Binding TModel " + tModel.getName().getValue());
if (serialize)
System.out.println(pTModel.print(tModel));
}
Assert.assertEquals(1,tModels.size());
}