Xml interoperability question

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!
 
Hi

Are you referencing the JDE Enterprise server as the what you call the URL? The code looks like it's using the literal "Server". Can you post what exactly is being passed to the API? Separately, you want to call jdeFreeXMLResponse on the returned pointer to free the memory.

Craig
 
Also ensure you have correct set of INIs with all related sections set properly. Its good to get a copy of all of them specially interop & jdbj from Enterprise server and review it with your CNC.
 
Is the JDE_B9_ICU_DATA system variable defined on that machine? That has tripped me before.
 
I messed around with this. I think 14 means it's failing to connect to the enterprise server

Here is the xml i'm getting back from my E1

<?xml version="1.0"?>
<jdeResponse>
<returnCode code="14">Connection to OneWorld failed</returnCode>
</jdeResponse>

Here is a solution I put together in dotNet. Given a valid server/port/xml it should return some xml for you.

http://bit.ly/11m8TIR
 
I messed around with this. I think 14 means it's failing to connect to the enterprise server

Here is the xml i'm getting back from my E1

<?xml version="1.0"?>
<jdeResponse>
<returnCode code="14">Connection to OneWorld failed</returnCode>
</jdeResponse>

Here is a solution I put together in dotNet. Given a valid server/port/xml it should return some xml for you.

http://bit.ly/11m8TIR

This was a wonderful help. I don't know why I didn't think of just throwing together something like this.

Looks like the issue was a realllllly stupid one; I was trying to connect to the wrong server. - headdesk -

Thanks for everyone's help!
 
Back
Top