Join wMUsers | Blog at wMUsers | Edit my wMUsers Profile | Site Map | Invite your peers | webMethods Jobs | For Employers

webMethods Ezine: Writing Custom Handlers for TN and the IS

wMUsers Discussion Forums » Integration Server & Trading Networks » Trading Networks » Archive through July 13, 2005 » webMethods Ezine: Writing Custom Handlers for TN and the IS

Author Message
Dan Green

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, July 15, 2002 - 09:39 pm:   Print Post

Questions or comments about this webMethods Ezine article?

Click here to read the original text.
Nick Faiz

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, July 17, 2002 - 01:46 am:   Print Post

I found Igor's advice on IS memory related issues and the com.wm.app.b2b.server.* to be extremely educational.

Excellent article!
Khushhal Mahajan
New member
Username: kmahajan


Post Number: 1
Registered: 05-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, May 08, 2003 - 02:23 pm:   Print Post

How do I write content handler for the posting where header data ( mime types) are more then one. Example

Content-type: text/plain
From: ABCCustomer
To: SomePartner

This is the payload for processing

In this case if I write content handler just for text/plain how do I get values From and TO to be passed to the service being invoked. Any insight would be greatly appreciated. Example would be perfect.

Khushhal

RMG (Unregistered Guest)
Posted on Thursday, May 08, 2003 - 04:38 pm:   Print Post

Which component you are using (Rosettanet or EDIINT or CIDX)etc..??
Khushhal Mahajan
New member
Username: kmahajan


Post Number: 2
Registered: 05-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, May 08, 2003 - 06:26 pm:   Print Post

RMG

I am using EDIINT component. But problem is that we are moving data through a proxy server ( which is webmethods server) . This works for rosettanet since content type is only aplication/x-rosettanet-agent and mime does not have other values and we have written our own content handler for that and while httping to the customer we hardcode content-type and it works but EDIINT has several values in header and I want to be able to pick all values so that I could pass those to the http and same is true while inbound.

Khushhal
Thanks
Sandip Khazanchi
Intermediate Member
Username: khazanchi


Post Number: 51
Registered: 07-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, August 26, 2003 - 04:41 pm:   Print Post

Hi! Dan,

Taking into consideration the content handler article, i am trying to implement the same. When i am trying to compile the TXTContentHandler.java, it is not able to get the jar for the InvokeState class.

Is it that this can only be done when the server is running. I am trying to do this from a client machine, after copying the server.jar from the server.

server.jar contains the InvokeState class.

Please suggest.
Sandip Khazanchi
Intermediate Member
Username: khazanchi


Post Number: 52
Registered: 07-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, August 26, 2003 - 05:03 pm:   Print Post

Hi!

I managed to compile it. Is was wrong on my part. ClassPath setting was giving me problems.

thanx anyway.

sandip
Christian Schuit
New member
Username: cschuit


Post Number: 4
Registered: 03-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, September 26, 2003 - 06:46 am:   Print Post

Hi

Build the content handler (for multipart/form-data), and the factory, installed them, registered the handler, and then... everything seems to work fine except for 2 things:
1. The browser I use to submit a file gives me a "save/open" dialogue after submission(?)
2. No data is to be located in the pipeline, where it should have been put by the content handler.

I'm running wM IS 6.0.1 SP1 & using MSIE 6+ to submit the file. Can you tell me if there is any other resource for creating content handlers? I already went through Advantage and WmUsers.

Thanks
Joao Constantino
New member
Username: joca


Post Number: 1
Registered: 10-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, October 24, 2003 - 07:47 am:   Print Post

Hi,
I'm trying to replace WebMethods default content type ("application/x-www-form-urlencoded") with a new content handler I built.Everything seems to work fine with unregister and register of the handler but when a service is invoked only the method "putOutputValues" is called, the method "getInputValues" is never called.

Any idea about this ?

