當前位置: 首頁>>代碼示例>>Java>>正文


Java SOAPFault.getFaultString方法代碼示例

本文整理匯總了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);
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:SOAP12Fault.java

示例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());
    }
}
 
開發者ID:booleguo,項目名稱:sam-elle,代碼行數:27,代碼來源:GetTerminalsByMsisdnClient.java

示例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);
}
 
開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:27,代碼來源:WebMethodTestCase.java

示例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;
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:25,代碼來源:AddNumbersProtocolHandler.java

示例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);
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:14,代碼來源:SOAP11Fault.java

示例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());
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:31,代碼來源:JRXmlaQueryExecuter.java

示例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);
}
 
開發者ID:jenkinsci,項目名稱:fortify-cloudscan-plugin,代碼行數:21,代碼來源:FortifySscClient.java

示例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());
}
 
開發者ID:JockiHendry,項目名稱:ireport-fork,代碼行數:31,代碼來源:OLAPQueryExecuter.java

示例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");
    }
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:14,代碼來源:SOAPFaultTest.java

示例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;
}
 
開發者ID:apache,項目名稱:juddi-scout,代碼行數:34,代碼來源:SaajTransport.java

示例11: dealSoapFault

import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
protected void dealSoapFault(SOAPFault soapFault) throws SOAPException {
	throw new SOAPException(soapFault.getFaultString());
}
 
開發者ID:javen-hao,項目名稱:osmp,代碼行數:4,代碼來源:SOAPClientServiceImpl.java

示例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;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:10,代碼來源:SOAPFaultException.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:SOAPFaultException.java


注:本文中的javax.xml.soap.SOAPFault.getFaultString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。