SOAPFactory (Java EE 5)

Java EE API


javax.xml.soap Class SOAPFactory

java.lang.Object
  extended by javax.xml.soap.SOAPFactory

public abstract class SOAPFactory
extends Object


SOAPFactory 是用来创建存在于 SOAP XML 树中的各种对象的工厂。SOAPFactory 可以用于创建最终成为 SOAP 部分的 XML 片段。这些片段可以作为 SOAPHeaderElementSOAPBodyElementSOAPEnvelope 或其他 SOAPElement 对象的子级插入。SOAPFactory 还具有创建 javax.xml.soap.Detail 对象以及 java.xml.soap.Name 对象的方法。
英文文档:

SOAPFactory is a factory for creating various objects that exist in the SOAP XML tree. SOAPFactory can be used to create XML fragments that will eventually end up in the SOAP part. These fragments can be inserted as children of the SOAPHeaderElement or SOAPBodyElement or SOAPEnvelope or other SOAPElement objects. SOAPFactory also has methods to create javax.xml.soap.Detail objects as well as java.xml.soap.Name objects.


Constructor Summary
 
Method Summary
abstract  Detail
 SOAPElement
abstract  SOAPElement
 SOAPElement
abstract  SOAPElement
abstract  SOAPElement
abstract  SOAPFault
abstract  SOAPFault
abstract  Name
abstract  Name
static SOAPFactory
static SOAPFactory
 
Methods inherited from class java.lang.Object
 

Constructor Detail

public SOAPFactory()
英文文档:

SOAPFactory

public SOAPFactory()
Method Detail

public SOAPElement createElement(org.w3c.dom.Element domElement) throws SOAPException
根据现有的 DOM Element 创建 SOAPElement 对象。如果作为参数传入的 DOM Element 已经是一个 SOAPElement,那么此方法必须不作任何修改地返回该参数。否则,会创建新的 SOAPElement 并进行此 domElement 参数的深层复制。返回值的具体类型将取决于 domElement 参数的名称。如果以 domElement 为根的树的任何部分违背了 SOAP 规则,则会抛出 SOAPException
domElement 要复制的 Element
return 一个新的 SOAPElement,它是 domElement 的副本。
ThrowsSOAPException: 如果在创建 SOAPElement 对象时存在错误
sinceSAAJ 1.3
英文文档:

createElement

public SOAPElement createElement(Element domElement)
                          throws SOAPException
Creates a SOAPElement object from an existing DOM Element. If the DOM Element that is passed in as an argument is already a SOAPElement then this method must return it unmodified without any further work. Otherwise, a new SOAPElement is created and a deep copy is made of the domElement argument. The concrete type of the return value will depend on the name of the domElement argument. If any part of the tree rooted in domElement violates SOAP rules, a SOAPException will be thrown.

Parameters:
domElement - - the Element to be copied.
Returns:
a new SOAPElement that is a copy of domElement.
Throws:
SOAPException - if there is an error in creating the SOAPElement object
Since:
SAAJ 1.3

abstract public SOAPElement createElement(Name name) throws SOAPException
创建使用给定 Name 对象初始化的 SOAPElement 对象。返回值的具体类型将取决于提供给新 SOAPElement 的名称。例如,一个带有名称 "{http://www.w3.org/2003/05/soap-envelope}Envelope" 的新 SOAPElement 会导致创建支持 SOAP 1.2 行为的 SOAPEnvelope
name 带有新元素 XML 名称的 Name 对象
return 创建的新 SOAPElement 对象
ThrowsSOAPException: 如果在创建 SOAPElement 对象时存在错误
See also createElement(javax.xml.namespace.QName)
英文文档:

createElement

public abstract SOAPElement createElement(Name name)
                                   throws SOAPException
Creates a SOAPElement object initialized with the given Name object. The concrete type of the return value will depend on the name given to the new SOAPElement. For instance, a new SOAPElement with the name "{http://www.w3.org/2003/05/soap-envelope}Envelope" would cause a SOAPEnvelope that supports SOAP 1.2 behavior to be created.

Parameters:
name - a Name object with the XML name for the new element
Returns:
the new SOAPElement object that was created
Throws:
SOAPException - if there is an error in creating the SOAPElement object
See Also:
createElement(javax.xml.namespace.QName)

public SOAPElement createElement(javax.xml.namespace.QName qname) throws SOAPException
创建使用给定 QName 对象初始化的 SOAPElement 对象。返回值的具体类型将取决于提供给新 SOAPElement 的名称。例如,一个带有名称 "{http://www.w3.org/2003/05/soap-envelope}Envelope" 的新 SOAPElement 会导致创建支持 SOAP 1.2 行为的 SOAPEnvelope
qname 带有新元素 XML 名称的 QName 对象
return 创建的新 SOAPElement 对象
ThrowsSOAPException: 如果在创建 SOAPElement 对象时存在错误
sinceSAAJ 1.3
See also createElement(Name)
英文文档:

