Tuesday, November 10, 2009

SharePoint 2007 Infopath Web Service Data Connection obscured problem

The issue is very obscured, and as I knew so many admins and developers have the same problem.You could search google if I was not right....
The problem: When you want to create a Web Service Data Connection for Infopath form, after entering the WSDL (web service) URL get the obscured error that says: "Invalid XML document or access denied or so on".
Causes: In fact the problem is not access permission nor invalid XML, so invalid URL for WSDL causes the issue.
Solution: in the web browser open the URL of the web service, if it opened, Click on Service Description link at the line 1 of the page, if you got blank page the URL for web service is not correct, otherwise you will get the coded XML page(right place).
For example you may type the incorect URL for WSDL but the URL exist: http://SERVERNAME/_vti_bin/SERVICE.asmx -> Exist
http://SERVERNAME/_vti_bin/SERVICE.asmx?WSDL ->(After Click) NOT Exist = blank page
even if the URL was incorrect you could open it on your browser but if you click on the Service Desciption link you will get the blank page.In fact the correct path is (to me was):
http://SERVERNAME/Sites/Intranet/_vti_bin/SERVICE.asmx -> Exist
http://SERVERNAME/Sites/Intranet/_vti_bin/SERVICE.asmx -> (After Click) Exist = XML coded page

Wednesday, September 09, 2009

Mapping Sql Data Type to System Type

private Type DeriveCLSType(SqlDataType _SqlDataType)
Type typ = GetType();
switch (_SqlDataType)
case SqlDataType.BigInt:
typ = Type.GetType("System.Int64");

case SqlDataType.Bit:
typ = Type.GetType("System.Boolean");

case SqlDataType.Char:
case SqlDataType.VarChar:
case SqlDataType.VarCharMax:
typ = Type.GetType("System.String");

case SqlDataType.DateTime:
case SqlDataType.SmallDateTime:
typ = Type.GetType("System.DateTime");

case SqlDataType.Decimal:
case SqlDataType.Money:
case SqlDataType.SmallMoney:
typ = Type.GetType("System.Decimal");

case SqlDataType.Int:
typ = Type.GetType("System.Int32");

case SqlDataType.NChar:
case SqlDataType.NText:
case SqlDataType.NVarChar:
case SqlDataType.NVarCharMax:
case SqlDataType.Text:
typ = Type.GetType("System.String");

case SqlDataType.Real:
case SqlDataType.Numeric:
case SqlDataType.Float:
typ = Type.GetType("System.Double");

case SqlDataType.Timestamp:
case SqlDataType.Binary:
typ = Type.GetType("System.Byte");

case SqlDataType.TinyInt:
case SqlDataType.SmallInt:
typ = Type.GetType("System.Int16");

case SqlDataType.UniqueIdentifier:
typ = Type.GetType("System.Guid");

case SqlDataType.UserDefinedDataType:
case SqlDataType.UserDefinedType:
case SqlDataType.Variant:
case SqlDataType.Image:
typ = Type.GetType("System.Object");

typ = Type.GetType("System.String");
return typ;
There was an error in this gadget