D
DGibson
I am currently testing using the GetMyProfile web service that is included
with Microsoft's Status Report example. The web service is installed and the
Status Report sample form works just fine.
I created a new form and setup a data connection to the webservice and can
query the service without any problem. What I'm trying to do now is to use
JScript to grab the data and put it in a variable that I can then use.
function XDocument::OnLoad(eventObj)
{
var oWebService = XDocument.DataObjects.Item("GetMyProfile");
oWebService.DOM.setProperty("SelectionNamespaces",
"xmlns:dfs='http://schemas.microsoft.com/office/infopath/2003/dataFormSolution'
xmlns:tns='http://tempuri.org'
xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-01-30T22:22:25'");
oWebService.Query();
var oResponse =
oWebService.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/tns:GetMyProfileResponse");
}
I redeclared the "my:" namespace just in case.
This all appears to work correctly and I can programmatically confirm that
the oResponse variable isn't null. However, I can't seem to pull any data
from it.
I've attempted XDocument.UI.Alert(oResponse); but it gives a type:mismatch
error (I'm assuming that oResponse isn't a string).
I have attempted the following code to retrieve just one value, but I think
the namespace prefix is what's keeping this from working:
var oAccount = oResponse.selectSingleNode("//s0:AccountName");
All this code does is return a "'null' is null or not an object" error
(which is the error I would get if I put in any old garbage name for a node.
I have also attempted "//my:AccountName", "//dfs:AccountName", and
"//tns:AccountName" just in case the variable picked up its namespace from
the web service, but all of them return the same error.
So, my guess is that because I'm not specifying the correct namespace
prefix, it can't find the AccountName data in oResponse?
with Microsoft's Status Report example. The web service is installed and the
Status Report sample form works just fine.
I created a new form and setup a data connection to the webservice and can
query the service without any problem. What I'm trying to do now is to use
JScript to grab the data and put it in a variable that I can then use.
function XDocument::OnLoad(eventObj)
{
var oWebService = XDocument.DataObjects.Item("GetMyProfile");
oWebService.DOM.setProperty("SelectionNamespaces",
"xmlns:dfs='http://schemas.microsoft.com/office/infopath/2003/dataFormSolution'
xmlns:tns='http://tempuri.org'
xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-01-30T22:22:25'");
oWebService.Query();
var oResponse =
oWebService.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/tns:GetMyProfileResponse");
}
I redeclared the "my:" namespace just in case.
This all appears to work correctly and I can programmatically confirm that
the oResponse variable isn't null. However, I can't seem to pull any data
from it.
I've attempted XDocument.UI.Alert(oResponse); but it gives a type:mismatch
error (I'm assuming that oResponse isn't a string).
I have attempted the following code to retrieve just one value, but I think
the namespace prefix is what's keeping this from working:
var oAccount = oResponse.selectSingleNode("//s0:AccountName");
All this code does is return a "'null' is null or not an object" error
(which is the error I would get if I put in any old garbage name for a node.
I have also attempted "//my:AccountName", "//dfs:AccountName", and
"//tns:AccountName" just in case the variable picked up its namespace from
the web service, but all of them return the same error.
So, my guess is that because I'm not specifying the correct namespace
prefix, it can't find the AccountName data in oResponse?