createElement

public SOAPElement createElement(QName qname)
                          throws SOAPException
Creates a SOAPElement object initialized with the given QName object. The concrete type of the return value will depend on the name given to the new SOAPElement. For instance, a new SOAPElement with the name "{http://www.w3.org/2003/05/soap-envelope}Envelope" would cause a SOAPEnvelope that supports SOAP 1.2 behavior to be created.

Parameters:
qname - a QName object with the XML name for the new element
Returns:
the new SOAPElement object that was created
Throws:
SOAPException - if there is an error in creating the SOAPElement object
Since:
SAAJ 1.3
See Also:
createElement(Name)

abstract public SOAPElement createElement(String localName) throws SOAPException
创建使用给定本地名称初始化的 SOAPElement 对象。
localName 给出新元素本地名称的 String
return 创建的新 SOAPElement 对象
ThrowsSOAPException: 如果在创建 SOAPElement 对象时存在错误
英文文档:

createElement

public abstract SOAPElement createElement(String localName)
                                   throws SOAPException
Creates a SOAPElement object initialized with the given local name.

Parameters:
localName - a String giving the local name for the new element
Returns:
the new SOAPElement object that was created
Throws:
SOAPException - if there is an error in creating the SOAPElement object

abstract public SOAPElement createElement(String localName, String prefix, String uri) throws SOAPException
使用本地名称、前缀和 URI 创建新的 SOAPElement 对象。返回值的具体类型将取决于提供给新 SOAPElement 的名称。例如,一个带有名称 "{http://www.w3.org/2003/05/soap-envelope}Envelope" 的新 SOAPElement 会导致创建支持 SOAP 1.2 行为的 SOAPEnvelope
localName 给出新元素本地名称的 String
prefixSOAPElement 的前缀
uri 给出新元素所属命名空间 URI 的 String
ThrowsSOAPException: 如果在创建 SOAPElement 对象时存在错误
英文文档:

createElement

public abstract SOAPElement createElement(String localName,
                                          String prefix,
                                          String uri)
                                   throws SOAPException
Creates a new SOAPElement object with the given local name, prefix and uri. The concrete type of the return value will depend on the name given to the new SOAPElement. For instance, a new SOAPElement with the name "{http://www.w3.org/2003/05/soap-envelope}Envelope" would cause a SOAPEnvelope that supports SOAP 1.2 behavior to be created.

Parameters:
localName - a String giving the local name for the new element
prefix - the prefix for this SOAPElement
uri - a String giving the URI of the namespace to which the new element belongs
Throws:
SOAPException - if there is an error in creating the SOAPElement object

abstract public Detail createDetail() throws SOAPException
创建充当 DetailEntry 对象容器的新 Detail 对象。

此工厂方法创建 Detail 对象,用于不可能使用 SOAPFault 抽象的情况。

return 一个 Detail 对象
ThrowsSOAPException: 如果存在 SOAP 错误
ThrowsUnsupportedOperationException: 如果为 SOAPFactory 指定的协议是 DYNAMIC_SOAP_PROTOCOL

英文文档:

createDetail

public abstract Detail createDetail()
                             throws SOAPException
Creates a new Detail object which serves as a container for DetailEntry objects.

This factory method creates Detail objects for use in situations where it is not practical to use the SOAPFault abstraction.

Returns:
a Detail object
Throws:
SOAPException - if there is a SOAP error
UnsupportedOperationException - if the protocol specified for the SOAPFactory was DYNAMIC_SOAP_PROTOCOL

abstract public SOAPFault createFault(String reasonText, javax.xml.namespace.QName faultCode) throws SOAPException
创建使用给定 reasonTextfaultCode 初始化的新 SOAPFault 对象
reasonText 错误的 ReasonText/FaultString
faultCode 错误的 FaultCode
return 一个 SOAPFault 对象
ThrowsSOAPException: 如果存在 SOAP 错误
sinceSAAJ 1.3
英文文档:

createFault

public abstract SOAPFault createFault(String reasonText,
                                      QName faultCode)
                               throws SOAPException
Creates a new SOAPFault object initialized with the given reasonText and faultCode

Parameters:
reasonText - the ReasonText/FaultString for the fault
faultCode - the FaultCode for the fault
Returns:
a SOAPFault object
Throws:
SOAPException - if there is a SOAP error
Since:
SAAJ 1.3

abstract public SOAPFault createFault() throws SOAPException
创建一个新的默认 SOAPFault 对象
return 一个 SOAPFault 对象
ThrowsSOAPException: 如果存在 SOAP 错误
sinceSAAJ 1.3
英文文档:

createFault

public abstract SOAPFault createFault()
                               throws SOAPException
Creates a new default SOAPFault object

Returns:
a SOAPFault object
Throws:
SOAPException - if there is a SOAP error
Since:
SAAJ 1.3

abstract public Name createName(String localName, String prefix, String uri) throws SOAPException
创建使用给定本地名称、名称空间前缀和名称空间 URI 初始化的新 Name 对象。

