File attachment for Infopath form based on Web Service - InfoPath Dev
in

InfoPath Dev

File attachment for Infopath form based on Web Service

Last post 02-21-2011 10:35 PM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 02-21-2011 07:41 AM

    File attachment for Infopath form based on Web Service

    Hi All,

    I have a browser enabled form that is based on a web service and uses that web service to connect to a SQL database.

    The form is publised to Sharepoint and can be filled in by our users there, and when submitted the form is submitted to the Database and also to Sharepoint, but all the data is pulled from the database by the forms GUID.

    I now have a requirement for a file attachment which would allow the user to submit an attachment with the form that would be stored in the database.

    I created a basic table called Attachments, with the fields ID, ptFormGUID (FK) and Attachment which is a VarBinary(MAX) field.

    I then added this table to the table list in our web service and added it to the dataset (.xsd). I then refreshed the data connections in Infopath and added the control, uploaded it to Sharepoint and attempted to add an attachment.

    The form said it submitted succesfully but when I checked the table whilst a new client had been entered in the client table, there was no new record in the Attachment table.

    I then tried to submit the form from the local client and got this error

     

    InfoPath cannot submit the form.
    Some rules were not applied.
    InfoPath cannot submit the form.
    An error occurred while the form was being submitted.
    The SOAP response indicates that an error occurred:

    System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (5, 3562). ---> System.InvalidOperationException: Nested table 'dsForms1' which inherits its namespace cannot have multiple parent tables in different namespaces.
       at System.Data.DataRelation.CheckNamespaceValidityForNestedRelations(String ns)
       at System.Data.DataRelationCollection.AddCore(DataRelation relation)
       at System.Data.DataRelationCollection.DataSetRelationCollection.AddCore(DataRelation relation)
       at System.Data.DataRelationCollection.Add(DataRelation relation)
       at System.Data.XSDSchema.InstantiateTable(XmlSchemaElement node, XmlSchemaComplexType typeNode, Boolean isRef)
       at System.Data.XSDSchema.HandleTable(XmlSchemaElement node)
       at System.Data.XSDSchema.HandleParticle(XmlSchemaParticle pt, DataTable table, ArrayList tableChildren, Boolean isBase)
       at System.Data.XSDSchema.HandleComplexType(XmlSchemaComplexType ct, DataTable table, ArrayList tableChildren, Boolean isNillable)
       at System.Data.XSDSchema.InstantiateTable(XmlSchemaElement node, XmlSchemaComplexType typeNode, Boolean isRef)
       at System.Data.XSDSchema.HandleTable(XmlSchemaElement node)
       at System.Data.XSDSchema.HandleDataSet(XmlSchemaElement node, Boolean isNewDataSet)
       at System.Data.XSDSchema.LoadSchema(XmlSchemaSet schemaSet, DataSet ds)
       at System.Data.DataSet.InferSchema(XmlDocument xdoc, String[] excludedNamespaces, XmlReadMode mode)
       at System.Data.DataSet.ReadXml(XmlReader reader, Boolean denyResolving)
       at NBSWebService.dsForms1.ReadXmlSerializable(XmlReader reader) in E:\VS2008\NBSWebServiceProduction\NBSWebService\dsForms1.Designer.vb:line 299
       at System.Data.DataSet.System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader reader)
       at System.Xml.Serialization.XmlSerializationReader.ReadSerializable(IXmlSerializable serializable, Boolean wrappedAny)
       at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read7_SubmitFormDataset()
       at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer12.Deserialize(XmlSerializationReader reader)
       at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
       --- End of inner exception stack trace ---
       at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
       at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
       at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
       --- End of inner exception stack trace ---
       at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
       at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

     

    Can anyone tell me if I've done something wrong along the way or whether I've not done something I was meant to do please?

    Thanks

  • 02-21-2011 10:35 PM In reply to

    Re: File attachment for Infopath form based on Web Service

    What you did makes sense.

    Tightly coupled Web services are brittle when you have to make changes. We use a loosely coupled Web service that takes the entire XML and maps it to SQL based on a secondary mapping configuration (i.e. it's data driven). This allows us to easily change the client or server schema and roundtrip attachments and other data-types that aren't native to SQL.

    We've never tried to convert a tightly coupled Web service since we've been using loosely coupled ones for over 7 years now. We can update our schemas whenver we want with zero downtime.

     

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.