本文整理汇总了Java中javax.wsdl.Port类的典型用法代码示例。如果您正苦于以下问题:Java Port类的具体用法?Java Port怎么用?Java Port使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Port类属于javax.wsdl包,在下文中一共展示了Port类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectPort
import javax.wsdl.Port; //导入依赖的package包/类
/**
* Method selectPort
*
* @param ports
* @param portName
*
* @return
*
* @throws Exception
*/
public Port selectPort(Map ports, String portName) throws Exception {
Iterator valueIterator = ports.keySet().iterator();
while (valueIterator.hasNext()) {
String name = (String) valueIterator.next();
if ((portName == null) || (portName.length() == 0)) {
Port port = (Port) ports.get(name);
List list = port.getExtensibilityElements();
for (int i = 0; (list != null) && (i < list.size()); i++) {
Object obj = list.get(i);
if (obj instanceof SOAPAddress) {
return port;
}
}
} else if ((name != null) && name.equals(portName)) {
return (Port) ports.get(name);
}
}
return null;
}
示例2: importServicesAndOperations
import javax.wsdl.Port; //导入依赖的package包/类
/**
* Imports services and operations from the WSDL definition
*/
protected void importServicesAndOperations(Definition definition) {
for (Object serviceObject : definition.getServices().values()) {
Service service = (Service) serviceObject;
WSService wsService = this.importService(service);
this.wsServices.put(this.namespace + wsService.getName(), wsService);
Port port = (Port) service.getPorts().values().iterator().next();
for (Object bindOperationObject : port.getBinding().getBindingOperations()) {
BindingOperation bindOperation = (BindingOperation) bindOperationObject;
WSOperation operation = this.processOperation(bindOperation.getOperation(), wsService);
wsService.addOperation(operation);
this.wsOperations.put(this.namespace + operation.getName(), operation);
}
}
}
示例3: importService
import javax.wsdl.Port; //导入依赖的package包/类
/**
* Imports the service from the WSDL service definition
*/
protected WSService importService(Service service) {
String name = service.getQName().getLocalPart();
Port port = (Port) service.getPorts().values().iterator().next();
String location = "";
List extensionElements = port.getExtensibilityElements();
for (Object extension : extensionElements) {
if (extension instanceof SOAPAddress) {
SOAPAddress address = (SOAPAddress) extension;
location = address.getLocationURI();
}
}
WSService wsService = new WSService(this.namespace + name, location, this.wsdlLocation);
return wsService;
}
示例4: getSoapActionForOperation
import javax.wsdl.Port; //导入依赖的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;
}
示例5: getWSDLPort
import javax.wsdl.Port; //导入依赖的package包/类
private Port getWSDLPort()
throws IOException
{
Port port = wsdlPort;
if ( port == null && hasParameter( "wsdl" ) && getParameterFirstValue( "wsdl" ).hasChildren( "port" ) ) {
String portName = getParameterFirstValue( "wsdl" ).getFirstChild( "port" ).strValue();
Definition definition = getWSDLDefinition();
if ( definition != null ) {
Map<QName, Service> services = definition.getServices();
Iterator<Entry<QName, Service>> it = services.entrySet().iterator();
while( port == null && it.hasNext() ) {
port = it.next().getValue().getPort( portName );
}
}
if ( port != null ) {
wsdlPort = port;
}
}
return port;
}
示例6: setOutputEncodingStyle
import javax.wsdl.Port; //导入依赖的package包/类
private void setOutputEncodingStyle( SOAPEnvelope soapEnvelope, String operationName )
throws IOException, SOAPException
{
Port port = getWSDLPort();
if ( port != null ) {
BindingOperation bindingOperation = port.getBinding().getBindingOperation( operationName, null, null );
if ( bindingOperation == null ) {
return;
}
BindingOutput output = bindingOperation.getBindingOutput();
if ( output == null ) {
return;
}
for( ExtensibilityElement element : (List<ExtensibilityElement>) output.getExtensibilityElements() ) {
if ( element instanceof javax.wsdl.extensions.soap.SOAPBody ) {
List<String> list = ((javax.wsdl.extensions.soap.SOAPBody) element).getEncodingStyles();
if ( list != null && list.isEmpty() == false ) {
soapEnvelope.setEncodingStyle( list.get( 0 ) );
soapEnvelope.addNamespaceDeclaration( "enc", list.get( 0 ) );
}
}
}
}
}
示例7: createService
import javax.wsdl.Port; //导入依赖的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;
}
示例8: testPolicyReference
import javax.wsdl.Port; //导入依赖的package包/类
@Test
@RunAsClient
public void testPolicyReference() throws Exception
{
Definition wsdl = getWSDLDefinition(wsdlFile.getAbsolutePath());
List<?> definitionExtElements = wsdl.getExtensibilityElements();
QName serviceQName = new QName("http://foobar.org/", "AddNumbersService");
Port wsdlPort = wsdl.getService(serviceQName).getPort("AddNumbersPort");
List<?> bindingExtElements = wsdlPort.getBinding().getExtensibilityElements();
Element policyElement = this.getRequiredElement(definitionExtElements, POLICY_QNAME);
Element policyReferenceElement = this.getRequiredElement(bindingExtElements, POLICY_REFERENCE_QNAME);
String wsuIdAttrValue = policyElement.getAttributeNS("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", "Id");
String uriAttrValue = policyReferenceElement.getAttribute("URI").substring(1);
assertEquals("WS Policy mapping error", wsuIdAttrValue, uriAttrValue);
Element addressingElement = DOMUtils.getFirstChildElement(policyElement, WSAM_ADDRESSING_QNAME);
assertNotNull("Addressing element not found", addressingElement);
String optionalAttributeValue = addressingElement.getAttributeNS("http://www.w3.org/ns/ws-policy", "Optional");
assertEquals("Addressing should be optional", "true", optionalAttributeValue);
Element nestedPolicyElement = DOMUtils.getFirstChildElement(addressingElement, POLICY_QNAME);
assertNotNull("Nested Policy element not found", nestedPolicyElement);
Element nonAnonymousResponsesElement = DOMUtils.getFirstChildElement(nestedPolicyElement, WSAM_NON_ANONYMOUS_RESPONSES_QNAME);
assertNotNull("NonAnonymousResponses element not found", nonAnonymousResponsesElement);
}
示例9: importServicesAndOperations
import javax.wsdl.Port; //导入依赖的package包/类
/**
* Imports services and operations from the WSDL definition
*/
private void importServicesAndOperations(Definition definition) {
for (Object serviceObject : definition.getServices().values()) {
Service service = (Service) serviceObject;
WSService wsService = this.importService(service);
this.wsServices.put(this.namespace + wsService.getName(), wsService);
Port port = (Port) service.getPorts().values().iterator().next();
for (Object bindOperationObject : port.getBinding().getBindingOperations()) {
BindingOperation bindOperation = (BindingOperation) bindOperationObject;
WSOperation operation = this.processOperation(bindOperation.getOperation(), wsService);
wsService.addOperation(operation);
this.wsOperations.put(this.namespace + operation.getName(), operation);
}
}
}
示例10: importService
import javax.wsdl.Port; //导入依赖的package包/类
/**
* Imports the service from the WSDL service definition
*/
private WSService importService(Service service) {
String name = service.getQName().getLocalPart();
Port port = (Port) service.getPorts().values().iterator().next();
String location = "";
List extensionElements = port.getExtensibilityElements();
for (Object extension : extensionElements) {
if (extension instanceof SOAPAddress) {
SOAPAddress address = (SOAPAddress) extension;
location = address.getLocationURI();
}
}
WSService wsService = new WSService(this.namespace + name, location, this.wsdlLocation);
return wsService;
}
示例11: _toDumpData
import javax.wsdl.Port; //导入依赖的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;
}
示例12: getSoapPort
import javax.wsdl.Port; //导入依赖的package包/类
public static Port getSoapPort(javax.wsdl.Service service) throws RPCException {
String name = null;
Port port = null;
List list = null;
Map ports = service.getPorts();
Iterator it;
Iterator<Port> itr = ports.values().iterator();
Object v;
while(itr.hasNext()) {
port = itr.next();
list=port.getExtensibilityElements();
if(list != null) {
it = list.iterator();
while(it.hasNext()) {
v=it.next();
if(v instanceof SOAPAddress) {
return port;
}
}
}
}
throw new RPCException("Can't locate port entry for service " + service.getQName().toString() + " WSDL");
}
示例13: getOperationStyle
import javax.wsdl.Port; //导入依赖的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;
}
示例14: getBindingOperations
import javax.wsdl.Port; //导入依赖的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;
}
示例15: filterWSDL
import javax.wsdl.Port; //导入依赖的package包/类
/**
* Filters the WSDL document.
*
* @param definition location pointing to a WSDL XML definition.
* @param propertyResolver the Property Resolver
*/
public static void filterWSDL(Definition definition, PropertyResolver propertyResolver) {
for (Object serviceObject : definition.getServices().values()) {
Service service = (Service) serviceObject;
for (Object portObject : service.getPorts().values()) {
Port port = (Port) portObject;
for (Object extObject : port.getExtensibilityElements()) {
if (extObject instanceof SOAPAddress) {
SOAPAddress address = (SOAPAddress) extObject;
String toReplace = Strings.replaceProperties(address.getLocationURI(), propertyResolver);
if (!toReplace.isEmpty() && !toReplace.equals(address.getLocationURI())) {
address.setLocationURI(toReplace);
}
}
}
}
}
}