CADK/WM4.5/Bug in publishing ?

Hi,

Since I’m using webMethods 4.5, my adapter doesn’t work anymore.

In fact in my ScriptInvoke() I publish document by myself using :
AdapterScriptAcess.publishEvent(BrokerEvent event)

It works fine with webMethods 4.0 but with 4.5 I’ve got :

java.lang.NullPointerException
at com.wm.adapter.intdevkit.AdapterMain.setEnvelope(AdapterMain.java:3360)
at com.wm.adapter.intdevkit.AdapterMain.setEnvelope(AdapterMain.java, Compiled Code)
at com.wm.adapter.intdevkit.Operation.publishEvents(Operation.java:1146)
at COM.activesw.adapter.MyAdapter.MyAdapterTemplate.scriptInvoke(MyAdapterTemplate.java, Compiled Code)
at com.wm.adapter.intdevkit.Operation$1.run(Operation.java:559)
at java.security.AccessController.doPrivileged(Native Method)
at com.wm.adapter.intdevkit.Operation.doPrivileged(Operation.java:546)
at com.wm.adapter.intdevkit.Operation.scriptInvoke(Operation.java:416)
at com.wm.adapter.intdevkit.AdapterMain.processPublication1(AdapterMain.java, Compiled Code)
at com.wm.adapter.intdevkit.AdapterMain.processPublication(AdapterMain.java:1488)
at com.wm.adapter.intdevkit.ThreadRunner.run(ThreadRunner.java, Compiled Code)

I checked my BrokerEvent, all is fine (it seems !), not null…

If someone has an idea… Thanks in advance

Matthieu Boujonnier
mboujonnier@slb.com

Not sure why are you using AdapterScriptAcess.publishEvent() from within scriptInvoke()?

The events you want to publish should be the return of the scriptInvoke method, assuming you implemented AdapterScript1 or AdapterScriptN.

Hi Tony,

In addition to the method’s return (this is a AdapterScript0N), I need to publish manually some events (within the adapter, not from the workflow)

So the AdapterScriptAcess.publishEvent(s)() is dedicated to this kind of need and it works perfectly in WM4.0 but as I wrote, an exception is raised in the WM4.5 built-in classes if I use this capability, could you try to publish a simple BrokerEvent in order to check if your code works ?

Thanks,

Matthieu Boujonnier
mboujonnier@slb.com

Matt,

I tried it and it seems to work fine for me. Here is part of my scriptInvoke()

// create the output event.
BrokerEvent output = access.newOutputEvent(transaction);

System.out.println(“Inner Publish”);
BrokerEvent be = new BrokerEvent( access.getClient() , “PubTest”);

be.setUCStringField(“NewField”,“This is a test value”);

access.publishEvent(be);

I had no problem catching the event in the Event Tracker. We are running on a Solaris 2.6. Here are the specifics:

webMethods Enterprise 4.1.1
-SP #2 (EBKR411SP2)
-SP #4 (EBKR411SP4)

webMethods Enterprise iAdapters 4.1.1
-XML Adapter Service Pack 1
-I/O and XML Service Pack 2
-Adapter Patch #1
-EIADK411SP1

B2B-Enterprise Package 4.5

webMethods Enterprise Integrator Adapters 4.5.1

ADK 4.2

webMethods Enterprise Integrator 4.5.1
-SP #3 (ETOOLS411SP3)
-451FixB custom fix supplied by webMethods

webMethods Java Development Kit 1.3

Tony.

Hi Tony,

First of all I applied all patchs to be in the same configuration as you (except that I’m running NT instead of Solaris).

Then I replaced my ScriptInvoke() code by yours.
And I created a PubTest object with the NewField UCString field correctly registered to the client group.

And in debug mode here is the result :

11println Inner Publish
11:46:39 [Debug] 0 ExampleOperation process time 60ms
11:46:39 [Debug] 0 error (109) Run-time exception while processing “ExampleOperation”
11:46:39 java.lang.NullPointerException java.lang.NullPointerException
11:46:39 at com.wm.adapter.intdevkit.AdapterMain.setEnvelope(AdapterMain.java:3360)
11:46:39 at com.wm.adapter.intdevkit.AdapterMain.setEnvelope(AdapterMain.java:3339)
11:46:39 at com.wm.adapter.intdevkit.Operation.publishEvent(Operation.java:1121)
11:46:39 at COM.activesw.adapter.Example.ExampleOperation.scriptInvoke(ExampleOperation.java:349)
11:46:39 at com.wm.adapter.intdevkit.Operation$1.run(Operation.java:559)
11:46:40 at java.security.AccessController.doPrivileged(Native Method)
11:46:40 at com.wm.adapter.intdevkit.Operation.doPrivileged(Operation.java:546)
11:46:40 at com.wm.adapter.intdevkit.Operation.scriptInvoke(Operation.java:416)
11:46:40 at com.wm.adapter.intdevkit.AdapterMain.processPublication1(AdapterMain.java, Compiled Code)
11:46:40 at com.wm.adapter.intdevkit.AdapterMain.processPublication(AdapterMain.java:1488)
11:46:40 at com.wm.adapter.intdevkit.AdapterMain.checkPublications(AdapterMain.java, Compiled Code)
11:46:40 at com.wm.adapter.intdevkit.AdapterMain.getEvents(AdapterMain.java, Compiled Code)
11:46:40 at com.wm.adapter.intdevkit.AdapterMain.runAdapterMain(AdapterMain.java, Compiled Code)
11:46:40 at com.wm.adapter.intdevkit.AdapterMain.main(AdapterMain.java:4402)

so exactly as before…

So I try to request webMethods support as this is really annoying.

Thanks for your help Tony.

I’m going to check the versions a second time…

Hi Matthieu,

I am not sure if this is the fix to your problem, but based on the exception you are getting, I woudn’t be surprised if it is. With 4.5, webMethods added a new envelope field called “activation”. This field is used to associate all documents within an integration. I think when you create your own documents in the script using code, this field either doesn’t get set, or is improperly set and causes your problem. Try setting the “_env.activiation” field and see if that solves your problem.

Matt Talaga
mtalaga@crowechizek.com