Link to home
Start Free TrialLog in
Avatar of CF_PRO
CF_PRO

asked on

java.lang.IllegalArgumentException: array element type mismatch

I am able to login to a wsdl, but I get stuck went I want to execute a method.  I get java.lang.IllegalArgumentException: array element type mismatch.
I am following a piece of PHP code that works fine, but when I convert it to cold fusion code it stops working.

Here is the PHP code snippet:

$docxfer = new SoapClient($wsdl);
id = "1234";
$ticket = $docxfer->doLogin($usr,$pwd);
$Customer = $docxfer->getCustomer($id, $ticket);

ColdFusion Code:
<cfscript>
      docxfer = createObject("webservice", #wsdl#);
        id = "1234";
      ticket = docxfer.doLogin(#usr#,#pwd#);
      Customer = docxfer.getCustomer(#id#,#ticket#);
</cfscript>
Avatar of silvera21
silvera21
Flag of United States of America image

Well first of all you do not need the '#' signs inside the function calls. Why don't you dump out all of the contents of each of those variables and make sure the data type matches what is supposed to be passed in.

You could also try removing one line of code at a time until you get the error to go away, then add the other lines back to make sure...and you will know which function call is causing the error.

Another thing you can try is running the functions with hard coded values. What way you know if it is a problem with the variables or the values themselves.
Avatar of CF_PRO
CF_PRO

ASKER

I got rid of the # signs, still the same problem.

I dumped the ticket variable

Class Name        com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket
Methods       
Method       Return Type
equals(java.lang.Object)       boolean
getAuthorizedActions()       java.lang.String[]
getDeserializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)       org.apache.axis.encoding.Deserializer
getOrganization()       java.lang.String
getPassword()       java.lang.String
getPermittedActions()       com.xxxx.www._package.com_syscorp_foundation_services_security_vos.PermittedActions[]
getSerializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)       org.apache.axis.encoding.Serializer
getTypeDesc()       org.apache.axis.description.TypeDesc
getUser()       java.lang.String
getUserdesc()       java.lang.String
getUsername()       java.lang.String
hashCode()       int
isAuthenticated()       boolean
isMonitoring()       boolean
isTracing()       boolean
setAuthenticated(boolean)       void
setAuthorizedActions(java.lang.String[])       void
setMonitoring(boolean)       void
setOrganization(java.lang.String)       void
setPassword(java.lang.String)       void
setPermittedActions(com.xxxx.www._package.com_syscorp_foundation_services_security_vos.PermittedActions[])       void
setTracing(boolean)       void
setUser(java.lang.String)       void
setUserdesc(java.lang.String)       void
setUsername(java.lang.String)       void

I did remove the
Customer = docxfer.getCustomer(#id#,#ticket#);
line of code and then there is no problem, so I know it got passed the DoLogin method.

I am not able to run the
Customer = docxfer.getCustomer(#id#,#ticket#);
with a hardcoded value because I am not sure how to reconstruct the ticket array.
Avatar of _agx_
What are the argument types of the web service method, and what types of variables are you passing into the web service?
Didn't see the last post before responding.  

Can you dump the web service object so we can see the getCustomer method?
What are the dimensions and datatypes of the ticket array? My first guess is that there is a mismatch between the type of array expected by the service and the type you are sending in.

If you put the ticket value in the isArray() function, do you get yes?

 It is odd because the ticket array is what is returned by the previous function. You may make sure it doesn't return null if there are no results.
Avatar of CF_PRO

ASKER

Here is a dump of the web service object:

Class Name        com.xxxx.www.wsdl.Services.IExtServicesStub
Methods       
Method       Return Type
doAELogin(java.lang.String, java.lang.String)       com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket
doCustomerAlertDelete(java.lang.String, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       void
doCustomerAlertInsert(com.xxxx.www._package.com_syscorp_authorizationengine_customer.CustomerAlertVO, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       void
doCustomerAlertUpdate(com.xxxx.www._package.com_syscorp_authorizationengine_customer.CustomerAlertVO, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       void
doCustomerDelete(java.lang.String, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       void
doCustomerDocDelete(java.lang.String, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       void
doCustomerDocInsert(com.xxxx.www._package.com_syscorp_authorizationengine_.CustomerDocVO, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       void
doCustomerDocUpdate(com.xxxx.www._package.com_syscorp_authorizationengine_.CustomerDocVO, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       void
doCustomerDocUpdateWithImage(com.xxxx.www._package.com_syscorp_authorizationengine_.CustomerDocVO, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       void
doCustomerInsert(com.xxxx.www._package.com_syscorp_authorizationengine_.CustomerVO, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       void
doCustomerUpdate(com.xxxx.www._package.com_syscorp_authorizationengine_.CustomerVO, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       void
doCustomerNoteInsert(com.xxxx.www._package.com_syscorp_feepay_customer.CustomerNoteVO, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       void
doLogin(java.lang.String, java.lang.String)       com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket
getCustomerAlertByCardnum(java.lang.String, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       com.xxxx.www._package.com_syscorp_authorizationengine_customer.CustomerAlertVO
getCustomerAlertTypeList(com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       com.xxxx.www._package.com_syscorp_dbtools_utils.LabelValueBean[]
getCustomerIdentification(java.lang.String, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       com.xxxx.www._package.com_syscorp_authorizationengine_customer.CustomerIdentVO
getCustomerIdentificationListByCardNum(java.lang.String, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       com.xxxx.www._package.com_syscorp_authorizationengine_customer.CustomerIdentVO[]
getCustomerIdentificationListByCustomer(java.lang.String, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       com.xxxx.www._package.com_syscorp_authorizationengine_customer.CustomerIdentVO[]
getCustomer(java.lang.String, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       com.xxxx.www._package.com_syscorp_authorizationengine_.CustomerVO
getCustomerDoc(java.lang.String, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       com.xxxx.www._package.com_syscorp_authorizationengine_.CustomerDocVO
getCustomer(java.lang.String, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       com.xxxx.www._package.com_syscorp_authorizationengine_.CustomerDocVO[]
getCustomerDocListByCustomer(java.lang.String, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       com.xxxx.www._package.com_syscorp_authorizationengine_.CustomerDocVO[]
getCustomerDocWithImage(java.lang.String, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       com.xxxx.www._package.com_syscorp_authorizationengine_.CustomerDocVO
getCustomerList(java.lang.String, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       com.xxxx.www._package.com_syscorp_authorizationengine_.CustomerVO[]
getCustomerNoteListSearch(java.lang.String, java.lang.String, java.lang.String, java.lang.String, com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       com.xxxx.www._package.com_syscorp_feepay_customer.CustomerNoteVO[]
getIdentificationTypeList(com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       com.xxxx.www._package.com_syscorp_dbtools_utils.LabelValueBean[]
getPhoneCountryList(com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket)       com.xxxx.www._package.com_syscorp_dbtools_utils.LabelValueExtBean[]
Fields       
Field       Value
java.lang.String ENDPOINT_ADDRESS_PROPERTY       javax.xml.rpc.service.endpoint.address
java.lang.String PASSWORD_PROPERTY       javax.xml.rpc.security.auth.password
java.lang.String SESSION_MAINTAIN_PROPERTY       javax.xml.rpc.session.maintain
java.lang.String USERNAME_PROPERTY       javax.xml.rpc.security.auth.username
Avatar of CF_PRO

ASKER

Ok I used
IsArray: #isArray(ticket)#
and I got a NO result.

maybe the id is registering as an integer instead of a string? you could try '#id#' (with the quotes)
I think the ticket is an object, not an array, but from the webservice definition it looks like that is expected.
> IsArray: #isArray(ticket)#
> and I got a NO result.

Is the function actually expecting an array? It doesn't look like it from the signature:
         getCustomer( java.lang.String,   .... SecurityTicket)

Can we see the whole error message? The error message may be misleading.
Avatar of CF_PRO

ASKER

Whole Error:

 Cannot perform web service invocation getCustomer.
The fault returned when invoking the web service operation is:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
 faultSubcode:
 faultString: java.io.IOException: java.lang.IllegalArgumentException: array element type mismatch
 faultActor:
 faultNode:
 faultDetail:
      {}stacktrace:java.rmi.UnmarshalException: java.io.IOException: java.lang.IllegalArgumentException: array element type mismatch
      at xxxx.soap.wsdl.SOAPOperation.getArgs(Unknown Source)
      at xxxx.soap.java.handlers.service.SOAPToServiceHandler.invoke(Unknown Source)
      at xxxx.soap.java.handlers.service.SOAPToServiceHandler.handle(Unknown Source)
      at xxxx.soap.security.handlers.SecurityHandler.handle(Unknown Source)
      at xxxx.soap.handlers.interceptor.SOAPInterceptorHandler.handle(Unknown Source)
      at xxxx.soap.routing.RoutingHandler.handle(Unknown Source)
      at xxxx.soap.handlers.logging.SOAPLoggingHandler.handle(Unknown Source)
      at xxxx.soap.handlers.setup.SetupHandler.handle(Unknown Source)
      at xxxx.soap.http.HTTPToSOAP.service(Unknown Source)
      at... ''

I think it is expecting an object - which from the dump is what the ticket appears to be. so I wonder if the issue is with the id. Maybe pass it in with JavaCast?

JavaCast("string", id)
> JavaCast("string", id)

Yes, I already suggested that above.
> Yes, I already suggested that above.

My bad.  I didn't.

@CF_PRO - what CF version are you using?
Avatar of CF_PRO

ASKER

Ok I put in:

      Customer = docxfer.getCustomer(JavaCast("string", id),ticket);


Same error
Avatar of CF_PRO

ASKER

Version:         8,0,1,195765
From what I can see, it looks like you're doing everything wrong.  Without access to the service, I'm not sure what else to suggest here (beyond really low level debugging). Unfortunately, CF web services aren't always the easiest tool to work with.  They're fine with simple stuff.  But I've had a lot of problems consuming services with complex types. Also with certain types of .NET web services.  Sometimes I have just had to resort to using cfhttp and soap. Because I never could get past the Axis errors.  Sorry, I couldn't be of more help.


> From what I can see, it looks like you're doing everything wrong.

  Correction: doing everything  RIGHT !  
maybe try javacasting the ticket??

JavaCast("com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket", ticket)

I have never tried this so...maybe.... :)
Avatar of CF_PRO

ASKER

you mean

JavaCast(id, "com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket")

?
All I can think of is that CF isn't converting the datatypes, the the datatype is supported a little differently in cf that it is the whatever language the webservice is written in.  Have you tried using a different id? Just in case? Or accessing a different function?
no, just the ticket, or both (but would need two javacast function calls)
> maybe try javacasting the ticket??
> I have never tried this so...maybe.... :)

No, according to the docs that's not allowed for javacast.

Avatar of CF_PRO

ASKER

ok so:

Customer = docxfer.getCustomer(JavaCast("string", id),JavaCast("com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket", ticket));

correct?
Yeah...but I am guessing it didn't work or you wouldn't be asking :(

Hmm, that is a tough one.
SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Is there documentation for this webservice? Does it say what you should be passing in (datatypes and such)?

I am not sure why you are converting from PHP, but you could try accessing the .net or java APIs through CF to run it. I couldn't tell you how to do that though.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CF_PRO

ASKER

I cannot get soap to work on php using https wsdl

Ok I get the following error when I try javacasting both

JavaCast type com.xxxx.www._package.com_syscorp_foundation_services_security_vos.SecurityTicket must be one of the following types: byte, char, short, int, long, float, double, boolean, string, bigdecimal, their corresponding array representation (eg : int[]) or null.
yeah, as agx said, it is not an allowed datatype for that function
Avatar of CF_PRO

ASKER

I can give you guys the wsdl info that pertains to the method I am trying to use.  Let me know if that will help?
Sure, why not? :)
Avatar of CF_PRO

ASKER


<wsdl:message name="getCustomer18In">
<wsdl:part name="id" type="xsd:string"/>
<wsdl:part name="Ticket" type="n10:SecurityTicket"/>
</wsdl:message>

<wsdl:message name="getCustomer18Out">
<wsdl:part name="Result" type="n12:ArrayOfCustomerDocVO"/>
</wsdl:message>

<wsdl:operation name="getCustomer" parameterOrder="sCardNum Ticket">
<wsdl:input name="getCustomer18In" message="tns:getCustomer18In"/>
<wsdl:output name="getCustomer18Out" message="tns:getCustomer18Out"/>
</wsdl:operation>

<wsdl:operation name="getCustomer">
<soap:operation soapAction="getCustomer" style="rpc"/>
<wsdl:input name="getCustomer18In">
<soap:body use="encoded" namespace="x" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:input>

<wsdl:output name="getCustomer18Out">
<soap:body use="encoded" namespace="x" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:output>
Can you post the info for the SecurityTicket type?
ie <wsdl:part name="Ticket" type="n10:SecurityTicket"/>
Avatar of CF_PRO

ASKER

<xsd:complexType name="SecurityTicket">
-
<xsd:all>
<xsd:element name="authenticated" type="xsd:boolean"/>
<xsd:element name="authorizedActions" nillable="true" type="xsd:ArrayOfstring"/>
<xsd:element name="username" nillable="true" type="xsd:string"/>
<xsd:element name="password" nillable="true" type="xsd:string"/>
<xsd:element name="organization" nillable="true" type="xsd:string"/>
<xsd:element name="user" nillable="true" type="xsd:string"/>
<xsd:element name="userdesc" nillable="true" type="xsd:string"/>
<xsd:element name="tracing" type="xsd:boolean"/>
<xsd:element name="monitoring" type="xsd:boolean"/>
<xsd:element name="permittedActions" nillable="true" type="n10:ArrayOfPermittedActions"/>
</xsd:all>
If you dump each of those ticket values, what do you see? Warning, some of them maybe null ie Undefined

<cfdump var="#ticket.authenticated#">
<cfdump var="#ticket.authorizedActions#">
etc....

Avatar of CF_PRO

ASKER

Authenticated:
YES
AuthorizedActions:
array [empty]
username
*****
password
******
organization
******
user
******
userdesc
empty
tracing
NO
monitoring
NO
permittedActions
array
1       
object of com.xxxx.www._package.com_syscorp_foundation_services_security_vos.PermittedActions
Class Name       com.xxxx.www._package.com_syscorp_foundation_services_security_vos.PermittedActions
Methods       
Method       Return Type
equals(java.lang.Object)       boolean
getAuthorizedActions()       java.lang.String[]
getDeserializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)       org.apache.axis.encoding.Deserializer
getPermission()       java.lang.String
getSerializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)       org.apache.axis.encoding.Serializer
getSubject()       java.lang.String
getTypeDesc()       org.apache.axis.description.TypeDesc
hashCode()       int
setAuthorizedActions(java.lang.String[])       void
setPermission(java.lang.String)       void
setSubject(java.lang.String)       void
2       
object of com.xxxx.www._package.com_syscorp_foundation_services_security_vos.PermittedActions
Class Name       com.xxxx.www._package.com_syscorp_foundation_services_security_vos.PermittedActions
Methods       
Method       Return Type
equals(java.lang.Object)       boolean
getAuthorizedActions()       java.lang.String[]
getDeserializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)       org.apache.axis.encoding.Deserializer
getPermission()       java.lang.String
getSerializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)       org.apache.axis.encoding.Serializer
getSubject()       java.lang.String
getTypeDesc()       org.apache.axis.description.TypeDesc
hashCode()       int
setAuthorizedActions(java.lang.String[])       void
setPermission(java.lang.String)       void
setSubject(java.lang.String)       void


Interesting that the permitted actions is empty, I am having my 3rd party looking into this.
I have to let you know that PHP code works in the test environment, and so does the Cold Fusion code.
However this code I am working with now, is in the live environment that uses https, and php failed to work in that environment (I could not even login)
So now I am trying out my coldfusion code, so this permitted actions array could be the stumbling block.
Well, if the same code works in the test environment it is definitely not a problem with the code, it is the environment. You should dump this info out on dev and see if permitted actions is also empty. Otherwise I would work with your provider to resolve any issues with HTTPS transmission.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CF_PRO

ASKER

Sorry I did not mention that before.
I don't think https is the problem, otherwise I would not even been able to get authenticated in coldfusion.
I think it has to do with the permitted actions being empty.  Do you think that logic makes sense?

Is it empty on dev? If not, then that is most likely it.
Yes, it makes sense. What other differences are there between prod and dev?  Also, you can test on prod using http instead of https?  If it works with http, then the issue's related to https. If it doesn't, then it's something else about the prod environment.
Avatar of CF_PRO

ASKER

they don't have http active on the live environment.  The admin is checking my permissions now.
Avatar of CF_PRO

ASKER

Does the error I am getting make sense if my permission were not set right?
> Does the error I am getting make sense if my permission were not set right?

   There's no way for us to know, because the error just says "array...", not which array or where the
   error is occurring.  But it's a good logical guess since some of the ticket properties are arrays.

   (Did you find out if the permissions array is empty on dev too?)
   
.. unfortunately web service error message ie Axis are usually terribly uninformative.
Avatar of CF_PRO

ASKER

I am waiting on the admin and developer to get back to me.  I am praying this is the problem.