Xari0tis
Member
Good Afternoon!
I'm currently trying to use XML Interoperability to connect with JDE using a .NET platform, but it doesn't seem to matter what I do, I'm getting an error code 14. I'm not 100% certain what that means or what it is doing, so I've come here to help.
I saw a few other threads on this and I've tried suggestions, but I'm spinning my wheels here.
Here's my code:
public class JdeBFService
{
private string _strServerName;
private UInt16 _intServerPort;
private Int32 _intServerTimeout;
public JdeBFService()
{
// Load JDE ServerName, Port, & Connection Timeout from the Web.config file.
_strServerName = "Server";
_intServerPort = Port;
_intServerTimeout = Timeout;
string str_jde = "<jdeRequest type='callmethod' user='user' pwd='password' environment='environment'>" +
"<callMethod name='GetEffectiveAddress' app='JdeWebRequest' runOnError='no'>" +
"<params>" +
"<param name='mnAddressNumber'>10000</param>" +
"</params>" +
"</callMethod>" +
"</jdeRequest>"
XmlDocument jde_xml = new XmlDocument();
jde_xml.LoadXml(str_jde);
XmlDocument ret_val = new XmlDocument();
ret_val = JdeXmlRequest(jde_xml);
}
/// <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>
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 E910/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([System.Runtime.InteropServices.MarshalAs(UnmanagedType.LPStr)] StringBuilder server, UInt16 port, Int32 timeout, [MarshalAs(UnmanagedType.LPStr)] StringBuilder buf, Int32 length);
[WebMethod]
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;
}
}
If I'm getting a return code 14 that means I'm making the call correctly, right? What kind of set ups would I need to do to ensure that the call is successful? I have looked at the User / Password / Url / Port / Timeout many many times and right now I'm just basically banging my head against the wall.
I have included many of the dlls in my project as resources as well, so the call doesn't seem to be 'failing'.
Help!
I'm currently trying to use XML Interoperability to connect with JDE using a .NET platform, but it doesn't seem to matter what I do, I'm getting an error code 14. I'm not 100% certain what that means or what it is doing, so I've come here to help.
I saw a few other threads on this and I've tried suggestions, but I'm spinning my wheels here.
Here's my code:
public class JdeBFService
{
private string _strServerName;
private UInt16 _intServerPort;
private Int32 _intServerTimeout;
public JdeBFService()
{
// Load JDE ServerName, Port, & Connection Timeout from the Web.config file.
_strServerName = "Server";
_intServerPort = Port;
_intServerTimeout = Timeout;
string str_jde = "<jdeRequest type='callmethod' user='user' pwd='password' environment='environment'>" +
"<callMethod name='GetEffectiveAddress' app='JdeWebRequest' runOnError='no'>" +
"<params>" +
"<param name='mnAddressNumber'>10000</param>" +
"</params>" +
"</callMethod>" +
"</jdeRequest>"
XmlDocument jde_xml = new XmlDocument();
jde_xml.LoadXml(str_jde);
XmlDocument ret_val = new XmlDocument();
ret_val = JdeXmlRequest(jde_xml);
}
/// <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>
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 E910/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([System.Runtime.InteropServices.MarshalAs(UnmanagedType.LPStr)] StringBuilder server, UInt16 port, Int32 timeout, [MarshalAs(UnmanagedType.LPStr)] StringBuilder buf, Int32 length);
[WebMethod]
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;
}
}
If I'm getting a return code 14 that means I'm making the call correctly, right? What kind of set ups would I need to do to ensure that the call is successful? I have looked at the User / Password / Url / Port / Timeout many many times and right now I'm just basically banging my head against the wall.
I have included many of the dlls in my project as resources as well, so the call doesn't seem to be 'failing'.
Help!