import com.fujitsu.uji.soap.SOAPCallFactory;
import com.fujitsu.uji.soap.UjiServiceCall;
import com.fujitsu.uji.ext.UjiRemoteException;
import com.fujitsu.uji.ext.UjiTargetException;
import com.fujitsu.uji.soap.UjiSoapException;
public void someMethod(DispatchContext context, XMLDataBean dataBean) {
...
// CallFactoryの取得
SOAPCallFactory callFactory=(SOAPCallFactory)context.getCallFactory(CallFactory.SOAP);
// UjiServiceCallの取得
String url = new String("http://some.host/service");
UjiServiceCall call =callFactory.createUjiServiceCall(url,null, SOAPCallFactory.INTERSTAGE_JAXM);
// サービスの呼び出し
try {
XmlDataBean response=(XmlDataBean)call.invoke(dataBean,verb);
} catch(UjiSOAPException s_e) {
// Fault情報の処理
Fault f = s_e.getFault();
if(f.getFaultCode().equals("XXX")) {
// Faultコードに合わせた処理
...
} else {
// Faultコードに当てはまらない場合の処理
...
throw s_e;
} catch(UjiTargetException t_e) {
// Falut情報が無い場合の処理
...
throw t_e;
} catch(UjiRemoteException r_e) {
// UjiRemoteExceptionが発生した場合の処理
...
throw r_e;
}
...
}
|