Thanks
Joao Constantino
New member
Username: joca


Post Number: 2
Registered: 10-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, October 27, 2003 - 07:55 am:   Print Post

Hi again,
I´ve one more doubt :
When a service is invoked via URL like ("http://host:port/invoke/service_path?input1=xxx&input2=yyy") what is the content-type associated ? "text/html" or "application/x-www-form-urlencoded" ?

Thanks
Joao Constantino
New member
Username: joca


Post Number: 3
Registered: 10-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, October 29, 2003 - 01:35 pm:   Print Post

Hi,
After some more investigations and tests I saw that if I invoked a service via HTTP with POST the method "getInputValues" of the ContentHandler is called but is not called if service is invoked with HTTP GET.

Anybody know the reason for this ?

Thanks
Bart De Baere
New member
Username: bart_de_baere


Post Number: 5
Registered: 11-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, January 20, 2004 - 09:41 am:   Print Post

Hi,

I know this post is pretty old, but therefore not unimportant. It took me a while to figure this all out and I still have a question:

I wrote the example code of Igor in jcode and fragged everything with jcode. I got no compile errors, but my ContentHandler doesn't get "written" while my ContentHandlerFactory and the create JavaService does!

So I see the ContentHandlerFactory with the create JavaService in the Developer, but not the ContentHandler.

When I shutdown the IS and restart it the package only gets partially reloaded, so I figure the ContentHandler needs to be written.

Attached is my java code for the ContentHandler, does anyone see something wrong with it?

Thx
B.
application/octet-streamContentHandler
SignedXMLContentHandler.java (1.4 k)
Bart De Baere
Junior Member
Username: bart_de_baere


Post Number: 6
Registered: 11-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, January 21, 2004 - 02:53 am:   Print Post

Hi,

I have good news, there is nothing wrong with the code I posted!

We ran the service again, even without physically seeing the ContentHandler in wm Developer and with a partially loaded package and it works!

Still I would like to now why I can't see the content handler in wm Developer and why the package only gets partially loaded. Is it because the content handler class implements an interface?

Anybody got a clue?

Thx
B.

Igor Androsov
Advanced Member
Username: iandrosov


Post Number: 89
Registered: 04-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, January 21, 2004 - 07:52 pm:   Print Post

Hi Bart I saw this post and wanted to clarify couple of things. First of all ContentHandler and ContentHandlerFactory are classes that are not intended to be used as WM java service directly. They are classes that will be used by IS to process incoming data with your custom registered type. The only services you do need to expose to Developer are really only registration and unregistration. Becasue these services need to be used as package startup and shutdown services respectively. This is to make it conviniet for use. As package loaded or reloaded your new content handler will be registered or unregistered along with the data type. You can see clear example use of this in WM samples package. My article did not discuss Unregitering content handler as its not important for overall functionality of the handler. But its really easy services to create 1 line Java code: ServerAPI.removeContentHandler("Content/type"); That is it for unregistering.
Another fact is if you look at methods that ContentHandler and ContentHandlerFactory provides you will find that Input/output for these are more like regular Java methods instead on WM service. Therefore if you did expose them as driect services in Developer you will not be able to pass data as IData or Values objects to them directly.
Since you did frag them and try to expose all that code as services but some of it not shown in your developer. I can only speculate why it may have hapened without seeing your full package. If you want me to look at it you are welcome to send me your package and I may be able to explain why things did not show up as you expect them to. Even though they are not suposed be use this way.

Now if you did wanted to use you content handler code as a service you can place it in a java service and my article discusses that option as Custom Content Handlers. Although its not really a Contenthandler more of a custom Java service that can porcess custom type of data incoming directly to the service. That data will bypass all standard IS handlers.

Hope this clears things for you

Bart De Baere
Junior Member
Username: bart_de_baere


Post Number: 7
Registered: 11-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, January 22, 2004 - 02:27 am:   Print Post

