Link to home
Start Free TrialLog in
Avatar of CloudApps
CloudApps

asked on

User Defined Data Type

I am trying to consume a webservice which requires that I pass 3 values as a single parameter. I have created a module in Access 2007 with the following code.
---------------------------------------------------------------------------------------------------------------------------
Option Compare Database
Option Explicit

Public Type UserIDBean
    UserName As String
    Password As String
    Version As String
End Type
--------------------------------------------------------------------------------------------------------------------------

Public Function TimesheetData(BeginningDate As Date, EndingDate As Date) As Variant
On Error GoTo HandleError

    Dim AdminIDBean As UserIDBean
    Dim objSoapClient As SoapClient30
    Dim varItems As Variant
   
    Set objSoapClient = New SoapClient30
   
    Call objSoapClient.MSSoapInit(par_WSDLFile:="https://timecardweb.econz.com/axis/services/timecard1Soap?wsdl")
    Call objSoapClient.EServiceTimecardSoapInterface.UserIDBean

    AdminIDBean.UserName = "webuser"
    AdminIDBean.Password = "webpassword"
    AdminIDBean.Version = objSoapClient.NADSWebserviceVersion.TIMECARD_VERSION_1

    TimesheetData = Array(objSoapClient.getDetailedHourSummaries(AdminIDBean, BeginningDate, EndingDate, "UTC-6"))

ExitHere:
    Exit Function

HandleError:
    MsgBox "The TimesheetData Function encountered an unexpected error. " & Chr(13) + Chr(10) & _
        "The Error Number is: " & Err.Number & Chr(13) + Chr(10) & _
        "The Error Description is: " & Err.Description, vbExclamation, "Error Handling Routine"
    Resume ExitHere

End Function
-------------------------------------------------------------------------------------------------------------------------------

Compile Error:

Only user-defined types defined in public object modules can be coerced to or from a variant or passed to late-bound functions.

The AdminIDBean is highlighted.

Thanks for the help.
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

That would be expected - the web service has no way of know what your AdminIDBean is, or how it's constructed, or how to use it.

Do you have an documentation regarding the use of the web service, and what format it expects those values to come in?
I've only seen that error twice in my Access life of 19 years ... and both in the same week!

You might want to look HERE:

See the screen shot - where I got the exact same error, during testing of the issue.

mx
Avatar of CloudApps
CloudApps

ASKER

LSMConsulting

UserIDBean Description

Each method call on the SOAP interface requires that the user name and password of an EService or Timecard organisation administrator be passed in for authentication purposes. The user will normally be the original administrator set up when the organisation was initially created.

The data fields of this object.

Name           Type    Size  Required Description
UserName   String  30    Yes            The user name of an administrator of the organisation.
Password     String  32    Yes            The password for the administrator.
Version        NADSWebserviceVersion
-----------------------------------------------------------------------------------------------------------------------------
Here is the webservice that I am trying to consume.

Methods to Retrieve Processed Data

Returns: Array of DetailedHourBreakdownBean

Method: getDetailedHourSummaries

Parameters: UserIDBean, start, end, showUserTZFlag

Description: Hourly breakdowns, adhering to the IDI specification, for all users in the given time period.
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
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
LSMConsulting,

There is a VB/SOAP version of the webservice.

I took your suggestion to built the UserIDBean as a class.

My code will compile now!

I still have issues consuming the webservice, but I think that the answers will have to come from Econz.

Thanks so much for your help and research.

Have a great weekend!