I am trying to use a webservice with infopath forms.
I have created a dataconnection for the webservice.
I am using VS.NET (C#.NET) for accessing the webservice using the following code in onload event of the ...
CodeSnippet
[InfoPathEventHandler(EventType=InfoPathEventType.OnLoad)]
public void OnLoad(DocReturnEvent e)
{
DataObject dtObj= thisXDocument.DataObjects["GetWorkFlowDetails"] ;
IXMLDOMDocument2 domTmp=(IXMLDOMDocument2)dtObj.DOM;
domTmp.setProperty("SelectionNamespaces",
" xmlns:dfs=\"schemas.microsoft.com/.../dataFormSolution\""
+ " xmlns:tns=\"http://tempuri.org/\"");
domTmp.selectSingleNode("/dfs:myFields/dfs:queryFields/tns:GetWorkFlowDetails/tns:WorkFlowType").text="ABSR";
dtObj.Query();
string currentAction= domTmp.selectSingleNode("/dfs:myFields/dfs:dataFields/tns:GetWorkFlowDetailsResponse/tns:GetWorkFlowDetailsResult/ABSR/CurrentActions").text;
thisXDocument.UI.Alert (currentAction);
}
I am getting the following error.
System.NullReferenceException
Object reference not set to an instance of an object.
at Leave_Request.Leave_Request.OnLoad(DocReturnEvent e) in c:\inetpub\wwwroot\leave request\formcode.cs:line 63
at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnLoad(DocReturnEvent pEvent)
But when I try to access the same through browser, it works fine.
I am unable to understand the exact problem. Can someone help me out in solving this issue.
Do you know someone who can help? Share a link to this thread on twitter, or facebook.