Hi Igor,

Thanx for your answer.

I solved my problem by deleting the jcode tags in my two classes (ContentHandler and ContentHandlerFactory) as you say in your answer they are classes and not services so they don't need to be exposed hence, you don't see them (but they are there). Thanx for clearing this up.

I wrote the register and unregister java services (with jcode tags) and these work perfectly! I can see them in my package.

It seems that your example in the ezine was completely correct, I only didn't know how to implement it as I never worked with the jcode before. But I have succeeded now.

I have a new question for you: Is it possible to make a custom handler
that takes in to account the content/type, but also the protocol?

Thanx a million for your answer and example.
B.
Igor Androsov
Advanced Member
Username: iandrosov


Post Number: 92
Registered: 04-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, January 25, 2004 - 11:22 pm:   Print Post

Bart not sure why you need handler to use protocol information? Normally handler is invoked after listener got the portocol and soket data passed to handler as strem to parse it. But if you must know there is object InvokeState passed into your Handler's Java method. From that object you can get all current info about invokation of your service such as session, user, socket object, content encoding and more check WM API docs on InvokeState object. Among those you can find API getProtocolInfoif() it returns com.wm.app.b2b.server.ProtocolInfoIf its not documented class but you may get portocol info from it using String[] getProtocolPropertyList() and getProtocolProperty(String). Although I do not see why you need such low level details about invoke protocol inside your handler?
Hope this is helpfull.
Surresh
New member
Username: wmuser


Post Number: 1
Registered: 11-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, April 27, 2004 - 10:10 am:   Print Post

Hi,

I have a situation that needs to be addressed with the help of a custom Content Handler. The situation we are having is that the client sends us data via an HTTP Post ( the protocol they use is RFC 1867). While receiving in our system we are missing the 'NAME' attribute and hence the data is split into 2 parts - the first part going to the 'NAME' field and the part going to the Value field. We need to be able to pass the entire data in the Value field.
Has anybody come across this. Any help is highly appreciated.

Thanks
Surresh
Nilesh Gohel
Member
Username: ndgohel


Post Number: 25
Registered: 10-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, September 14, 2004 - 09:52 am:   Print Post

Hi IGOR,

How are you doing ?

Actually i have a requirement to handle large inbound
documents to IS/TN. I have read your article about 'Custom Conent
Handlers'. But actually i havent developed a single content handler
so i dont know how to start. If you guide me where can i get step by
step guide to create and use custom content handler, it would be a
great help.

My requirement is to get the inbound file, identify it . The inbound
file is always PGP entrypted, so decrypt it first and check the file
size. And if it is a large file, then handle it by some efficient way
without any or little performance cost.

Thanks in Advance.

If other folks, can throw light on this post, u r always welcome.

Regards,
Nilesh
RMG
Senior Member
Username: rmg


Post Number: 902
Registered: 03-2004

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, September 14, 2004 - 10:02 am:   Print Post

Nilesh,

For handling large files routing to TN there is documentation available for TN LargeDoc handling.

Please get this pdf from Advantage site and it explanis well how to configure and setup.

HTH,
RMG.
Nilesh Gohel
Member
Username: ndgohel


Post Number: 26
Registered: 10-2003

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, September 14, 2004 - 11:18 am:   Print Post

Thanks RMG for prompt response.

But my requirement is litter different. We have requirement first to get inbound documents submitted to IS ,then decrypt them, check the size of the document and decide whether its large. After performing this operation, we want to submit those document to TN. So it goes like this:

Partner FTPs document to IS Service --> IS Service decrypts it, checks the file size and decides whether doc is large --> Submit the document to TN.

What do u suggest in this scenario ? Should we develop a custom content handler ? so all the documents inbound to IS will be submitted to a single service ..( you can consider that service as a gateway to IS ) ..

Regards,
Nilesh
Philippe Mousset
Member
Username: pmo


