📄 service.java
字号:
* instance. * * NOTE: This Service currently does not support the configuration * of a HandlerRegistry! It will throw a * java.lang.UnsupportedOperationException. * * @return HandlerRegistry * @throws java.lang.UnsupportedOperationException - if the Service * class does not support the configuration of a * HandlerRegistry. */ public HandlerRegistry getHandlerRegistry() { return registry; } /** * Returns the location of the WSDL document used to prefill the data * (if one was used at all). * * @return URL URL pointing to the WSDL doc */ public URL getWSDLDocumentLocation() { try { return new URL(wsdlLocation); } catch (MalformedURLException e) { return null; } } /** * Returns the qualified name of the service (if one is set). * * @return QName Fully qualified name of this service. */ public QName getServiceName() { if (serviceName != null) return serviceName; if (wsdlService == null) return (null); QName qn = wsdlService.getQName(); return (new QName(qn.getNamespaceURI(), qn.getLocalPart())); } /** * Returns an <code>Iterator</code> for the list of * <code>QName</code>s of service endpoints grouped by this * service * * @return Returns <code>java.util.Iterator</code> with elements * of type <code>javax.xml.namespace.QName</code> * @throws ServiceException If this Service class does not * have access to the required WSDL metadata */ public Iterator getPorts() throws ServiceException { if (wsdlService == null) throw new ServiceException(Messages.getMessage("wsdlMissing00")); if (wsdlService.getPorts() == null) { // Return an empty iterator; return new Vector().iterator(); } Map portmap = wsdlService.getPorts(); List portlist = new java.util.ArrayList(portmap.size()); // we could simply iterate over keys instead and skip // the lookup, but while keys are probably the same as // port names, the documentation does not make any // guarantee on this, so we'll just play it safe // Aaron Hamid Iterator portiterator = portmap.values().iterator(); while (portiterator.hasNext()) { Port port = (Port) portiterator.next(); // maybe we should use Definition.getTargetNamespace() here, // but this class does not hold a reference to the object, // so we'll just use the namespace of the service's QName // (it should all be the same wsdl targetnamespace value, right?) // Aaron Hamid portlist.add(new QName(wsdlService.getQName().getNamespaceURI(), port.getName())); } // ok, return the real list of QNames return portlist.iterator(); } /** * Defines the current Type Mappig Registry. * * @param registry The TypeMappingRegistry * @throws ServiceException if there's an error */ public void setTypeMappingRegistry(TypeMappingRegistry registry) throws ServiceException { } /** * Returns the current TypeMappingRegistry or null. * * @return TypeMappingRegistry The registry */ public TypeMappingRegistry getTypeMappingRegistry() { return (engine.getTypeMappingRegistry()); } /** * Returns a reference to this object. * * @return Reference ... */ public Reference getReference() { String classname = this.getClass().getName(); Reference reference = new Reference(classname, "org.apache.axis.client.ServiceFactory", null); StringRefAddr addr = null; if (!classname.equals("org.apache.axis.client.Service")) { // This is a generated derived class. Don't bother with // all the Service instance variables. addr = new StringRefAddr( ServiceFactory.SERVICE_CLASSNAME, classname); reference.add(addr); } else { if (wsdlLocation != null) { addr = new StringRefAddr( ServiceFactory.WSDL_LOCATION, wsdlLocation.toString()); reference.add(addr); } QName serviceName = getServiceName(); if (serviceName != null) { addr = new StringRefAddr(ServiceFactory.SERVICE_NAMESPACE, serviceName.getNamespaceURI()); reference.add(addr); addr = new StringRefAddr(ServiceFactory.SERVICE_LOCAL_PART, serviceName.getLocalPart()); reference.add(addr); } } if (maintainSession) { addr = new StringRefAddr(ServiceFactory.MAINTAIN_SESSION, "true"); reference.add(addr); } return reference; } /** * Sets this Service's AxisEngine. This engine will be shared by all * Call objects created from this Service object. * * Note: Not part of the JAX-RPC spec. * * @param engine Sets this Service's AxisEngine to the passed in one */ public void setEngine(AxisEngine engine) { this.engine = engine; } /** * Returns the current AxisEngine used by this Service and all of the * Call objects created from this Service object. * * Note: Not part of the JAX-RPC spec. * * @return AxisEngine the engine */ public AxisEngine getEngine() { return (engine); } /** * Set this Service's engine configuration. * * Note that since all of the constructors create the AxisClient right * now, this is basically a no-op. Putting it in now so that we can make * lazy engine instantiation work, and not have to duplicate every single * Service constructor with a EngineConfiguration argument. * <p> * If you need to use a non-default <code>EngineConfiguration</code>, do * the following before calling the Service constructor:<p><code> * * AxisProperties.setProperty(EngineConfigurationFactory.SYSTEM_PROPERTY_NAME, * "classname.of.new.EngineConfigurationFactory"); * </code><p> * Where the second parameter is the name of your new class that implements * <code>EngineConfigurationFactory</code> and a<code><br> * public static EngineConfigurationFactory newFactory(Object param) * </code> * method. See <code>EngineConfigurationFactoryDefault</code> for an example * of how to do this.<p> * * This way, when the Service class constructor calls<br><code> * * EngineConfigurationFactoryFinder.newFactory().getClientEngineConfig() * </code> * the getClientEngineConfig() of your own EngineConfigurationFactory will be * called, and your configuration will be used in the constructed Service object.<p> * * Another way is to use the "discovery" method of * <code>EngineConfigurationFactoryFinder</code>. * * @param config the EngineConfiguration we want to use. */ public void setEngineConfiguration(EngineConfiguration config) { this.config = config; } /** * Constructs a EngineConfig if one is not available. */ protected EngineConfiguration getEngineConfiguration() { if (this.config == null) { this.config = EngineConfigurationFactoryFinder.newFactory().getClientEngineConfig(); } return config; } /** * Determine whether we'd like to track sessions or not. * This information is passed to all Call objects created * from this service. Calling setMaintainSession will * only affect future instantiations of the Call object, * not those that already exist. * * Note: Not part of JAX-RPC specification. * * @param yesno true if session state is desired, false if not. */ public void setMaintainSession(boolean yesno) { maintainSession = yesno; } /** * If true, this service wants to track sessions. */ public boolean getMaintainSession() { return maintainSession; } /** * Returns last Call object associated with this service. Note that since * the Service is not thread-safe, you may not get the last call object * that you created on this thread. please use Stub._getCall * * @deprecated please use Stub._getCall */ public Call getCall() throws ServiceException { return _call; } /** * Tells whether or not we're caching WSDL */ public boolean getCacheWSDL() { return cachingWSDL; } /** * Allows users to turn caching of WSDL documents on or off. * Default is 'true' (on). */ public void setCacheWSDL(boolean flag) { cachingWSDL = flag; } protected static class HandlerRegistryImpl implements HandlerRegistry { Map map = new HashMap(); public List getHandlerChain(QName portName) { // namespace is not significant, so use local part directly String key = portName.getLocalPart(); List list = (List) map.get(key); if (list == null) { list = new java.util.ArrayList(); setHandlerChain(portName, list); } return list; } public void setHandlerChain(QName portName, List chain) { // namespace is not significant, so use local part directly map.put(portName.getLocalPart(), chain); } } /** * Register a Transport for a particular URL. */ void registerTransportForURL(URL url, Transport transport) { transportImpls.put(url.toString(), transport); } /** * Get any registered Transport object for a given URL. */ Transport getTransportForURL(URL url) { return (Transport) transportImpls.get(url.toString()); } /** * Set the typemapping version * @param version */ public void setTypeMappingVersion(String version) { ((TypeMappingRegistryImpl)getTypeMappingRegistry()).doRegisterFromVersion(version); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -