2

JDEdwards XMLInterop 機能の使用に成功した人がいるかどうか疑問に思っています。私はしばらくそれを使用してきました (単純な PInvoke を使用して、後でコードを投稿します)。より良い方法やより堅牢な方法があるかどうかを調べています。

ありがとう。

4

3 に答える 3

9

お約束どおり、XML を使用して JDEdewards と統合するためのコードを次に示します。これは Web サービスですが、必要に応じて使用できます。

namespace YourNameSpace

{

/// <summary>
/// This webservice allows you to submit JDE XML CallObject requests via a c# webservice
/// </summary>
[WebService(Namespace = "http://WebSite.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class JdeBFService : System.Web.Services.WebService
{
    private string _strServerName;
    private UInt16 _intServerPort;
    private Int16 _intServerTimeout;

    public JdeBFService()
    {
        // Load JDE ServerName, Port, & Connection Timeout from the Web.config file.
        _strServerName = ConfigurationManager.AppSettings["JdeServerName"];
        _intServerPort = Convert.ToUInt16(ConfigurationManager.AppSettings["JdePort"], CultureInfo.InvariantCulture);
        _intServerTimeout = Convert.ToInt16(ConfigurationManager.AppSettings["JdeTimeout"], CultureInfo.InvariantCulture);

    }

    /// <summary>
    /// This webmethod allows you to submit an XML formatted jdeRequest document
    /// that will call any Master Business Function referenced in the XML document
    /// and return a response.
    /// </summary>
    /// <param name="Xml"> The jdeRequest XML document </param>
    [WebMethod]
    public XmlDocument JdeXmlRequest(XmlDocument xmlInput)
    {
        try
        {
            string outputXml = string.Empty;
            outputXml = NativeMethods.JdeXmlRequest(xmlInput, _strServerName, _intServerPort, _intServerTimeout);

            XmlDocument outputXmlDoc = new XmlDocument();
            outputXmlDoc.LoadXml(outputXml);
            return outputXmlDoc;
        }
        catch (Exception ex)
        {
            ErrorReporting.SendEmail(ex);
            throw;
        }
    }
}

/// <summary>
/// This interop class uses pinvoke to call the JDE C++ dll.  It only has one static function.
/// </summary>
/// <remarks>
/// This class calls the xmlinterop.dll which can be found in the B9/system/bin32 directory.  
/// Copy the dll to the webservice project's /bin directory before running the project.
/// </remarks>
internal static class NativeMethods
{
    [DllImport("xmlinterop.dll",
        EntryPoint = "_jdeXMLRequest@20",
        CharSet = CharSet.Auto,
        ExactSpelling = false,
        CallingConvention = CallingConvention.StdCall,
        SetLastError = true)]
    private static extern IntPtr jdeXMLRequest([MarshalAs(UnmanagedType.LPWStr)] StringBuilder server, UInt16 port, Int32 timeout, [MarshalAs(UnmanagedType.LPStr)] StringBuilder buf, Int32 length);

    public static string JdeXmlRequest(XmlDocument xmlInput, string strServerName, UInt16 intPort, Int32 intTimeout)
    {
        StringBuilder sbServerName = new StringBuilder(strServerName);
        StringBuilder sbXML = new StringBuilder();
        XmlWriter xWriter = XmlWriter.Create(sbXML);
        xmlInput.WriteTo(xWriter);
        xWriter.Close();

        string result = Marshal.PtrToStringAnsi(jdeXMLRequest(sbServerName, intPort, intTimeout, sbXML, sbXML.Length));

        return result;
    }
}

}

次のようなメッセージを送信する必要があります。

<jdeRequest type='callmethod' user='USER' pwd='PWD' environment='ENV'>
  <callMethod name='GetEffectiveAddress' app='JdeWebRequest' runOnError='no'>
    <params>
      <param name='mnAddressNumber'>10000</param>
    </params>
  </callMethod>
</jdeRequest>
于 2008-09-30T19:43:16.000 に答える
1

これを行おうとしている人には、xmlinterop.dll への依存関係がいくつかあります。

これらのファイルは、ファット クライアントのここにあります ->c:\E910\system\bin32

これにより、「シンクライアント」が作成されます

PSThread.dll
icudt32.dll
icui18n.dll
icuuc.dll
jdel.dll
jdeunicode.dll
libeay32.dll
msvcp71.dll
ssleay32.dll
ustdio.dll
xmlinterop.dll
于 2013-10-25T19:42:40.470 に答える
0

このコードを確認した後、JDEWebサービスをXMLInteropを使用するように変更しましたが、それ以降、安定性の問題は発生していません。以前はCOMコネクタを使用していましたが、これは定期的な通信障害(おそらく接続プールの問題?)を示し、正しくインストールして構成するのが面倒でした。

トランザクションを使用しようとしたときに問題が発生しましたが、単純な単一のビジネス関数呼び出しを実行している場合、これは問題にはなりません。

更新:トランザクションの問題について詳しく説明します-複数の呼び出しでトランザクションを存続させようとしていて、JDEアプリケーションサーバーが適度な数の同時呼び出しを処理している場合、xmlinterop呼び出しは「XML応答に失敗しました」というメッセージを返し始めます。 DBトランザクションは開いたままになり、コミットまたはロールバックする方法はありません。カーネルの数を微調整することでこれを解決できる可能性がありますが、個人的には、私は常に1回の呼び出しでトランザクションを完了しようとします。

于 2009-08-05T05:44:48.533 に答える