2

Visual Studio を使用して Web サービスを使用し、マネージ コードを使用して AX 2012 でそれを呼び出しました。単純なジョブでコードを次のように実行するとします。

static void CurrencyService(Args _args)
{
   CurrencyConvert.Currency_Convert.CurrencyServiceClient convertcurrency;
   CurrencyConvert.Currency_Convert.Currency currency;
   System.ServiceModel.Description.ServiceEndpoint endPoint;
   System.Type type;
   System.Exception ex;
   str s1;

try
{
    type = CLRInterop::getType('CurrencyConvert.Currency_Convert.CurrencyServiceClient');
    convertcurrency = AifUtil::createServiceClient(type);

    endPoint = convertcurrency.get_Endpoint();
   // endPoint.set_Address(new System.ServiceModel.EndpointAddress("http://localhost/HelloWorld"));
    currency = convertcurrency.GetConversionRate(CurrencyConvert.Currency_Convert.CurrencyCode::AUD,CurrencyConvert.Currency_Convert.CurrencyCode::INR );

  info(strFmt('%1', CLRInterop::getAnyTypeForObject(currency.get_Rate())));
}
 catch(Exception::CLRError)
{
    ex = CLRInterop::getLastException();
    info(CLRInterop::getAnyTypeForObject(ex.ToString()));
}
}

上記のジョブは正常に機能しており、情報ログに結果が生成されています。

ここで、バッチ ジョブに対して通常行うように、バッチ ジョブのクラス (拡張 Runbasebatch クラス) の下に同じコードを記述すると、次のようなエラーがスローされます。

Microsoft.Dynamics.Ax.Xpp.ErrorException: 型 'Microsoft.Dynamics.Ax.Xpp.ErrorException' の例外がスローされました。

Dynamics.Ax.Application.BatchRun.runJobStatic (Int64 batchId) で BatchRun.runJobStatic.xpp:line 38

BatchRun::runJobStatic (Object[] ) で

Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall (型の型、文字列 MethodName、オブジェクト [] パラメーター) で

BatchIL.taskThreadEntry (オブジェクト threadArg) で

使用された Web サービスを除く他のバッチ ジョブは正常に動作しています。クラスのRunOnプロパティが「サーバー」として設定されているなど、すでに多くのことを試しました。これは、使用した各Webサービスの場合です。誰もこれに対する適切な解決策を持っていますか??

4

3 に答える 3