TEWS java runtime error when using array of filter objects (Legacy_Onyx KB Id: 216650)

Document ID : KB000054737
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

When trying to call web services in TEWS that use a ViewUserSearchFilter object such as ViewUserQuery or ViewUserSearch, we receive the following error from TEWS:

java.lang.RuntimeException: Badly formatted Vectors. Count of expr vector is 2 and count of conj vector is 0

This only seems to happen when we use more than on filter in the array. For instance the following code works:

ViewUserSearch vus = new ViewUserSearch();
ViewUserSearchFilter[] vusf = new ViewUserSearchFilter[1];
vusf[0] = new ViewUserSearchFilter();
vusf[0].index = "0";
vusf[0].Field = "%LAST_NAME%";
vusf[0].Op = OperatorType.EQUALS;
vusf[0].Value = "Mouse";
vusf[0].Conj = ConjunctionType.And;

vus.Items = vusf;

but if we add another filter as below:

ViewUserSearch vus = new ViewUserSearch();
ViewUserSearchFilter[] vusf = new ViewUserSearchFilter[2];
vusf[0] = new ViewUserSearchFilter();
vusf[0].index = "0";
vusf[0].Field = "%LAST_NAME%";
vusf[0].Op = OperatorType.EQUALS;
vusf[0].Value = "Mouse";
vusf[0].Conj = ConjunctionType.And;

vusf[1] = new ViewUserSearchFilter();
vusf[1].index = "1";
vusf[1].Field = "%FIRST_NAME%";
vusf[1].Op = OperatorType.EQUALS;
vusf[1].Value = "Micky";

vus.Items = vusf;

we receive the error mentioned.

We have tried the following recommendations from support with no luck:

I looked at your client code (FrmMain.cs) and see that you have commented out the section which is using the Conjugate OR.
This conjugate was neccessary to be in the client code in earlier CRs of IM 6 SP1, including the current IM version you are using (6 SP1 CR4). Without it, customers were experiencing the
serialization errors you see.
This bug has subsequently been fixed in IM 6 SP1 CR6.

Therefore, to resolve the serialization issue : you have 3 options

1. keep the OR code intact in your client code

2. use a workaround - edit the ViewUserSearch.xsd and change the line:
&ltxs:element name="Conj" type="nst:ConjunctionType" minOccurs="0" maxOccurs="1"/>'
to
&ltxs:element name="Conj" type="nst:ConjunctionType" nillable="true"/>

3. upgrade to IM 6 SP1 CR6 available for download from our support site.

Try either of these first, and see if the result is able to be serialized.
As for the lack of well-formed and valid xml being generated, perhaps you can try unchecking the checkbox for schema URL at the bottom in the Mgmt Console and then seeing if that changes the WSDL generated then
run through steps to generate the proxy again. I have run the sample OOTB ViewUser java client successfully and not seen this issue before, only difference being I had left the
e last checkbox unchecked.


Solution:

Customer needed to have in his client code, the line vusf[0].ConjSpecified = true; where vusf is a variable for ViewUserSearchFilter for the ViewUserSearch to work, since the SOAP message being sent across did not contain the conjugate being specified in the code.