本文整理汇总了Java中javax.wsdl.extensions.soap.SOAPAddress类的典型用法代码示例。如果您正苦于以下问题:Java SOAPAddress类的具体用法?Java SOAPAddress怎么用?Java SOAPAddress使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SOAPAddress类属于javax.wsdl.extensions.soap包,在下文中一共展示了SOAPAddress类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectPort
import javax.wsdl.extensions.soap.SOAPAddress; //导入依赖的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: importService
import javax.wsdl.extensions.soap.SOAPAddress; //导入依赖的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;
}
示例3: createService
import javax.wsdl.extensions.soap.SOAPAddress; //导入依赖的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;
}
示例4: testEJB3Endpoint
import javax.wsdl.extensions.soap.SOAPAddress; //导入依赖的package包/类
@Test
@RunAsClient
public void testEJB3Endpoint() throws Exception
{
String soapAddress = "http://" + baseURL.getHost() + ":" + baseURL.getPort() + "/earejb3/EndpointService/Endpoint";
QName serviceName = new QName("http://eardeployment.jaxws/", "EndpointService");
Service service = Service.create(new URL(soapAddress + "?wsdl"), serviceName);
Endpoint port = service.getPort(Endpoint.class);
//check soap address rewrite to verify jboss-webservices.xml override
Definition wsdl = getWSDLDefinition(soapAddress + "?wsdl");
SOAPAddress sa = (SOAPAddress)wsdl.getService(serviceName).getPort("EndpointPort").getExtensibilityElements().iterator().next();
assertEquals("https://foo-jar:" + JBossWSTestHelper.getSecureServerPort(null, null) + "/earejb3/EndpointService/Endpoint", sa.getLocationURI());
BindingProvider bp = (BindingProvider)port;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, soapAddress);
String helloWorld = "Hello world!";
String retObj = port.echo(helloWorld);
assertEquals(helloWorld, retObj);
}
示例5: testJSEEndpoint
import javax.wsdl.extensions.soap.SOAPAddress; //导入依赖的package包/类
@Test
@RunAsClient
public void testJSEEndpoint() throws Exception
{
String soapAddress = baseURL + "JSEBean";
QName serviceName = new QName("http://eardeployment.jaxws/", "EndpointService");
Service service = Service.create(new URL(soapAddress + "?wsdl"), serviceName);
Endpoint port = service.getPort(Endpoint.class);
//check soap address rewrite to verify jboss-webservices.xml override
Definition wsdl = getWSDLDefinition(soapAddress + "?wsdl");
SOAPAddress sa = (SOAPAddress)wsdl.getService(serviceName).getPort("EndpointPort").getExtensibilityElements().iterator().next();
assertEquals("https://foo-test:" + JBossWSTestHelper.getSecureServerPort(null, null) + "/earjse2/JSEBean", sa.getLocationURI());
BindingProvider bp = (BindingProvider)port;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, soapAddress);
String helloWorld = "Hello world!";
String retObj = port.echo(helloWorld);
assertEquals(helloWorld, retObj);
}
示例6: importService
import javax.wsdl.extensions.soap.SOAPAddress; //导入依赖的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;
}
示例7: getSoapPort
import javax.wsdl.extensions.soap.SOAPAddress; //导入依赖的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");
}
示例8: filterWSDL
import javax.wsdl.extensions.soap.SOAPAddress; //导入依赖的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);
}
}
}
}
}
}
示例9: getEPRfromWSDL
import javax.wsdl.extensions.soap.SOAPAddress; //导入依赖的package包/类
/**
* Get the EPR of this service from the WSDL.
*
* @param wsdlDef WSDL Definition
* @param serviceName service name
* @param portName port name
* @return XML representation of the EPR
*/
public static String getEPRfromWSDL(
final Definition wsdlDef,
final QName serviceName,
final String portName) {
Service serviceDef = wsdlDef.getService(serviceName);
if (serviceDef != null) {
Port portDef = serviceDef.getPort(portName);
if (portDef != null) {
for (Object extElmt : portDef.getExtensibilityElements()) {
if (extElmt instanceof SOAPAddress) {
return ((SOAPAddress) extElmt).getLocationURI();
} else if (extElmt instanceof HTTPAddress) {
return ((HTTPAddress) extElmt).getLocationURI();
} else if (extElmt instanceof SOAP12Address) {
return ((SOAP12Address) extElmt).getLocationURI();
}
}
}
}
return null;
}
示例10: getBindingURL
import javax.wsdl.extensions.soap.SOAPAddress; //导入依赖的package包/类
/**
* Obtains the accessUrl from the WSDL
*
* @param port
* @return a string url
* @throws MalformedURLException
*/
private String getBindingURL(Port port) throws MalformedURLException {
String bindingUrl = null;
for (Object element : port.getExtensibilityElements()) {
if (element instanceof SOAPAddress) {
SOAPAddress address = (SOAPAddress) element;
URL locationURI = new URL(address.getLocationURI());
if (locationURI != null) {
bindingUrl = urlLocalizer.rewrite(locationURI);
break;
}
}
}
return bindingUrl;
}
示例11: generateService
import javax.wsdl.extensions.soap.SOAPAddress; //导入依赖的package包/类
private void generateService()
throws SchemaGenerationException {
// now add the binding portType and messages corresponding to every operation
javax.wsdl.Service service = this.wsdlDefinition.createService();
service.setQName(new QName(this.service.getNamespace(), this.service.getName()));
Port port = this.wsdlDefinition.createPort();
port.setName(this.service.getName() + "HttpSoapPort");
port.setBinding(this.httpSoapBinding);
ExtensionRegistry extensionRegistry = null;
try {
extensionRegistry = WSDLFactory.newInstance().newPopulatedExtensionRegistry();
SOAPAddress soapAddress = (SOAPAddress) extensionRegistry.createExtension(
Port.class, new QName("http://schemas.xmlsoap.org/wsdl/soap/", "address"));
soapAddress.setLocationURI("http://localhost:8080/axis2/services/" + this.service.getName());
port.addExtensibilityElement(soapAddress);
} catch (WSDLException e) {
throw new SchemaGenerationException("Can not crete a wsdl factory");
}
service.addPort(port);
this.wsdlDefinition.addService(service);
}
示例12: getSOAPLocation
import javax.wsdl.extensions.soap.SOAPAddress; //导入依赖的package包/类
/**
* @param port analyzed port
* @return Returns the endpoint URL of the given Port
*/
private String getSOAPLocation(Port port) {
String endpoint = null;
@SuppressWarnings("unchecked") // Can't change the API
List<ExtensibilityElement> extensions = port.getExtensibilityElements();
for (Iterator<ExtensibilityElement> i = extensions.iterator();
i.hasNext();) {
ExtensibilityElement ext = i.next();
if (ext instanceof SOAPAddress) {
SOAPAddress addr = (SOAPAddress) ext;
endpoint = addr.getLocationURI();
}
}
return endpoint;
}
示例13: getSOAPLocation
import javax.wsdl.extensions.soap.SOAPAddress; //导入依赖的package包/类
/**
* @param port analyzed port
* @return Returns the endpoint URL of the given Port
*/
private String getSOAPLocation(Port port) {
String endpoint = null;
List extensions = port.getExtensibilityElements();
for (Iterator i = extensions.iterator(); i.hasNext();) {
ExtensibilityElement ext = (ExtensibilityElement) i.next();
if (ext instanceof SOAPAddress) {
SOAPAddress addr = (SOAPAddress) ext;
endpoint = addr.getLocationURI();
}
}
return endpoint;
}
示例14: getEndpointAddress
import javax.wsdl.extensions.soap.SOAPAddress; //导入依赖的package包/类
/**
* Get the SOAP Binding Id for the specified {@link Port}.
*
* @param port The WSDL port.
* @return The endpoint address.
*/
public static String getEndpointAddress(Port port) {
String address = null;
List<ExtensibilityElement> extElements = port.getExtensibilityElements();
for (ExtensibilityElement extElement : extElements) {
if (extElement instanceof SOAPAddress) {
address = ((SOAPAddress)extElement).getLocationURI();
break;
} else if (extElement instanceof SOAP12Address) {
address = ((SOAP12Address)extElement).getLocationURI();
break;
}
}
return address;
}
示例15: getPortAddress
import javax.wsdl.extensions.soap.SOAPAddress; //导入依赖的package包/类
public static String getPortAddress(final Port port) {
final Collection<?> extensibilityElements = port.getExtensibilityElements();
SOAPAddress soapAddress = findExtensibilityElement(extensibilityElements, SOAPAddress.class);
if (null != soapAddress) {
return soapAddress.getLocationURI();
}
SOAP12Address soap12Address = findExtensibilityElement(extensibilityElements, SOAP12Address.class);
if (null != soap12Address) {
return soap12Address.getLocationURI();
}
return null;
}