When defining the web service event I could not get the right return parameter type. This is the code it generates. The webservice returns xmlnode. What type of datatype do I define in K2 XMLField to get the value in the return XML? :oops:
ompiling GetSupervisor(Event)...
Compile Error: GetSupervisor(Event) Line 14: Value of type 'System.Xml.XmlNode' cannot be converted to 'String'.
Compile Error: GetSupervisor(Event) Line 15: Identifier expected.
Sub Main(ByVal K2 As ServerEventContext)
K2.Synchronous = True
CallWebService(K2)
End Sub
Sub CallWebService(ByVal K2 As ServerEventContext)
Dim oWebService As New DataAccess
Try
Dim Param0 as System.String = K2.ProcessInstance.DataFields("WhoIsItFor").Value
oWebService.Url = "http://" & K2.StringTable("WebAppServer") & "/webservices/dataaccess.asmx"
oWebService.Credentials = SourceCode.K2Utilities.GeneralMod.GetCredentials(oWebService.Url)
K2.ProcessInstance.XmlFields("GetSupervisor").Value = SourceCode.K2Utilities.XMLFieldMod.SetXMLValue(K2.ProcessInstance.XmlFields("GetSupervisor").Value, "Root", oWebService.GetSupervisor(Param0))
SourceCode.K2Utilities.XMLFieldMod.
Catch ex As Exception
Throw ex
Finally
oWebService = Nothing
End Try
End Sub
The web service returns this:
<?xml version="1.0" encoding="utf-8" ?>
- <SUPERVISOR>
- <ROW>
<NAME>Yao, Peter</NAME>
</ROW>
</SUPERVISOR>
Page 1 / 1
Hi Peter,
try this. modify ur code accordingly as per the below
Dim xn As System.Xml.XmlNode
oWebService.Url = "http://" & K2.StringTable("WebAppServer") & "/webservices/dataaccess.asmx"
oWebService.Credentials = SourceCode.K2Utilities.GeneralMod.GetCredentials(oWebService.Url)
xn = oWebService.GetSupervisor(Param0)
xn = xn.SelectSingleNode("ROW/NAME")
K2.ProcessInstance.XmlFields("GetSupervisor").Value = xn.InnerText
hope this works ...
K2 doesn't have datatype to hold xmlnode.
wish there might be better way than this.
try this. modify ur code accordingly as per the below
Dim xn As System.Xml.XmlNode
oWebService.Url = "http://" & K2.StringTable("WebAppServer") & "/webservices/dataaccess.asmx"
oWebService.Credentials = SourceCode.K2Utilities.GeneralMod.GetCredentials(oWebService.Url)
xn = oWebService.GetSupervisor(Param0)
xn = xn.SelectSingleNode("ROW/NAME")
K2.ProcessInstance.XmlFields("GetSupervisor").Value = xn.InnerText
hope this works ...
K2 doesn't have datatype to hold xmlnode.
wish there might be better way than this.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.