문제

궁금하다면 누군가 밖에 있는 모든 성공에 사용하지 않았 XMLInterop 기능이 있습니다.나는 잠시 동안 그것을 사용(간단한 물론 이와 관련된 게시할 것입니다 나중에 코드).내가 찾는 것을 볼 수가 있다면 더 나은 그리고/또는 더 강력한 방법입니다.

감사합니다.

도움이 되었습니까?

해결책

약속대로 여기에는 코드 대한 통합과 함께 JDEdewards XML 을 사용하여.그것은 웹 서비스,그러나 수 있으로 사용될 수 있습니다.

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>

다른 팁

사람에게이 작업을 수행하기 위해 노력하고 있는 일부 종속성을 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

당사의 JDE 웹 서비스를 사용 XML Interop 이 코드,그리고 우리는 없었 안정성 문제 때문이다.이전에 우리가 사용하 COM 커넥터는 전시 정기적인 커뮤니케이션 실패를(아마도 연결에 문제를 풀링?) 고통이었을 설치하고 올바르게 구성.

우리가 될 때 문제가 있고 시도했는 트랜잭션을 사용하지만,을 하고 있다면 간단한 비즈니스 싱글 함수 호출이 될 수 없는 문제입니다.

업데이트: 정교한 트랜잭션에서 문제가-만약 당신이 시도를 유지하는 트랜잭션을 살아 여러내 통화,JDE 응용 프로그램 서버가 처리하는 겸손한 동시 통화 수은,xmlinterop 호출이 반환을 시작하'XML 실패 응답이'메시지와 DB 트랜잭션은 열려있는 방법으로 commit,rollback.그것은 조정 가능한 알갱이의 수를 해결할 수 있습 이지만,개인적으로 난 항상 시도하는 완전한 트랜잭션에서 하나의 전화입니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top