WebSphere Web Services Client for C++, Version 1.0.1 운영 체제: Linux, Windows

클라이언트 응용프로그램

웹 서비스 클라이언트 응용프로그램은 스텁에서 보내는 여러 유형의 결함을 발견하고 해당되면 내용을 디코딩합니다.

다음 예제는 클라이언트 응용프로그램이 예외를 발견하고 처리하는 방법을 보여줍니다.

// 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

이용약관 | 피드백

시간소인 아이콘마지막 갱신 날짜: 3 Mar 2006
http://publib.boulder.ibm.com/infocenter/dmndhelp/v6rxmx/index.jsp?topic=/com.ibm.websphere.wscc.doc.nl1\ref\wscc_rtrouble_exceptcliapp.html

(C) Copyright IBM Corporation 2005. All Rights Reserved.
이 information Center는 Eclipse 기술을 기반으로 합니다. (http://www.eclipse.org)