1. Create infopath form as per my previous post
2. Click on tools -> data connections -> add
Select “Create a new connection to ” and “submit data” and click Next
3. Select “To a document Library or a sharepoint site” and click Next
4. Now Give the url of Document library without “forms/allitems.aspx”,Give File Name with concat of ID so that it will be unique and select “Allow Overwrite if file exists” for editing feature and click Next.
5. Give the name of this connection and click finish.
6. Add a button in form and right click and set properties:
Select Action “Rules and Custom Code” and click on Rules… -> Add
In Rule1 add following 3 actions
--Query using data connection(Receive webservice connection)
--Set field value PrimaryKey ID field = Data field-> save response->save result
--Submit using a dataconnection -> select sharepoint library submit (Not webservice submit)
Now add one more rule to close this form
Rules -> Add
Close this form.
7. Now form is ready to publish.