Coldfusion create instance of class from data element when cosuming a webservice

jb20147 used Ask the Experts™
I am calling the following wsdl via cfobject

I am attempting to call the following method registerDonor(java.lang.String, java.lang.String, which references the CreateRegistrationRequest data element.

I haven't been successful in creating an instance of the CreateRegistrationRequest class and setting values of its members, as well as the Phone class which is also a data element.

Any assistance would be greatly appreciated in creating instances of methods located in the targetNamespace="" of the wsdl.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2015
As I'm sure you know, consuming web services involves a lot of trial and error.  The code below should at least get you to the login stage.  Obviously I don't have a login, so the straight code returns an error "Invalid UserId Or Password " ;-)  
	create registration request object 
	most fields are optional according to the wsdl
<cfset regRequest = structNew()>
<cfset regRequest.clientRegistrationId = "some string value"/>
<cfset regRequest.clinicInfo =  "some string value"/>
<cfset regRequest.deptIDRandomTestCode = "some string value"/>
<cfset regRequest.donorAdditionalIdentifier  = "some string value"/>
<cfset regRequest.donorDateOfBirth = "1975-02-15"/>
<!--- phone is separate structure --->
<cfset regRequest.donorDayPhone  = structNew()/>
<cfset regRequest.donorDayPhone.areaCode = "999">
<cfset regRequest.donorDayPhone.countryCode = "1">
<cfset = "555">
<cfset regRequest.donorDayPhone.extension = "123">
<cfset regRequest.donorDayPhone.station = "1212">

     use same type structure for regRequest.donorEvePhone  if needed ...
<cfset regRequest.donorHackNumber  = "some string value"/>
<cfset regRequest.donorId  = "some string value"/>
<cfset regRequest.donorLicenseExpirationDate = "2010-12-31">
<cfset regRequest.donorNameFirst= "some string value"/>
<cfset regRequest.donorNameLast= "some string value"/>
<cfset regRequest.donorNameMiddleInitial= "some string value"/>
<cfset regRequest.donorReasonForTest= "some string value"/>
<cfset regRequest.donorSex= "some string value"/>
<cfset regRequest.donorSSN= "some string value"/>
<cfset regRequest.donorStateOfResidence= "some string value"/>
<cfset regRequest.observedCollectionRequested = true>
<!--- optional array --->
<cfset regRequest.panelId= arrayNew(1)/>
<cfset regRequest.paroleOfficer= "some string value"/>
<cfset regRequest.physicianId= "some string value"/>
<cfset regRequest.registrationExpirationDate = "2010-12-31">
<cfset regRequest.splitSpecimenRequested = false>

<cfset regRequest.accountLocationCode= "some string value"/>
<cfset regRequest.accountNumber= "some string value"/>

<cfset svc = createObject("webservice", "")>
<cfset svc.registerDonor(userID="string user id", password="string password", registration=regRequest)>

Open in new window

Most Valuable Expert 2015

BTW:  According to the wsdl most of the fields are optional. But the example includes sample values that should demonstrate what values are expected.. I think.


Worked perfectly. I was totally over thinking this.

Thanks for your help.  
Most Valuable Expert 2015

You're welcome :)  You never know with web services. Sometimes what should be simple ends up being really complex. Glad it was the other way around with this one.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial