Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coldfusion Webservices - WSDL...HELP!!!

Status
Not open for further replies.

etelford

Programmer
Nov 2, 2003
4
I am trying to do an update alias method now...

this is my code:

<cfinvoke webservice=&quot; method=&quot;updateAlias&quot; returnvariable=&quot;aGenericResult&quot;>
<cfinvokeargument name=&quot;authUserName&quot; value=&quot;me@mydomain.com&quot;/>
<cfinvokeargument name=&quot;authPassword&quot; value=&quot;my_password&quot;/>
<cfinvokeargument name=&quot;domainName&quot; value=&quot;mydomain.com&quot;/>
<cfinvokeargument name=&quot;aliasName&quot; value=&quot;alias@mydomain.com&quot;/>
<cfinvokeargument name=&quot;addresses&quot; value=&quot;username_to_add@mydomain.com&quot;/>
</cfinvoke>

When I try this, I get this error:

&quot;Could not perform web service invocation &quot;updateAlias&quot; because java.lang.IllegalArgumentException: argument type mismatch&quot;

I believe the problem is with the &quot;addresses&quot; argument. The documention says the format is ArrayOfString, but I can't figure out what exactly that means and how it pertains to how I should format the address.

I have also tried this...

<cfset aArrayToString=&quot;StructNew()&quot;>
<cfset AArrayToString.string=&quot;username_to_add@mydomain.com&quot;>

<cfinvoke webservice=&quot; method=&quot;updateAlias&quot; returnvariable=&quot;aGenericResult&quot;>
<cfinvokeargument name=&quot;authUserName&quot; value=&quot;me@mydomain.com&quot;/>
<cfinvokeargument name=&quot;authPassword&quot; value=&quot;my_password&quot;/>
<cfinvokeargument name=&quot;domainName&quot; value=&quot;mydomain.com&quot;/>
<cfinvokeargument name=&quot;aliasName&quot; value=&quot;my_alias&quot;/>
<cfinvokeargument name=&quot;addresses&quot; value=&quot;#username_to_add@mydomain.com#&quot;/>
</cfinvoke>

This throws this error:

Web service operation &quot;UpdateAlias&quot; with parameters {aliasName={my_alias},domainName={mydomain.com},authUserName={me@mydomain.com},addresses={{STRING2={username_to_add@mydomain.com},}},authPassword={my_password},} could not be found.

Lastly, if I do this...

<cfset aArrayToString=&quot;StructNew()&quot;>

<cfinvoke webservice=&quot; method=&quot;updateAlias&quot; returnvariable=&quot;aGenericResult&quot;>
<cfinvokeargument name=&quot;authUserName&quot; value=&quot;me@mydomain.com&quot;/>
<cfinvokeargument name=&quot;authPassword&quot; value=&quot;my_password&quot;/>
<cfinvokeargument name=&quot;domainName&quot; value=&quot;mydomain.com&quot;/>
<cfinvokeargument name=&quot;aliasName&quot; value=&quot;my_alias&quot;/>
<cfinvokeargument name=&quot;addresses&quot; value=&quot;#aArrayToString#&quot;/>
</cfinvoke>

I do not get any error. So, it is excepting the #aArrayToString# variable, but since it is blank, it actually deletes all users in the specified alias. This is the closest I have got to getting this to work.

Any thoughts?

Erik Telford
erik@mangom2.com
 
Well... first, it's a bit odd that your last example doesn't throw an error.
Code:
<cfset aArrayOfString=&quot;StructNew()&quot;>
is not creating a struct, it's simply filling a string variable with the value &quot;StructNew()&quot; (in order for it to create a structure, you'd need to not have the StructNew() surrounded by quotes. So, I'm a little confused how your CFINVOKEARGUMENT for addresses will accept a variable that's a string, but not a string directly.

Have you simply tried:
Code:
<cfset aArrayToString=&quot;username_to_add@mydomain.com&quot;>

<cfinvoke webservice=&quot;[URL unfurl="true"]http://mail.mydomain.com/Services/svcAliasAdmin.asmx?WS...;[/URL] method=&quot;updateAlias&quot; returnvariable=&quot;aGenericResult&quot;>
<cfinvokeargument name=&quot;authUserName&quot; value=&quot;me@mydomain.com&quot;/>
<cfinvokeargument name=&quot;authPassword&quot; value=&quot;my_password&quot;/>
<cfinvokeargument name=&quot;domainName&quot; value=&quot;mydomain.com&quot;/>
<cfinvokeargument name=&quot;aliasName&quot; value=&quot;my_alias&quot;/>
<cfinvokeargument name=&quot;addresses&quot; value=&quot;#aArrayToString#&quot;/>
</cfinvoke>

While WSDL is a standard, it's an emerging standard, and some coders tend to take some liberties with how certain data types are handled, so it may take a bit of experimentation to hit on something that works.


A second suggestion would be to possibly use an array, rather than a structure?
Code:
<CFSET aArrayOfString=ArrayNew(1)>
<CFSET ArrayAppend(aArrayOfString,&quot;username_to_add@mydomain.com&quot;)>

<cfinvoke webservice=&quot;[URL unfurl="true"]http://mail.mydomain.com/Services/svcAliasAdmin.asmx?WS...;[/URL] method=&quot;updateAlias&quot; returnvariable=&quot;aGenericResult&quot;>
<cfinvokeargument name=&quot;authUserName&quot; value=&quot;me@mydomain.com&quot;/>
<cfinvokeargument name=&quot;authPassword&quot; value=&quot;my_password&quot;/>
<cfinvokeargument name=&quot;domainName&quot; value=&quot;mydomain.com&quot;/>
<cfinvokeargument name=&quot;aliasName&quot; value=&quot;my_alias&quot;/>
<cfinvokeargument name=&quot;addresses&quot; value=&quot;#aArrayOfString#&quot;/>
</cfinvoke>


-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top