Is anyone out there using Flex with StrikeIron OR using a web service
that uses ENUMS? I am having a specific problem that I can't seem to
resolve. I would love some insight from anyone who may have
experience with Webservices. Thanks!
Here is the problem & code:
I am trying to load the webservice which verifies an address against
the USPS database. My other StrikeIron webservices work fine, BUT
thus don't contain enums in the webservice.
WSDL: http://ws.strikeiron.com/USAddressVerification4_0?WSDL
var params: Object = new Object();
params.addressLine1 = "215 W 91st St";
params.addressLine2 = "Apt 82";
params.city_state_zip = "New York, NY 10024";
params.firm = '';
params.urbanization = '';
params.casing = 'Proper';
var service:WebService;
this.service = ServiceLocator.getInstance().getWebService
("verifyUSPSAddress"); //this is defined in another Services.mxml file
var strikeIronLicense:Object = {LicenseInfo:{RegisteredUser:
{UserID:"[EMAIL PROTECTED]",Password:"gobears1"}}};
var qName: QName = new QName("http://ws.strikeiron.com","LicenseInfo");
var soapHeader:SOAPHeader = new SOAPHeader(qName,strikeIronLicense);
service.addHeader(soapHeader);
var call : Object =
service.VerifyAddressUSA.send
(params.addressLine1,params.addressLine2,params.city_state_zip,params.fi
rm,params.urbanization,params.casing);
call.addResponder( responder ); //handle the result
Here is the error message that I am getting in Flex:
[RPC Fault faultString="Cannot find definition for type 'http://
www.strikeiron.com::casingEnum'" faultCode="EncodingError"
faultDetail="null"]
at mx.rpc.soap::Operation/http://www.adobe.com/2006/flex/mx/
internal::invokePendingCall()[E:\dev\flex_201_borneo\sdk\frameworks\mx
\rpc\soap\Operation.as:544]
at mx.rpc.soap::Operation/http://www.adobe.com/2006/flex/mx/
internal::invokeAllPending()[E:\dev\flex_201_borneo\sdk\frameworks\mx
\rpc\soap\Operation.as:504]
at mx.rpc.soap::AbstractWebService/
mx.rpc.soap:AbstractWebService::unEnqueueCalls()[E:\dev
\flex_201_borneo\sdk\frameworks\mx\rpc\soap\AbstractWebService.as:453]
at mx.rpc.soap::WebService/http://www.adobe.com/2006/flex/mx/
internal::wsdlHandler()[E:\dev\flex_201_borneo\sdk\frameworks\mx\rpc
\soap\WebService.as:258]
Here is the response from StrikeIron:
We do not have a ‘consulting’ group on site, but I’ll continue to
look into it. The error would seem to indicate that the enumeration
for the casing[Proper, Upper, Lower] is not being handled correctly.
In most other languages where the WSDL is parsed dynamically at run-
time, using a string for this enum is perfectly fine. I’m not sure
if flex allows this. Is there perhaps a way to force an enumeration
from a string?
The WSDL also shows the casing enum as having a default value of
“Upper”. You should be able to leave this out completely as in other
languages.
Sorry I couldn’t exactly fix your problem. You might want to ask
around on some flex forums on how to handle enumerations. Let me
know if you get it to work.