How to invoke the Com object using SAP BC

I tried to invoke a com dll as described in SAP BC PDF manual
in 2 methods given by webmethods.

  1. Using InvokeLate but itshow error
    java.lang.NoclassDefFoundError.

When i tried to use it using CreateObject and Invoke
then it show Error “Could not run the service ‘createObject’.java.lang.reflect.InvocationTargetException: Link Error: no webMethods (webMethods.dll) in java.library.path”

What is the cause of the error

Please make sure the Business Connector is working properly. After that check the classpath of the system. Make sure the dll file that you are trying to invoke the methods on is in the classpath.
Thanks
VR

hi vinodh

thanks for the reply

i have n’t understood the “check the classpath of the system”
and Make sure the dll file that you are trying to invoke the methods on is in the classpath" Can u explain me in detail about this?

I am trying to invoke the COM in following way.

1)In my system (192.168.0.78) only SAP BC Developer is installed and i am able to connect to SAP BC server properly in another system(192.168.0.22.)

2)I have the compiled dll in my system which has method helloWorld.

3)Now how to set the parameters in CreateObject and Invoke this method.

My doubts

  1. How to set the parameters and where to put the dll in the SAP BC server or in my system itself?

  2. did the SAP BC server is to be installed in my system as only SAP Developer in installed in my system?

Hi,

Answer to your questions.

  1. You have to put the dll in your machine. The parameters can be set using the win32.COM.dispatch:invoke step in the WmWin32 package

  2. You dont have to install the SAP BC server on your machine. Developer is enough.

Thanks
Vinod

You posted by giving

"Please make sure the Business Connector is working properly. After that check the classpath of the system. Make sure the dll file that you are trying to invoke the methods on is in the classpath. "

Thanks i have n’t understood the following in your response

  1. check the classpath of the system
  2. Make sure the dll file that you are trying to invoke the methods on is in the classpath

my doubt

  1. How to check the classpath of the system?
    2)Where is the location to put the dll in my system as we normally put in system32 folder.Does that is enough?

You can check the classpath by opening a command prompt and typing in “set classpath”. Another way to do this is go to the Start - Settings - Control Panel and open the “System” icon. Then click on the “Advanced” tab and select the “Environment Variables”. In the system variables you can see the classpath.

Did you register the dll in your box?
Thanks
VR

thanks

i have checked the environment in Winnt there is path variable not system variable set c:\winnt\system32 i have put my dll in that path and registered the dll but still is showing the same errors as above

Does it is because of setting of the parameters in invoke service?
Can u specify how set the parameters for this as i specifying
PROGID wmVBDemo.Services,METHOD as helloWorld and CONTEXT as INPROC,and giving method instead of GET only for DCOM as specified in PDF file does i want to specify any others parameters as server,domain,user,password etc?

Hi,
You said that you put the dll in that path. Why dont you go ahead and create the classpath variable?
The classpath variable can be created by

Start - Settings - Control Panel and open the “System” icon. Then click on the “Advanced” tab and select the “Environment Variables”. In the system variables you click “New” and then type in the classpath variable with value as the directory where the dll is.

In the mean time I will look into the document that you are referring to.

Thanks

I created a ClassPath variable set to C:\winnt\system32 in Environment(System Variable) and put the dll in that path.Now when i run with InvokeLate service is shows the error “java.lang.NoclassDefFoundError”.I even put webmethods.dll in path to system32 folder and registerd.Still it shows the error.I am trying this using the example given in PDF file given along with SAP BC(Invoking Com Using SAP BC).

Regards
SA

Hello,

Since my experience with the bc is at a minimal level but I want to use it to connect to the ms message queue, I used google to find some info on how to address a dll in java.
To use the dll in java, you need a “wrapper”. The one I found and started to play with is bridge2java. The tool comes with a few java examples and does what I expected. Also there is a readme file included which shows the settings and dos syntax needed to make the examples work.
I know that this is not a direct answer, but some of the errors mentioned earlier already passed my screen and are already fixed by reading and compiling the example of bridge2java.

Hope this helps:-)

Hi rudd

thanks for the replay.Using the wrapper class you can use it in webmethods,that is early binding ,but if u want to invoke already existing com using latebinding we will use the dll directly without using the wrapper.I am trying to use
it without wrapper as i am specialising in Microsoft technologies.I don’t want to use java technologies.When I am trying to use i am getting this error?I am searching for solution but i am not getting anywhere?If u could find replay

Hi Subramoni,
I wish I could help you since we have done that numerous times here.
Whats the error that you are getting now? With webmethods you dont have to use a wrapper. You can just use the services provided by webmethods to invoke the com object.
Best of Luck!

Hi VR
I couldn’t solve the problem as i am getting the error
in 2 methods given by webmethods.

  1. Using InvokeLate but itshow error
    java.lang.NoclassDefFoundError.

When i tried to use it using CreateObject and Invoke
then it show Error “Could not run the service ‘createObject’.java.lang.reflect.InvocationTargetException: Link Error: no webMethods (webMethods.dll) in java.library.path”

i have set the class path as u said through reply dated jan 3.
But still i am getting the error.In SAP BC Developers Manual PDF page 9-20 they says requirements fo invoke com.In it lastly they says a step which i couldn’t understand.That is

make sure to add <sapbc/Developer/lib/client.zip to your class path,i couldn’t find this client.zip file in my system.

i don’t know whether error is caused by it as only step i haven’t done till now is that.Could u please explain
1)how to do it?
2) steps by which u invoked the com?

Regards
Sa

It seems like you dont have the webmethods.dll registered. Normally this happens when you install the bc. Can you please search your system for the file webmethods.dll? It is normally in the directory %bc/support/win32%.
If you find it you can try to register it and we will take it from there.
Good Luck!

Hi VR
Thanks now the error

  1. “Could not run the service ‘createObject’ java.lang.reflect.InvocationTargetException: Link Error: no webMethods (webMethods.dll) in java.library.path” is not comming error which is comming is java.lang.invocationTargetException when i read the PDF file they says jview must be 5.00.3177 or latest.I am using version 3802 in my system and in SAP BC Sever i am using 3229,which is latest than 3177 but they are different in my system and SAP BC Server.does it because of it?

2)Using InvokeLate but itshow error
java.lang.NoclassDefFoundError is still comming.

Hi VR
Thanks now the error

  1. “Could not run the service ‘createObject’ java.lang.reflect.InvocationTargetException: Link Error: no webMethods (webMethods.dll) in java.library.path” is not comming error which is comming is java.lang.invocationTargetException when i read the PDF file they says jview must be 5.00.3177 or latest.I am using version 3802 in my system and in SAP BC Sever i am using 3229,which is latest than 3177 but they are different in my system and SAP BC Server.does it because of it?

2)Using InvokeLate but itshow error
java.lang.NoclassDefFoundError is still comming.

Hi,
The java.lang.InvocationTargetException is thrown when the compiler cannot find the class.
I will send you a sample package which does create an instance of a com object, invokes a function and then releases it from memory. Please try to execute it and let me know. Please provide me with your email address.
Thanks

Thanks for response

my email address is

sapas@indiatimes.com

Hi VR

    can u please send me the sample package to create instance of COM .I am sending my email id  

sapas@indiatimes.com

Sure,
I will send you that by COB today.