Web service - consumer - how to use class(es)?

I’ve written an LotusScript agent that uses a web service consumer to consume a .Net web service.

I’m having a bit of trouble in pushing data to the .Net web service.

The trouble I’m having with is to do with using class objects.

Basics of my agent’s code:

Sub pushData( )

On Error Goto myErrorHandler

currentLog.LogAction “Sub: pushData() - started”

Dim webService As New IAppService_n1

Dim results_xsd As New XSD_String( )

Dim dataObj As New NAV_Data_n1 ’ NAV_Data_n1 has the class object

Dim tmpValue As New XSD_String( )

tmpValue.setValueFromString( “INSERT” )

Set dataObj.ActionType = tmpValue

tmpValue.setValueFromString( “123” )

Set dataObj.Ref = tmpValue

tmpValue.setValueFromString( “Some Data” )

Set dataObj.DataName = tmpValu

set results_xsd = webService.receiveData( dataObj )

Print "results: " + results_xsd.GetValueAsString

Goto quitMe

myErrorHandler:

currentLog.LogError Err , "Line: " + Cstr( Erl ) + ", code: " + Cstr( Err ) + ", msg: " + Error

Resume quitMe

quitMe:

currentLog.LogAction “Sub: pushData() - finished”

End Sub

The line “set results_xsd = webService.receiveData( dataObj )” is causing me headaches - the error message that I receive is:

“Code: 4747, msg: The Web Service IAppService_n1 method receiveData has returned a fault.”

Can someone give me an idea how to resolve this error?

Subject: You Can Use Service.GetLastFault

see details in lsxsd.lssit is in the folder of Lotus notes

example:

Function taskBatchSynch(arg0 As SynchData_n3) As SynchResult_n3

	On Error Goto errh

	Set taskBatchSynch = Service.Invoke("taskBatchSynch", arg0)

	Exit Function

errh:

	On Error Goto errh2

	Dim wf As WS_FAULT

	Set wf=Service.GetLastFault()

	If Not wf Is Nothing Then

		'Msgbox a.a 'won't goto errh2!why?

		If taskBatchSynch Is Nothing Then

			Dim tmp As SynchResult_n3

			Set tmp=New SynchResult_n3()

			tmp.success=False

			Set strObj=New XSD_STRING

			Call strObj.setValueFromString(wf.getFaultString())

			Set tmp.message=strObj

			Set taskBatchSynch=tmp

		End If

	End If

	Exit Function

errh2:

	Print Erl & "," & Error

	Msgbox Erl & "," & Error

	Exit Function

End Function

Subject: Thanks

Thanks Billy_Beam Zheng. It is greatly helpful and works.

Sundar.

Subject: Code is ok

Added some WS_FAULT detection code and discovered that the fault was on the other side.

Subject: WS_FAULT usage

Hello

while am trying to execute the below line of code, I am getting error. But am unable to get the string of fault using WS_FAULT, it returns blank, as I am setting myfault using NEW. Kindly help me to resolve this issue.

Set str_xsd = NewConnector.Storefn(storeobj)

Error 4747 on line 38: The Web Service StoreServiceHostSoap_n13 method Storefn has returned a fault.

If Err = 4747 Then

Dim myfault As WS_FAULT

Set myfault = New WS_FAULT

Messagebox "Logging to console: " & myfault.getFaultString()

Endif

Thanks,

Sundar.

Subject: Idea

I am from Turkey and my system’s default region profile is Turkish.

I used Web Service Consumer and Agent. When my regional setting are Turkish, it gives an error when i run it from my client. When i changed my regional settings from turkish to english (united states), it worked.

Try this ? Change regional setting (first setting on the dialog), select english (united states) and restart notes. Run your agent.

Ferhat

www.bestcoder.net