CADK/WM4.5/Bug in publishing ?


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 :

at com.wm.adapter.intdevkit.AdapterMain.setEnvelope(
at com.wm.adapter.intdevkit.AdapterMain.setEnvelope(, Compiled Code)
at com.wm.adapter.intdevkit.Operation.publishEvents(
at COM.activesw.adapter.MyAdapter.MyAdapterTemplate.scriptInvoke(, Compiled Code)
at com.wm.adapter.intdevkit.Operation$
at Method)
at com.wm.adapter.intdevkit.Operation.doPrivileged(
at com.wm.adapter.intdevkit.Operation.scriptInvoke(
at com.wm.adapter.intdevkit.AdapterMain.processPublication1(, Compiled Code)
at com.wm.adapter.intdevkit.AdapterMain.processPublication(
at, Compiled Code)

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

If someone has an idea… Thanks in advance

Matthieu Boujonnier

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 ?


Matthieu Boujonnier


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”);


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

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


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(
11:46:39 at com.wm.adapter.intdevkit.AdapterMain.setEnvelope(
11:46:39 at com.wm.adapter.intdevkit.Operation.publishEvent(
11:46:39 at COM.activesw.adapter.Example.ExampleOperation.scriptInvoke(
11:46:39 at com.wm.adapter.intdevkit.Operation$
11:46:40 at Method)
11:46:40 at com.wm.adapter.intdevkit.Operation.doPrivileged(
11:46:40 at com.wm.adapter.intdevkit.Operation.scriptInvoke(
11:46:40 at com.wm.adapter.intdevkit.AdapterMain.processPublication1(, Compiled Code)
11:46:40 at com.wm.adapter.intdevkit.AdapterMain.processPublication(
11:46:40 at com.wm.adapter.intdevkit.AdapterMain.checkPublications(, Compiled Code)
11:46:40 at com.wm.adapter.intdevkit.AdapterMain.getEvents(, Compiled Code)
11:46:40 at com.wm.adapter.intdevkit.AdapterMain.runAdapterMain(, Compiled Code)
11:46:40 at com.wm.adapter.intdevkit.AdapterMain.main(

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