本文整理汇总了Java中javax.xml.soap.SOAPFactory.newInstance方法的典型用法代码示例。如果您正苦于以下问题:Java SOAPFactory.newInstance方法的具体用法?Java SOAPFactory.newInstance怎么用?Java SOAPFactory.newInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.soap.SOAPFactory
的用法示例。
在下文中一共展示了SOAPFactory.newInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import javax.xml.soap.SOAPFactory; //导入方法依赖的package包/类
@Override
public DOMSource invoke(DOMSource request) {
try {
return invokeAllowingFaults(request);
} catch (FaultMessage faultMessage) {
try {
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault();
soapFault.setFaultCode(SOAP11_FAULTCODE_SERVER); // todo here is a constant until we have a mechanism to determine the correct value (client / server)
soapFault.setFaultString(faultMessage.getMessage());
Detail detail = soapFault.addDetail();
serializeFaultMessage(detail, faultMessage);
// fault actor?
// stack trace of the outer exception (FaultMessage) is unimportant, because it is always created at one place
// todo consider providing stack trace of the inner exception
//Detail detail = soapFault.addDetail();
//detail.setTextContent(getStackTraceAsString(faultMessage));
throw new SOAPFaultException(soapFault);
} catch (SOAPException e) {
throw new RuntimeException("SOAP Exception: " + e.getMessage(), e);
}
}
}
示例2: initialValue
import javax.xml.soap.SOAPFactory; //导入方法依赖的package包/类
@Override
protected SOAPFactory initialValue() {
try {
return SOAPFactory.newInstance();
} catch (SOAPException e) {
e.printStackTrace();
return null;
}
}
示例3: listenerCreated
import javax.xml.soap.SOAPFactory; //导入方法依赖的package包/类
/**
* Creates a new instance of MessageFactory.
*
* @throws RequestListenerException if unable to create MessageFactory.
* @see hk.hku.cecid.piazza.commons.servlet.RequestListener#listenerCreated()
*/
public void listenerCreated() throws RequestListenerException {
try {
msgFactory = MessageFactory.newInstance();
soapFactory = SOAPFactory.newInstance();
}
catch (Exception e) {
throw new RequestListenerException(
"Unable to create SOAP factories", e);
}
}
示例4: getSoapFactory
import javax.xml.soap.SOAPFactory; //导入方法依赖的package包/类
protected SOAPFactory getSoapFactory() throws SOAPException {
if (soapFactory == null) {
soapFactory = SOAPFactory.newInstance();
}
return soapFactory;
}
示例5: createSOAPFactory
import javax.xml.soap.SOAPFactory; //导入方法依赖的package包/类
/**
* Creates a new <code>SOAPFactory</code> object that is an instance of
* the specified implementation, this method uses the SAAJMetaFactory to
* locate the implementation class and create the SOAPFactory instance.
*
* @return a new instance of a <code>SOAPFactory</code>
*
* @param protocol a string constant representing the protocol of the
* specified SOAP factory implementation. May be
* either <code>DYNAMIC_SOAP_PROTOCOL</code>,
* <code>DEFAULT_SOAP_PROTOCOL</code> (which is the same
* as) <code>SOAP_1_1_PROTOCOL</code>, or
* <code>SOAP_1_2_PROTOCOL</code>.
*
* @exception SOAPException if there was an error creating the
* specified <code>SOAPFactory</code>
* @see SAAJMetaFactory
*/
public SOAPFactory createSOAPFactory(String protocol) throws SOAPException {
return SOAPFactory.newInstance(protocol);
}