我想知道是否有人已经成功地使用了JDEdwards XMLInterop功能。我已经使用它一段时间了(只有一个简单的PInvoke,稍后会发布代码)。我正在寻找是否有更好和/或更健壮的方法。
谢谢。
发布于 2008-09-30 19:43:16
正如所承诺的,下面是使用XML与JDEdewards集成的代码。它是一个see服务,但可以按您认为合适的方式使用。
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>发布于 2013-10-26 03:42:40
对于任何想要这样做的人来说,对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发布于 2009-08-05 05:44:49
在看到这段代码后,我将我们的JDE web服务更改为使用XML Interop,从那以后我们就再也没有遇到过任何稳定性问题。以前我们使用的是COM连接器,它经常出现通信故障(可能是连接池问题?)正确安装和配置是一件很痛苦的事情。
当我们尝试使用事务时,我们确实遇到了问题,但如果您正在进行简单的单个业务函数调用,这应该不是问题。
xmlinterop更新:详细说明事务问题-如果您试图在多个调用中保持一个事务的活动状态,并且应用服务器正在处理适度数量的并发调用,则调用将开始返回一条“XML”消息,并且DB事务处于打开状态,无法提交或回滚。调整内核的数量可能会解决这个问题,但就我个人而言,我总是试图在一个调用中完成事务。
https://stackoverflow.com/questions/84885
复制相似问题