Post Number: 28
Registered: 11-2004

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, March 18, 2005 - 08:53 am:   Print Post

Nilesh,

did you ever get this custom content handler development guide ? I would be quite interested to get it

thanks

Philippe
Roshan_rec (Unregistered Guest)
Unregistered guest

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, November 15, 2005 - 07:55 pm:   Print Post

Hi,
We are sending documents to our partners through HTTP.
When we tried to send the documents to our
partner through TN, They said the Request
Method was "GET", but they require us "POST".

1. Can webMethods Trading Network configure the "POST" when sending ?
2. If we are sending documents under "GET", how we can change the
Request Method to "POST" ?

Thnaks in advance,
Roshan.
Rob Eamon
Senior Member
Username: reamon


Post Number: 1270
Registered: 04-2003



Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, November 15, 2005 - 10:12 pm:   Print Post

The immediate delivery methods built-in to TN for HTTP/S use the post method, not get. How specifically are you using TN to deliver the data?
Roshan_rec (Unregistered Guest)
Unregistered guest

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, November 16, 2005 - 12:11 am:   Print Post

Hi Rob,

Thanx for the respone.

We are using HTTP. I am unable to send xml data to my parteners using TN console. I have done all the configuration for parteners info in TN. We are able to get request but unable to send.
We are using webmethod version: 6.1 on Linux.

Is there any patches we need to update?

Thanks in advance.

Regards,
Roshan.
Rob Eamon
Senior Member
Username: reamon


Post Number: 1273
Registered: 04-2003



Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, November 16, 2005 - 08:02 am:   Print Post

How exactly do you have TN configured to send the documents? How is the processing rule defined? I understand that HTTP is involved but we need to know precisely how you have things set up. The TN delivery methods (that is, when you select "Immediate Delivery" with one of the HTTP options, or "Receiver's Preferred Protocol" and the protocol is HTTP) use HTTP POST. I suspect that you're not using TN delivery and instead are calling a service which is calling pub.client:http with the method parameter set to "get".

Strictly speaking, "TN Console" doesn't send anything. TN Console is the UI to configure TN and view activity. TN itself does the work to send and uses pub.client:http underneath the covers with the method parameter set to "post".
Roshan_rec (Unregistered Guest)
Unregistered guest

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, November 20, 2005 - 10:27 pm:   Print Post

Hi Rob,

Thanx for ur reply. We resolved the above problem. We have one more problem.
Can you please advice us as it is very urgent.

We have 2 WM servers running. Development server (DEV) and Productuon server (Prd). When we are importing the package from DEV server to Prd server, after completing all the imports to Prd server, the Prd server is automatically shutting down. When we tried to restart, Prd server is not starting properly. When we look Prd server logs, it is stopping at " TRANET: Starting webMethods Trading Networks, TRANET: Loading system configuration".

We couldn't able to proceed further. Please let us know mistake where we are doing.

Thanks in advance,
Roshan.
Rob Eamon
Senior Member
Username: reamon


Post Number: 1285
Registered: 04-2003



Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, November 21, 2005 - 09:44 am:   Print Post

How did you resolve the first problem? It would be helpful for those who come across this same issue in the future and search the forums.

Which package(s) did you migrate from dev to prd? How *exactly* did you migrate the settings? Have you tried an IS restart with the debug level set higher than 4?

 

 

Add Your Message Here
Post:
Username: wMUsers Members: Use your username/password to increase your "Total Posts" ranking and link your profile.

Non-members: Use your full name as a username.
Password:
Email:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:


Advertise at wMUsers

Check out our Frappr!




© All Rights Reserved, 2001-2005.

Script Execution Error

Your discus.conf file could not be opened.
Error:  Open discus.conf: No such file or directory
Script: dummy.cgi
OS:     linux
Perl:   5.008008
Descr:  No such file or directory
Discus: 4.0

Read documentation in the Support Center
Also try your Program Diagnostics