本文整理汇总了Java中javax.xml.soap.SOAPFault.getFaultString方法的典型用法代码示例。如果您正苦于以下问题:Java SOAPFault.getFaultString方法的具体用法?Java SOAPFault.getFaultString怎么用?Java SOAPFault.getFaultString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.soap.SOAPFault
的用法示例。
在下文中一共展示了SOAPFault.getFaultString方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SOAP12Fault
import javax.xml.soap.SOAPFault; //导入方法依赖的package包/类
SOAP12Fault(SOAPFault fault) {
code = new CodeType(fault.getFaultCodeAsQName());
try {
fillFaultSubCodes(fault);
} catch (SOAPException e) {
throw new WebServiceException(e);
}
reason = new ReasonType(fault.getFaultString());
role = fault.getFaultRole();
node = fault.getFaultNode();
if (fault.getDetail() != null) {
detail = new DetailType();
Iterator iter = fault.getDetail().getDetailEntries();
while(iter.hasNext()){
Element fd = (Element)iter.next();
detail.getDetails().add(fd);
}
}
}
示例2: callWebService
import javax.xml.soap.SOAPFault; //导入方法依赖的package包/类
public String callWebService(String msisdn) throws SOAPException, IOException, XWSSecurityException, GetTermalIccidException {
SOAPMessage request = createTerminalRequest(msisdn);
request = secureMessage(request);
// TODO
logger.info("Get Terminals by msisdn Request: ");
request.writeTo(System.out);
System.out.println("");
SOAPConnection connection = connectionFactory.createConnection();
SOAPMessage response = connection.call(request, url);
// TODO
logger.info("Get Terminals by msisdn Response: ");
response.writeTo(System.out);
System.out.println("");
if (!response.getSOAPBody().hasFault()) {
return writeTerminalResponse(response);
} else {
SOAPFault fault = response.getSOAPBody().getFault();
logger.error("Received SOAP Fault");
logger.error("SOAP Fault Code :" + fault.getFaultCode());
logger.error("SOAP Fault String :" + fault.getFaultString());
throw new GetTermalIccidException(fault.getFaultCode() + "," + fault.getFaultString());
}
}
示例3: testIllegalMessageAccess
import javax.xml.soap.SOAPFault; //导入方法依赖的package包/类
@Test
@RunAsClient
public void testIllegalMessageAccess() throws Exception
{
MessageFactory msgFactory = MessageFactory.newInstance();
SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
String reqEnv =
"<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
" <env:Header/>" +
" <env:Body>" +
" <ns1:noWebMethod xmlns:ns1='" + targetNS + "'>" +
" <String_1>Hello</String_1>" +
" </ns1:noWebMethod>" +
" </env:Body>" +
"</env:Envelope>";
SOAPMessage reqMsg = msgFactory.createMessage(null, new ByteArrayInputStream(reqEnv.getBytes()));
URL epURL = new URL(baseURL + "/TestService");
SOAPMessage resMsg = con.call(reqMsg, epURL);
SOAPFault soapFault = resMsg.getSOAPBody().getFault();
assertNotNull("Expected SOAPFault", soapFault);
String faultString = soapFault.getFaultString();
assertTrue(faultString, faultString.indexOf("noWebMethod") > 0);
}
示例4: handleFault
import javax.xml.soap.SOAPFault; //导入方法依赖的package包/类
public boolean handleFault(SOAPMessageContext messagecontext) {
tracker.handleFault((Boolean) messagecontext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY));
try {
SOAPFault fault = messagecontext.getMessage().getSOAPBody().getFault();
String faultString = fault.getFaultString();
Throwable webmethodException = (Throwable)
messagecontext.get("jaxws.outbound.response.webmethod.exception");
// Update the fault string with the stack trace
if (webmethodException != null) {
TestLogger.logger.debug("The webmethod exception is available...setting the fault string");
faultString += "stack = " + stackToString(webmethodException);
fault.setFaultString(faultString);
} else {
TestLogger.logger.debug("The webmethod exception was not available");
}
} catch (Exception e) {
tracker.log("Exception occurred:" + e.getMessage(),
(Boolean) messagecontext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY));
}
return true;
}
示例5: SOAP11Fault
import javax.xml.soap.SOAPFault; //导入方法依赖的package包/类
SOAP11Fault(SOAPFault fault) {
this.faultcode = fault.getFaultCodeAsQName();
this.faultstring = fault.getFaultString();
this.faultactor = fault.getFaultActor();
if (fault.getDetail() != null) {
detail = new DetailType();
Iterator iter = fault.getDetail().getDetailEntries();
while(iter.hasNext()){
Element fd = (Element)iter.next();
detail.getDetails().add(fd);
}
}
}
示例6: handleResultFault
import javax.xml.soap.SOAPFault; //导入方法依赖的package包/类
protected void handleResultFault(SOAPFault fault)
{
StringBuilder errorMsg = new StringBuilder();
errorMsg.append("XML/A fault: ");
String faultString = fault.getFaultString();
if (faultString != null)
{
errorMsg.append(faultString);
errorMsg.append("; ");
}
String faultActor = fault.getFaultActor();
if (faultActor != null)
{
errorMsg.append("Actor: ");
errorMsg.append(faultActor);
errorMsg.append("; ");
}
String faultCode = fault.getFaultCode();
if (faultCode != null)
{
errorMsg.append("Code: ");
errorMsg.append(faultCode);
errorMsg.append("; ");
}
throw new JRRuntimeException(errorMsg.toString());
}
示例7: parseMessage
import javax.xml.soap.SOAPFault; //导入方法依赖的package包/类
/**
* Parses a SOAP message using XMLBeans and casting the resulting XmlObject to
* the specified XmlObject implementation class.
* @param soapMessage The SOAP message to parse
* @param clazz The XmlObject class (in XMLBeans) for parsing and casting
* @return A parsed SOAP message as a XmlObject implementation
*/
public <T> T parseMessage(SOAPMessage soapMessage, Class<T> clazz)
throws SOAPException, XmlException, NoSuchFieldException, IllegalAccessException, FortifySscClientException {
XmlObject b = XmlObject.Factory.parse(soapMessage.getSOAPBody().getFirstChild());
Field typeField = clazz.getDeclaredField("type");
org.apache.xmlbeans.SchemaType schemaType = (org.apache.xmlbeans.SchemaType)typeField.get(null);
SOAPFault fault = soapMessage.getSOAPBody().getFault();
if (fault != null) {
throw new FortifySscClientException(fault.getFaultString());
}
XmlObject c = org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse(b.getDomNode(), schemaType, null);
return clazz.cast(c);
}
示例8: handleResultFault
import javax.xml.soap.SOAPFault; //导入方法依赖的package包/类
protected void handleResultFault(SOAPFault fault)
{
StringBuffer errorMsg = new StringBuffer();
errorMsg.append("XML/A fault: ");
String faultString = fault.getFaultString();
if (faultString != null)
{
errorMsg.append(faultString);
errorMsg.append("; ");
}
String faultActor = fault.getFaultActor();
if (faultActor != null)
{
errorMsg.append("Actor: ");
errorMsg.append(faultActor);
errorMsg.append("; ");
}
String faultCode = fault.getFaultCode();
if (faultCode != null)
{
errorMsg.append("Code: ");
errorMsg.append(faultCode);
errorMsg.append("; ");
}
throw new JRRuntimeException(errorMsg.toString());
}
示例9: testGetFaultString
import javax.xml.soap.SOAPFault; //导入方法依赖的package包/类
@Validated @Test
public void testGetFaultString() throws Exception {
SOAPMessage msg = MessageFactory.newInstance().createMessage();
SOAPFault sf = msg.getSOAPBody().addFault();
sf.setFaultString("1st Fault String");
sf.setFaultString("2nd Fault String");
String result = sf.getFaultString();
if (!result.equals("2nd Fault String")) {
fail("Fault String not properly set");
}
}
示例10: send
import javax.xml.soap.SOAPFault; //导入方法依赖的package包/类
public Element send(Element request, URI endpointURL) throws TransportException {
if (log.isDebugEnabled()) {
String requestMessage = XMLUtils.convertNodeToXMLString(request);
log.debug("Request message: %s\n%s" + endpointURL + ":" + requestMessage);
}
Element response = null;
try {
SOAPMessage message = this.createSOAPMessage(request);
//Make the SAAJ Call now
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = soapConnectionFactory.createConnection();
SOAPMessage soapResponse = connection.call(message, endpointURL.toURL());
SOAPBody soapBody = soapResponse.getSOAPBody();
boolean hasFault = soapBody.hasFault();
if (hasFault) {
SOAPFault soapFault = soapBody.getFault();
String faultStr = soapFault.getFaultCode() + "::" + soapFault.getFaultString();
throw new RegistryException(faultStr);
}
response = getFirstChildElement(soapBody);
} catch (Exception ex) {
log.error("Exception::" + ex.getMessage(), ex);
throw new TransportException(ex);
}
if (log.isDebugEnabled()) {
String responseMessage = XMLUtils.convertNodeToXMLString(response);
log.debug("Response message: %s" + responseMessage);
}
return response;
}
示例11: dealSoapFault
import javax.xml.soap.SOAPFault; //导入方法依赖的package包/类
protected void dealSoapFault(SOAPFault soapFault) throws SOAPException {
throw new SOAPException(soapFault.getFaultString());
}
示例12: SOAPFaultException
import javax.xml.soap.SOAPFault; //导入方法依赖的package包/类
/** Constructor for SOAPFaultException
* @param fault <code>SOAPFault</code> representing the fault
*
* @see javax.xml.soap.SOAPFactory#createFault
**/
public SOAPFaultException(SOAPFault fault) {
super(fault.getFaultString());
this.fault = fault;
}
示例13: SOAPFaultException
import javax.xml.soap.SOAPFault; //导入方法依赖的package包/类
/** Constructor for SOAPFaultException
* @param fault {@code SOAPFault} representing the fault
*
* @see javax.xml.soap.SOAPFactory#createFault
**/
public SOAPFaultException(SOAPFault fault) {
super(fault.getFaultString());
this.fault = fault;
}