Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

User Defined Data Type

Posted on 2012-03-15
5
Medium Priority
?
473 Views
Last Modified: 2012-03-16
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.
0
Comment
Question by:CloudApps
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 85
ID: 37726449
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?
0
 
LVL 75
ID: 37726668
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
0
 

Author Comment

by:CloudApps
ID: 37726876
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.
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 37728622
I believe the web service you're working with requires you to connect with Java, not VBA/SOAP. Here's what I found from http://eservice.econz.co.nz/SOAP/timecardsoap1/nz/co/econz/nads/timecard1/Timecard1Soap.html#getDetailedUserHourSummary(nz.co.econz.nads.soap2.UserIDBean,%20java.lang.String,%20java.util.Calendar,%20java.util.Calendar,%20boolean)

getDetailedUserHourSummary(nz.co.econz.nads.soap2.UserIDBean userBean,
                                                            java.lang.String userPK,
                                                            java.util.Calendar startDate,
                                                            java.util.Calendar endDate,
                                                            boolean showUserTZFlag)
                                                            throws java.rmi.RemoteException

The UserBean datatype seems to be a class of some sort, so you might try instantiating a class and passing that in:

Dim UserIDBean As New userBean
UserIDBean.UserName = "MyUser"
UserIDBean.Password = "MyPassword"
UserIDBean.Version = "YourVersion"

Now pass in that class (although the compiler will probably deny that as well). I'm not sure this is how you declare the userBean class, since I don't have the documentation for it - or even if you CAN declare it.

As I said earlier, this appears to be a Java-based service. If that's the case, you won't be able to work with this from VBA.

Have you contacted the Econz people to see if they have any VB/VB examples of using the service?
0
 

Author Closing Comment

by:CloudApps
ID: 37730024
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!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question