Web service parameters and secondary data source

R

Rob Blitz

If I'm using a web service as a secondary data source to populate a field,
but the web service takes an input parameter that I won't know until run
time (e.g., the user's logon ID), how would I pass it? I can't seem to set
the input node of the data source.
 
S

Steve van Dongen [MSFT]

R

Rob Blitz

Steve,
Thanks. I tried that but VS.NET gives me a build error:
'Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMDocument' does not
contain a definition for 'setProperty'
when I try to build this method:
private void GetBaseFormData()

{

IXMLDOMDocument infoDOM = thisXDocument.GetDOM("GetUserInfo");


thisXDocument.UI.Alert(infoDOM.documentElement.namespaceURI);

DataObject wsDO = thisXDocument.DataObjects["GetUserInfo"];

wsDO.DOM.setProperty("SelectionNamespaces",

"xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolut
ion\" " +

"xmlns:s0=\"http://tempuri.org/\"");

IXMLDOMNode node =
infoDOM.selectSingleNode("/dfs:queryFields/s0:GetUserInfo/s0:userLogin");

node.text = System.Environment.UserName;

//fetch the data from the web service

wsDO.Query();

}

Will this work in script only?
 
R

Rob Blitz

never mind... I figured out that I had to cast to a higher version of the
DOM Document:


Rob Blitz said:
Steve,
Thanks. I tried that but VS.NET gives me a build error:
'Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMDocument' does not
contain a definition for 'setProperty'
when I try to build this method:
private void GetBaseFormData()

{

IXMLDOMDocument infoDOM = thisXDocument.GetDOM("GetUserInfo");


thisXDocument.UI.Alert(infoDOM.documentElement.namespaceURI);

DataObject wsDO = thisXDocument.DataObjects["GetUserInfo"];

wsDO.DOM.setProperty("SelectionNamespaces",

"xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolut
ion\" " +

"xmlns:s0=\"http://tempuri.org/\"");

IXMLDOMNode node =
infoDOM.selectSingleNode("/dfs:queryFields/s0:GetUserInfo/s0:userLogin");

node.text = System.Environment.UserName;

//fetch the data from the web service

wsDO.Query();

}

Will this work in script only?
 
R

Rob Blitz

Here's the revised method...

private void GetBaseFormData()

{


IXMLDOMDocument3 sdoDOM = (IXMLDOMDocument3)
thisXDocument.DataObjects["GetUserInfo"].DOM;

sdoDOM.setProperty("SelectionNamespaces",

"xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolut
ion\" " +

"xmlns:s0=\"http://tempuri.org/\"");

IXMLDOMNode node =
sdoDOM.selectSingleNode("/dfs:myFields/dfs:queryFields/s0:GetUserInfo/s0:use
rLogin");

node.text = System.Environment.UserName;

//fetch the data from the web service

thisXDocument.DataObjects["GetUserInfo"].Query();

}



Rob Blitz said:
Steve,
Thanks. I tried that but VS.NET gives me a build error:
'Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMDocument' does not
contain a definition for 'setProperty'
when I try to build this method:
private void GetBaseFormData()

{

IXMLDOMDocument infoDOM = thisXDocument.GetDOM("GetUserInfo");


thisXDocument.UI.Alert(infoDOM.documentElement.namespaceURI);

DataObject wsDO = thisXDocument.DataObjects["GetUserInfo"];

wsDO.DOM.setProperty("SelectionNamespaces",

"xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolut
ion\" " +

"xmlns:s0=\"http://tempuri.org/\"");

IXMLDOMNode node =
infoDOM.selectSingleNode("/dfs:queryFields/s0:GetUserInfo/s0:userLogin");

node.text = System.Environment.UserName;

//fetch the data from the web service

wsDO.Query();

}

Will this work in script only?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top