此工厂方法创建 Name 对象,用于不可能使用 SOAPEnvelope 抽象的情况。

localName 给出本地名称的 String
prefix 给出名称空间前缀的 String
uri 给出名称空间 URI 的 String
return 使用给定本地名称、名称空间前缀和名称空间 URI 初始化的 Name 对象
ThrowsSOAPException: 如果存在 SOAP 错误

英文文档:

createName

public abstract Name createName(String localName,
                                String prefix,
                                String uri)
                         throws SOAPException
Creates a new Name object initialized with the given local name, namespace prefix, and namespace URI.

This factory method creates Name objects for use in situations where it is not practical to use the SOAPEnvelope abstraction.

Parameters:
localName - a String giving the local name
prefix - a String giving the prefix of the namespace
uri - a String giving the URI of the namespace
Returns:
a Name object initialized with the given local name, namespace prefix, and namespace URI
Throws:
SOAPException - if there is a SOAP error

abstract public Name createName(String localName) throws SOAPException
创建使用给定本地名称初始化的新 Name 对象。

此工厂方法创建 Name 对象,用于不可能使用 SOAPEnvelope 抽象的情况。

localName 给出本地名称的 String
return 使用给定本地名称初始化的 Name 对象
ThrowsSOAPException: 如果存在 SOAP 错误

英文文档:

createName

public abstract Name createName(String localName)
                         throws SOAPException
Creates a new Name object initialized with the given local name.

This factory method creates Name objects for use in situations where it is not practical to use the SOAPEnvelope abstraction.

Parameters:
localName - a String giving the local name
Returns:
a Name object initialized with the given local name
Throws:
SOAPException - if there is a SOAP error

public static SOAPFactory newInstance() throws SOAPException
创建新的 SOAPFactory 对象,该对象是默认实现 (SOAP 1.1) 的实例。 此方法使用以下查找过程顺序来确定要加载的 SOAPFactory 实现类:
  • 使用 javax.xml.soap.SOAPFactory 系统属性。
  • 使用 JRE 文件夹中的属性文件 "lib/jaxm.properties"。此配置文件格式是标准的 java.util.Properties 格式且包含实现类的完全限定名,其中实现类的键是上文定义的系统属性。
  • 如果 Services API(在 JAR 规范中进行了详细描述)可用,可以使用它来确定类名称。Services API 将查找在运行时可用的 jar 中 META-INF/services/javax.xml.soap.SOAPFactory 文件中的类名称。
  • 使用 SAAJMetaFactory 实例来定位 SOAPFactory 实现类。
return 新的 SOAPFactory 实例
ThrowsSOAPException: 如果在创建默认 SOAPFactory 时出现错误
See also javax.xml.soap.SAAJMetaFactory
英文文档:

newInstance

public static SOAPFactory newInstance()
                               throws SOAPException
Creates a new SOAPFactory object that is an instance of the default implementation (SOAP 1.1), This method uses the following ordered lookup procedure to determine the SOAPFactory implementation class to load:
  • Use the javax.xml.soap.SOAPFactory system property.
  • Use the properties file "lib/jaxm.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above.
  • Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.soap.SOAPFactory in jars available to the runtime.
  • Use the SAAJMetaFactory instance to locate the SOAPFactory implementation class.

Returns:
a new instance of a SOAPFactory
Throws:
SOAPException - if there was an error creating the default SOAPFactory
See Also:
SAAJMetaFactory

public static SOAPFactory newInstance(String protocol) throws SOAPException
创建新的 SOAPFactory 对象,该对象是指定实现的实例,此方法使用 SAAJMetaFactory 来定位实现类并创建 SOAPFactory 实例。
return 新的 SOAPFactory 实例
protocol 字符串常量,表示指定 SOAP 工厂实现的协议。可以是 DYNAMIC_SOAP_PROTOCOLDEFAULT_SOAP_PROTOCOL(等同于 SOAP_1_1_PROTOCOL)或 SOAP_1_2_PROTOCOL
ThrowsSOAPException: 如果在创建指定 SOAPFactory 时出现错误
sinceSAAJ 1.3
See also javax.xml.soap.SAAJMetaFactory
英文文档:

newInstance

public static SOAPFactory newInstance(String protocol)
                               throws SOAPException
Creates a new SOAPFactory object that is an instance of the specified implementation, this method uses the SAAJMetaFactory to locate the implementation class and create the SOAPFactory instance.

Parameters:
protocol - a string constant representing the protocol of the specified SOAP factory implementation. May be either DYNAMIC_SOAP_PROTOCOL, DEFAULT_SOAP_PROTOCOL (which is the same as) SOAP_1_1_PROTOCOL, or SOAP_1_2_PROTOCOL.
Returns:
a new instance of a SOAPFactory
Throws:
SOAPException - if there was an error creating the specified SOAPFactory
Since:
SAAJ 1.3
See Also:
SAAJMetaFactory


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!