web service parameter is null

B

Bryan

I hope that someone will be able to cease my suffering and be able to
help me out.
I am trying to update a sql database using a web service and infoPath.
The problem arises in that it appears as though nothing is being sent
to the actual web service. The parameter is null.

This is the code I use to send the information to the web service.
var objEnv = new ActiveXObject("MSXML2.DOMDocument.5.0");

var elNew = objEnv.createElement("soap:Envelope");
elNew.setAttribute("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance");
elNew.setAttribute("xmlns:xsd","http://www.w3.org/2001/XMLSchema");
elNew.setAttribute("xmlns:soap","http://schemas.xmlsoap.org/soap/envelope/");
var elCur = elNew;
objEnv.appendChild(elNew);
elNew = objEnv.createElement("soap:Body");
elCur.appendChild(elNew);
elCur = elNew;
elNew = objEnv.createElement("lang");
elNew = XDocument.DOM.selectSingleNode("//my:new_language");
elCur.appendChild(elNew);
elCur = elNew;

var objSoap = new ActiveXObject("MSXML2.XMLHTTP.5.0");
objSoap.open("POST","http://tron/TMO2YOU/language.asmx?op=lang",false);
objSoap.setRequestHeader("Content-Type","text/xml; charset=UTF-8");
objSoap.setRequestHeader("SOAPAction","http://www.kctmo.org.uk/webServices/lang");
objSoap.send(objEnv.xml);

this is the web service code:

[WebMethod(Description="New Language")]
public bool lang(string lang)
{
bool retVal = false;
string info = lang;
if (info == null)
{
return false;
}
openDB();
DataSet Lan = new DataSet();
string sql = string.Format(@"select * from tblLANGUAGE");
SqlDataAdapter sqlAdap = new SqlDataAdapter(sql, sqlCon);
sqlAdap.Fill(Lan);
SqlCommandBuilder sqlbuild = new SqlCommandBuilder(sqlAdap);
DataRow dr = Lan.Tables[0].NewRow();
XmlDocument xDoc = new XmlDocument();
try
{
//xDoc.LoadXml(infoDoc);
}
catch (Exception ex)
{
string message = string.Format(@"Unable to load Xml File \n{1}\n
{0}",ex.Message, lang);
throw(new SoapException(message,SoapException.ClientFaultCode));
}

try
{

XmlNamespaceManager nsmgr = new
XmlNamespaceManager(xDoc.NameTable);
nsmgr.AddNamespace("my","http://schemas.microsoft.com/office/infopath/2003/myXSD/2004-07-01T14:16:34");

//dr["LAN_DESCRIPTION"] =
xDoc.SelectSingleNode("//my:New_language/my:new_language",nsmgr).InnerText;
dr["LAN_DESCRIPTION"] = info;
Lan.Tables[0].Rows.Add(dr);
sqlAdap.Update(Lan);
retVal = true;
}
catch (Exception e)
{
string message = string.Format(@"Failed to add new Language
\n{1}\n {0}",e.Message, lang);
throw(new SoapException(message,SoapException.ClientFaultCode));
}

return retVal;

}


The web service is working correctly and I am able to send information
to the web service through a standard .net web page and test it
manually on the server. It only has this problem when submitting
through infoPath
Any help that can be offered would be gratefully appreciated.
 
S

sakieboy

Did you ever get this issue resolved? I'm getting the same thing...
Server was unable to process request. ---> System.InvalidOperationException:
Update unable to find TableMapping['Cust'] or DataTable 'Cust'.

Please email me at (e-mail address removed), because I seldom ever come to this site.


Bryan said:
I hope that someone will be able to cease my suffering and be able to
help me out.
I am trying to update a sql database using a web service and infoPath.
The problem arises in that it appears as though nothing is being sent
to the actual web service. The parameter is null.

This is the code I use to send the information to the web service.
var objEnv = new ActiveXObject("MSXML2.DOMDocument.5.0");

var elNew = objEnv.createElement("soap:Envelope");
elNew.setAttribute("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance");
elNew.setAttribute("xmlns:xsd","http://www.w3.org/2001/XMLSchema");
elNew.setAttribute("xmlns:soap","http://schemas.xmlsoap.org/soap/envelope/");
var elCur = elNew;
objEnv.appendChild(elNew);
elNew = objEnv.createElement("soap:Body");
elCur.appendChild(elNew);
elCur = elNew;
elNew = objEnv.createElement("lang");
elNew = XDocument.DOM.selectSingleNode("//my:new_language");
elCur.appendChild(elNew);
elCur = elNew;

var objSoap = new ActiveXObject("MSXML2.XMLHTTP.5.0");
objSoap.open("POST","http://tron/TMO2YOU/language.asmx?op=lang",false);
objSoap.setRequestHeader("Content-Type","text/xml; charset=UTF-8");
objSoap.setRequestHeader("SOAPAction","http://www.kctmo.org.uk/webServices/lang");
objSoap.send(objEnv.xml);

this is the web service code:

[WebMethod(Description="New Language")]
public bool lang(string lang)
{
bool retVal = false;
string info = lang;
if (info == null)
{
return false;
}
openDB();
DataSet Lan = new DataSet();
string sql = string.Format(@"select * from tblLANGUAGE");
SqlDataAdapter sqlAdap = new SqlDataAdapter(sql, sqlCon);
sqlAdap.Fill(Lan);
SqlCommandBuilder sqlbuild = new SqlCommandBuilder(sqlAdap);
DataRow dr = Lan.Tables[0].NewRow();
XmlDocument xDoc = new XmlDocument();
try
{
//xDoc.LoadXml(infoDoc);
}
catch (Exception ex)
{
string message = string.Format(@"Unable to load Xml File \n{1}\n
{0}",ex.Message, lang);
throw(new SoapException(message,SoapException.ClientFaultCode));
}

try
{

XmlNamespaceManager nsmgr = new
XmlNamespaceManager(xDoc.NameTable);
nsmgr.AddNamespace("my","http://schemas.microsoft.com/office/infopath/2003/myXSD/2004-07-01T14:16:34");

//dr["LAN_DESCRIPTION"] =
xDoc.SelectSingleNode("//my:New_language/my:new_language",nsmgr).InnerText;
dr["LAN_DESCRIPTION"] = info;
Lan.Tables[0].Rows.Add(dr);
sqlAdap.Update(Lan);
retVal = true;
}
catch (Exception e)
{
string message = string.Format(@"Failed to add new Language
\n{1}\n {0}",e.Message, lang);
throw(new SoapException(message,SoapException.ClientFaultCode));
}

return retVal;

}


The web service is working correctly and I am able to send information
to the web service through a standard .net web page and test it
manually on the server. It only has this problem when submitting
through infoPath
Any help that can be offered would be gratefully appreciated.
 

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