Oracle calls Delphi Write DLL to access C # WebService problem

xiaoxiao2021-03-06  41

I want to pass an external DLL (Delphi writing) to the WebService from Oracle, I don't know what is going on, I hope that I have directions. 1, I wrote in Oracle in a function AddNumber as follows: CREATE OR REPLACE FUNCTION "MY" "ADD" (a in BINARY_INTEGER, b in BINARY_INTEGER) RETURN BINARY_INTEGER ASEXTERNAL LIBRARY MY_LIBNAME "AddNumber" LANGUAGE C; 2, write a procedure. Addtest as follows: Create or Replace Procedure "My". "A in binary_integer, b in binary_integer) AS RETVAL BINARY_INTEGER; Begin RetVal: = Add (A, B); END; 3, created a My_LIB package: Create or Replace Library my_lib as 'c: /oracle/ora92/bin/mywebservice.dll'; 4, a MyWebService.dll created in Delphi and copied to the $ Oracle_Home $ / bin directory, with one way: Interface function addnumber (A: Integer; B: Integer; cdecl; .... Implementation Procedure DoGetWebServiceerr (errmsg: string); var logfile: textfile; i: integer; begin assignfile (logfile, 'd: /test.txt') ; try Rewrite (logFile); Write (logFile, ErrMsg); finally CloseFile (logFile); end; end; function AddNumber (a: integer; b: integer): Integer; begin try Result:. = GetMyWebServiceSoap () AddNumber (a , b); Except ON E: Exception Do DogetherEbServiceerr (EEMESSAGE); ELSE Result: = - 1; End; end; .....s where: getMywebServiceSoAP () is a method I am using WSDL Importer import generated MyWebService.PAS.

I exported the method in the DLL project file: exportsaddnumber; 5, with C # created a WewebService web service in LocalHost, where there is a Web method called AddNumber, which is defined as follows: [WebMethod] public int int int INT AddNumber (int A, int b) {RETURN A B;} 6, I wrote a Windows Form client with C #, test the web method, test the Web method, test success [DLLIMPATH, ENTRYPOINT "by calling the DLL written above with Delphi = "MyWebservice.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] private extern static int AddNumber (int a, int b); ...... /// test button private void buttonTestWebService_Click (object sender SYSTEM.EVENTARGS E) {ConSLE.WRITE (AddNumber (1, 2));} 7, in SQL * Plus test failed, open Test.txt file content is "not called Coinitialize", test code as follows Execute AddTest (1 , 1); if addNumber in delphi is modified to function addNumber (A: INTEGER; B: INTEGER): Integer; Begin Try Result: = a b; // Do not call WebService, directly calculate ExcePt on E: Exception Do DoGetWebServiceerr (EEMESSAGE); Else Result: = - 1; end; end; execution is successful. Oracle's Listener.ora and tnsnames.ora configuration is as follows # LISTENER.ORA Network Configuration File: C: /oracle/ora92/network/admin/listener.ora# Generated by Oracle configuration tools.MY_EXTPROC_LISTENER = (ADDRESS_LIST = (ADDRESS = ( PROTOCOL = ipc) (KEY = extproc))) SID_LIST_MY_EXTPROC_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = extproc) (ORACLE_HOME = C: / oracle / ora92) (PROGRAM = C: / oracle / ora92 / bin / extproc) (ENVS = "Extproc_dlls = any"))) # TNSNAMES.ORA NETWORK Configuration File: C: /Oracle/ora92/neetwork/admin/tnsnames.ora # generated by Oracle Configuration Tools.

ExtProc_connection_data.world = (deScription = (address = IPC) (key = extproc)) (connection_data = (sID = extproc))))))) (CONNECT_DATA = (SID = extproc))

转载请注明原文地址:https://www.9cbs.com/read-73701.html

New Post(0)