📄 wsddservice.java
字号:
public void setStyle(Style style) { this.style = style; } /** * Get the service use - literal or encoded */ public Use getUse() { return use; } /** * Set the service use - literal or encoded */ public void setUse(Use use) { this.use = use; } /** * * @return XXX */ public WSDDFaultFlow[] getFaultFlows() { WSDDFaultFlow[] t = new WSDDFaultFlow[faultFlows.size()]; faultFlows.toArray(t); return t; } /** * Obtain the list of namespaces registered for this service * @return a Vector of namespaces (Strings) which should dispatch to * this service */ public Vector getNamespaces() { return namespaces; } /** * * @param name XXX * @return XXX */ public WSDDFaultFlow getFaultFlow(QName name) { WSDDFaultFlow[] t = getFaultFlows(); for (int n = 0; n < t.length; n++) { if (t[n].getQName().equals(name)) { return t[n]; } } return null; } /** * * @param registry XXX * @return XXX * @throws ConfigurationException XXX */ public Handler makeNewInstance(EngineConfiguration registry) throws ConfigurationException { if (cachedService != null) { return cachedService; } // Make sure tmr is initialized. initTMR(); Handler reqHandler = null; WSDDChain request = getRequestFlow(); if (request != null) { reqHandler = request.getInstance(registry); } Handler providerHandler = null; if (providerQName != null) { try { providerHandler = WSDDProvider.getInstance(providerQName, this, registry); } catch (Exception e) { throw new ConfigurationException(e); } if (providerHandler == null) throw new WSDDException( Messages.getMessage("couldntConstructProvider00")); } Handler respHandler = null; WSDDChain response = getResponseFlow(); if (response != null) { respHandler = response.getInstance(registry); } SOAPService service = new SOAPService(reqHandler, providerHandler, respHandler); service.setStyle(style); service.setUse(use); service.setServiceDescription(desc); service.setHighFidelityRecording(!streaming); service.setSendType(sendType); if ( getQName() != null ) service.setName(getQName().getLocalPart()); service.setOptions(getParametersTable()); service.setRoles(roles); service.setEngine(((WSDDDeployment)registry).getEngine()); if (use != Use.ENCODED) { // If not encoded, turn off multi-refs and prefer // not to sent xsi:type and xsi:nil service.setOption(AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE); service.setOption(AxisEngine.PROP_SEND_XSI, Boolean.FALSE); } // Set handlerInfoChain if (_wsddHIchain != null) { HandlerInfoChainFactory hiChainFactory = _wsddHIchain.getHandlerChainFactory(); service.setOption(Constants.ATTR_HANDLERINFOCHAIN, hiChainFactory); } AxisEngine.normaliseOptions(service); WSDDFaultFlow [] faultFlows = getFaultFlows(); if (faultFlows != null && faultFlows.length > 0) { FaultableHandler wrapper = new FaultableHandler(service); for (int i = 0; i < faultFlows.length; i++) { WSDDFaultFlow flow = faultFlows[i]; Handler faultHandler = flow.getInstance(registry); wrapper.setOption("fault-" + flow.getQName().getLocalPart(), faultHandler); } } try { service.getInitializedServiceDesc(MessageContext.getCurrentContext()); } catch (AxisFault axisFault) { throw new ConfigurationException(axisFault); } cachedService = service; return service; } public void deployTypeMapping(WSDDTypeMapping mapping) throws WSDDException { if (!typeMappings.contains(mapping)) { typeMappings.add(mapping); } if (tmr == null) { createTMR(); } try { // Get the encoding style from the mapping, if it isn't set // use the use of the service to map doc/lit or rpc/enc String encodingStyle = mapping.getEncodingStyle(); if (encodingStyle == null) { encodingStyle = use.getEncoding(); } TypeMapping tm = tmr.getOrMakeTypeMapping(encodingStyle); desc.setTypeMappingRegistry(tmr); desc.setTypeMapping(tm); SerializerFactory ser = null; DeserializerFactory deser = null; // Try to construct a serializerFactory by introspecting for the // following: // public static create(Class javaType, QName xmlType) // public <constructor>(Class javaType, QName xmlType) // public <constructor>() // // The BaseSerializerFactory createFactory() method is a utility // that does this for us. if (mapping.getSerializerName() != null && !mapping.getSerializerName().equals("")) { ser = BaseSerializerFactory.createFactory(mapping.getSerializer(), mapping.getLanguageSpecificType(), mapping.getQName()); } if (mapping instanceof WSDDArrayMapping && ser instanceof ArraySerializerFactory) { WSDDArrayMapping am = (WSDDArrayMapping) mapping; ArraySerializerFactory factory = (ArraySerializerFactory) ser; factory.setComponentType(am.getInnerType()); } if (mapping.getDeserializerName() != null && !mapping.getDeserializerName().equals("")) { deser = BaseDeserializerFactory.createFactory(mapping.getDeserializer(), mapping.getLanguageSpecificType(), mapping.getQName()); } tm.register( mapping.getLanguageSpecificType(), mapping.getQName(), ser, deser); } catch (ClassNotFoundException e) { log.error(Messages.getMessage("unabletoDeployTypemapping00", mapping.getQName().toString()), e); throw new WSDDNonFatalException(e); } catch (Exception e) { throw new WSDDException(e); } } /** * Write this element out to a SerializationContext */ public void writeToContext(SerializationContext context) throws IOException { AttributesImpl attrs = new AttributesImpl(); QName name = getQName(); if (name != null) { attrs.addAttribute("", ATTR_NAME, ATTR_NAME, "CDATA", context.qName2String(name)); } if (providerQName != null) { attrs.addAttribute("", ATTR_PROVIDER, ATTR_PROVIDER, "CDATA", context.qName2String(providerQName)); } if (style != Style.DEFAULT) { attrs.addAttribute("", ATTR_STYLE, ATTR_STYLE, "CDATA", style.getName()); } if (use != Use.DEFAULT) { attrs.addAttribute("", ATTR_USE, ATTR_USE, "CDATA", use.getName()); } if (streaming) { attrs.addAttribute("", ATTR_STREAMING, ATTR_STREAMING, "CDATA", "on"); } if (sendType != Attachments.SEND_TYPE_NOTSET) { attrs.addAttribute("", ATTR_ATTACHMENT_FORMAT, ATTR_ATTACHMENT_FORMAT, "CDATA", AttachmentsImpl.getSendTypeString(sendType)); } context.startElement(WSDDConstants.QNAME_SERVICE, attrs); if (desc.getWSDLFile() != null) { context.startElement(QNAME_WSDLFILE, null); context.writeSafeString(desc.getWSDLFile()); context.endElement(); } if (desc.getDocumentation() != null) { WSDDDocumentation documentation = new WSDDDocumentation(desc.getDocumentation()); documentation.writeToContext(context); } for (int i = 0; i < operations.size(); i++) { WSDDOperation operation = (WSDDOperation) operations.elementAt(i); operation.writeToContext(context); } writeFlowsToContext(context); writeParamsToContext(context); for (int i=0; i < typeMappings.size(); i++) { ((WSDDTypeMapping) typeMappings.elementAt(i)).writeToContext(context); } for (int i=0; i < namespaces.size(); i++ ) { context.startElement(QNAME_NAMESPACE, null); context.writeString((String)namespaces.get(i)); context.endElement(); } String endpointURL = desc.getEndpointURL(); if (endpointURL != null) { context.startElement(QNAME_ENDPOINTURL, null); context.writeSafeString(endpointURL); context.endElement(); } if (_wsddHIchain != null) { _wsddHIchain.writeToContext(context); } context.endElement(); } public void setCachedService(SOAPService service) { cachedService = service; } public Vector getTypeMappings() { return typeMappings; } public void setTypeMappings(Vector typeMappings) { this.typeMappings = typeMappings; } public void deployToRegistry(WSDDDeployment registry) { registry.addService(this); // Register the name of the service as a valid namespace, just for // backwards compatibility registry.registerNamespaceForService(getQName().getLocalPart(), this); for (int i = 0; i < namespaces.size(); i++) { String namespace = (String) namespaces.elementAt(i); registry.registerNamespaceForService(namespace, this); } super.deployToRegistry(registry); } public void removeNamespaceMappings(WSDDDeployment registry) { for (int i = 0; i < namespaces.size(); i++) { String namespace = (String) namespaces.elementAt(i); registry.removeNamespaceMapping(namespace); } registry.removeNamespaceMapping(getQName().getLocalPart()); } public TypeMapping getTypeMapping(String encodingStyle) { // If type mapping registry not initialized yet, return null. if (tmr == null) { return null; } return (TypeMapping) tmr.getOrMakeTypeMapping(encodingStyle); } public WSDDJAXRPCHandlerInfoChain getHandlerInfoChain() { return _wsddHIchain; } public void setHandlerInfoChain(WSDDJAXRPCHandlerInfoChain hichain) { _wsddHIchain = hichain; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -