Compare String in webmethods


I have two identical document type. But the data contained in each string of these docs is different. I want to compare each string of the docs.

Is there any way to compare each and every string of the two docs and identify the strings that mismatch.


May be a java service makes the task easier. Input the two documents to the java service. Get the cusrsors for these two docs and implement something like the below:

while(Cursor1.hasMoreData() && cursor2.hasMoreData())
String val1 = IDataUtil.getString(Cursor1);
String val2 = IDataUtil.getString(Cursor2);
String key = Cursor1.getKey();
//Compare val1 and val2 here with java code. If they are different then add the key to the HashTable or arraylist
//Insert this keys into the current pipeline;

I didn’t test this code. May be you need to do some modifications.


Have you thought about using compareString function as a transformer for each field seperately or maybe creating a new java service as Gunna suggested ?

Hi Khan,
The compareString service is in wm7.1? I didn’t know as such built-in service exists.
If there are a fixed and minimum number of fields in the docs then this is preferable.


That is true that webMethods doesn’t have any built in service for compareString yet but it is few lines of code to write a java service for it since it is commonly used and I would be surprised if most organizations don’t already have their own service for this functionality.