Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
jj3001 #1
How to pass array of sting to non-CF web service?
My co-worker develops a Java web service which takes an array of user IDs and
return the email addresses for those IDs.
However, I just can't pass the array of User IDs to his web service. Other
java developers can use his web service without any problem.
Here is part of WSDL:
- <types>
- <s:schema xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:ope="http://www.openuri.org/" elementFormDefault="qualified"
targetNamespace="http://www.openuri.org/">
- <s:element name="getStaffByUsername">
- <s:complexType>
- <s:sequence>
<s:element name="userName" type="ope:ArrayOfString" minOccurs="0" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="getStaffByUsernameResponse">
- <s:complexType>
- <s:sequence>
<s:element name="getStaffByUsernameResult" type="ope:ArrayOfStaffUser"
minOccurs="0" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="ArrayOfStaffUser" nillable="true"
type="ope:ArrayOfStaffUser" />
- <s:complexType name="ArrayOfString">
- <s:sequence>
<s:element name="String" type="s:string" nillable="true" minOccurs="0"
maxOccurs="unbounded" />
</s:sequence>
</s:complexType>
- <s:complexType name="ArrayOfStaffUser">
- <s:sequence>
<s:element name="StaffUser" type="ope:StaffUser" nillable="true"
minOccurs="0" maxOccurs="unbounded" />
</s:sequence>
</s:complexType>
- <s:complexType name="StaffUser">
- <s:sequence>
<s:element name="user_name" type="s:string" minOccurs="0" />
<s:element name="person_id" type="s:string" minOccurs="0" />
<s:element name="user_name_id" type="s:string" minOccurs="0" />
<s:element name="term_date" type="s:string" minOccurs="0" />
<s:element name="prime" type="s:string" minOccurs="0" />
<s:element name="locked" type="s:string" minOccurs="0" />
<s:element name="last_name" type="s:string" minOccurs="0" />
<s:element name="first_name" type="s:string" minOccurs="0" />
<s:element name="middle_name" type="s:string" minOccurs="0" />
<s:element name="group_id" type="s:string" minOccurs="0" />
<s:element name="division_id" type="s:string" minOccurs="0" />
<s:element name="site" type="s:string" minOccurs="0" />
<s:element name="email_address" type="s:string" minOccurs="0" />
<s:element name="employee" type="s:string" minOccurs="0" />
<s:element name="phone_number" type="s:string" minOccurs="0" />
<s:element name="building_id" type="s:string" minOccurs="0" />
<s:element name="room_id" type="s:string" minOccurs="0" />
<s:element name="mail_stop" type="s:string" minOccurs="0" />
<s:element name="publish" type="s:string" minOccurs="0" />
<s:element name="agency" type="s:string" minOccurs="0" />
</s:sequence>
</s:complexType>
</s:schema>
</types>
------------------------------------
And here is my code
<cfscript>
stUser = arrayNew(1);
stUser[1]="ddao";
stUser[2]="kkewt";
</cfscript>
<cfdump var="#stUser#">
<cfinvoke
webservice="http://wye.nist.gov:7001/AMS/AMSLookup/LookupStaffUser.jws?WSDL"
method="getStaffByUsername"
returnvariable="aArrayOfStaffUser">
<cfinvokeargument name="userName" value="#stUser#"/>
</cfinvoke>
--------------------------------------------------------------------------------
----------------------------------------
And here is the error I got:
Could not perform web service invocation "getStaffByUsername".
Here is the fault returned when invoking the web service operation:
java.lang.IllegalArgumentException: argument type mismatch
jj3001 Guest
-
How do you pass an array of structures to webservice?
Hello, Does anyone have an example of how to pass an array of strings (ie purchase Id's) from CF to a web service (like weblogic), and then... -
CFC array pass a URL?
Can you pass a hyperlink as a varaible in an array using CFC and Flash? In other words, I am trying to pass a hyperlink from a CFC to Flash using... -
how to pass multi array as args
Can someone show me how to pass multiple arrays argument? ie - .... mysub(@a, @b, @c); .... sub mysub { my @a = ? #arg1 an array $_ is... -
Can ASP pass an Array into a Function?
Hello, Can anyone tell me if ASP can pass an Array intp a Function? If so, can anyone point me to an example? Thanks in advance. Gram. -
How to pass array values to ASP part
Any values that exist in the client have to be sent back to the server by submitting a form, refreshing a page with a querystring, or some other... -
Unregistered #2
Re: How to pass array of sting to non-CF web service?
All u need to do is pass a structure and it is done this way:
<cfscript>
function SmartArray(lItems,delim)
{
var ArrayContainer=StructNew();
ArrayContainer.string=ListToArray(lItems,delim);
return ArrayContainer;
}
Services = SmartArray("IPLI",",");
</cfscript>
<cfdump var="#Services#">
just pass #Services# as the value... u cannot pass arry like this... u can only give refernce to the arry like abc_array[2] and if your WS excepts a string arrar u need to create a structure as sepcified above... dont pass array with index, it will not except itUnregistered Guest



Reply With Quote

