Requesting Inbound XML Using COM Server

You can use the COM connector to send inbound synchronous XML requests (such as XML CallObject, XML List, and XML UBE) to the JD Edwards EnterpriseOne server.

See Also

This sample code shows how to use the COM connector to execute an inbound XML request.

// File	: testDriver.cpp 
// Purpose	: a test driver to submit the xml request document to OneWorld through
// ThinNet 
// Usage	: testDriver <input xml doc> <host> <port> <timeout>
// Platform	: Win32 Console Program. 
// DLL requirement:	 xmlinterop.dll, jdeunicode.dll, jdel.dll, jdethread.dll.
 
 
#include "iostream"
#include "fstream"
#include "string"
#include   <jde.h>
#include <jdeunicode.h>
 
extern "C" ZCHAR * JDEWINAPI jdeXMLRequest(const JCHAR *szHostName, unsigned short usPort, const int nNetTimeout, void *xml, int size);
extern "C" void JDEWINAPI jdeFreeXMLResponse(ZCHAR *szResp);
 
 
int _cdecl wmain(int argc, wchar_t* argv[], wchar_t* envp[])
{
 
   ZCHAR     *buf;
   DWORD    dwSize;
   DWORD    dwBytesRead;
   HANDLE   hFile;
 
   if( argc != 5 )
   {
	   std::wcout << _J("Usage: cotest <input xml doc> <host> <port> <timeout>");
      return 0;
   }
 
 
  // read the <XML input doc>. 
  // Note: the APIs for reading the file are only avaliable in win32. 
  if(INVALID_HANDLE_VALUE == (hFile = CreateFile(argv[1], GENERIC_READ,
    0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)))
    return 0;
 
  if(0xFFFFFFFF == (dwSize = ::GetFileSize(hFile, NULL)))
    return 0;
 
  buf = new ZCHAR[dwSize + 1];
  memset( buf, 0, dwSize+1 );
  if(!ReadFile(hFile, buf, dwSize, &dwBytesRead, NULL))    
    return 0;
  
  CloseHandle(hFile);	
 
   // call C thinNet API to send XML request document 
   ZCHAR* presp = jdeXMLRequest(argv[2], jdeAtoi(argv[3]), jdeAtoi(argv[4]), buf, 0);
 
 
  // write the XML response into a log file <xmlDoc.log>
  // Note: the APIs for writing the file are only avaliable in win32. 
   std::wstring outFile( (JCHAR*)argv[1] );
   std::wstring outExt ( _J(".log") );
 
   int i;
   if(  (i = outFile.find( _J(".") )) > 0 )
   {
      outFile.replace( i, 4, outExt);
 
   }
   else
   {
      outFile.append( outExt );
   }
   ZCHAR *outfile = new ZCHAR[jdeStrlen(outFile.c_str())+1];
   jdeFromUnicode(outfile, outFile.c_str(), jdeStrlen(outFile.c_str())+1, NULL);
 
   std::ofstream outf(outfile);
 
   outf << presp;
 
   // free the resource 
   delete [] buf;
   delete[] outfile;
   jdeFreeXMLResponse(presp);
   
 
	return 0;
}