WebSphere Web Services Client for C++, Version 1.0.1 オペレーティング・システム: Linux, Windows

クライアント・アプリケーション

Web サービス・クライアント・アプリケーション は、スタブによってスローされる可能性のある各種の障害をキャッチし、その内容を適切にデコードすることができます。

以下の例では、クライアント・アプリケーションが例外をキャッチし、処理する方法を示しています。

// Attempt to divide by zero.
try
{
// Create the Web Service with an endpoint URL.
MathOps ws( pszEndpoint);
// Call the div method with two parameters.
// This will attempt to divide 1 by 0.
int iResult = ws.div( 1, 0);
// Output the result of the division.
cout << "Result is " << iResult << endl;
}
catch( DivByZeroStruct& dbzs)
{
// Catch a divide by zero fault
// This is a user soap fault defined in the WSDL
cout << "DivByZeroStruct Fault: ¥""
<< dbzs.varString
<< "\", "
<< dbzs.varInt
<< ", "
<< dbzs.varFloat
<< endl;
}
catch( SpecialDetailStruct& sds)
{
// Catch a special detail fault
// This is a user soap fault defined in the WSDL
cout << "SpecialDetailStruct Fault: ¥""
<< sds.varString
<< "\""
<< endl;
}
catch( OutOfBoundStruct& oobs)
{
// Catch an out of bounds fault
// This is a user soap fault defined in the WSDL
cout << "OutOfBoundStruct Fault: ¥""
<< oobs.varString
<< "\", "
<< oobs.varInt
<< ", \""
<< oobs.specialDetail->varString
<< "\""
<< endl;
}
catch( SoapFaultException& sfe)
{
// Catch any other SOAP faults
cout << "SoapFaultException: " << sfe.getFaultCode() << " " << sfe.what() << endl;
}
catch( AxisException& e)
{
// Catch an AXIS exception
cout << "AxisException: " << e.getExceptionCode() << " " << e.what() << endl;
}
catch( exception& e)
{
// Catch a general exception
cout << "Unknown Exception: " << e.what() << endl;
}
catch( ...)
{
// Catch any other exception
cout << "Unspecified Exception: " << endl;
}

Reference topic

ご利用条件 | フィードバック (英語のみ)

Timestamp icon最終更新: 12 Jun 2006
(C) Copyright IBM Corporation 2005, 2006. All Rights Reserved.
このインフォメーション・センターでは Eclipse テクノロジーが採用されています。(http://www.eclipse.org)