Cannot submit data to Web Service for the life of me (401) - InfoPath Dev
in

InfoPath Dev

Cannot submit data to Web Service for the life of me (401)

Last post 06-05-2009 10:03 AM by IPSeeker. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 05-21-2009 02:21 PM

    Cannot submit data to Web Service for the life of me (401)

    I created a Web Service for Sharepoint.  All it does is add a record to a table in a SQL Database.  The connection to the SQL DB is through SQL authentication.  I created this Web Service the proper way, signed, disco, wsdl and assembly on the SharePoint server.  I created a Web Application to consume the Web Service and it works like a charm.  It also works great with the InfoPath form when used from a client.  However when published to a SharePoint library, it errors out when I submit the form.  The error I get in the SharePoint Log is as follows:

    The remote server returned an error: (401) Unauthorized

    I've looked all over the Internet but nothing is clear.  When I consume the WS, I have to pass authentication to it in order for it to work.  Do I have to do the same when I publish the form?

    Any advice is greatly appreciated.

    Filed under: , , ,
  • 05-26-2009 11:52 PM In reply to

    Re: Cannot submit data to Web Service for the life of me (401)

    Hi IPSeeker,

    When you are using browser-enabled forms you will need to setup a UDC file for the data connection and SSO if it's running on a separate server since SharePoint doesn't forward credentials by default and your Web Service probably doesn't impersonate some system account by default either.

    Patrick Halstead
    Project Manager at Qdabra
  • 05-27-2009 08:45 AM In reply to

    Re: Cannot submit data to Web Service for the life of me (401)

    Thank you for the response.

    I created a UDC connection as suggested in this post http://www.infopathdev.com/forums/t/6781.aspx but I still get the same error message.  The Web Service runs on the same server MOSS runs on.

    I don't know what else I should do.

  • 05-28-2009 12:21 AM In reply to

    Re: Cannot submit data to Web Service for the life of me (401)

    Questions:

    • Did you admin approve the UDC connection?
    • Did you admin adpprove the InfoPath form on SharePoint? This is only required if you have code. Not sure, so worth doing.
    • In the InfoPath Designer, go to Tools->Form Options->Security. What is the setting? It should be Domain Trust.
    • Using Internet Explorer, go to the SharePoint site and look at the lower right corner in the status bar. Does it show "Local Intranet"?
    • Do you have the source code for the Web Service?
    Patrick Halstead
    Project Manager at Qdabra
  • 05-29-2009 10:11 AM In reply to

    Re: Cannot submit data to Web Service for the life of me (401)

    Thank you for your eagerness to help me.

    Finally figured it out.  Got a lot of hints from this post (http://www.infopathdev.com/forums/t/10213.aspx).  Read a lot of posts until I got to this one.  Most never mentioned that when you use NTLM authentication, you have to use a udcx connection and Single Sing On (SSO).  SSO is now my new best friend.  So just to summarize for the next person who has difficulties:

    1. Build your web service as you normally would.  HINT: You can use MS Visual Web Developer 2008 Express Edition for free!  Awesome product.  If you are adding records to a SQL 2005 DB and above, just create an Endpoint Web Service; will save you a lot of work.
    2. Connect your InfoPath form to the Web Service.
    3. Convert the Web Service connection to a udcx and upload it to a Data Connection Library on your SharePoint.
    4. Configure SSO on your MOSS 2007 server; see this post (http://blogs.devhorizon.com/reza/?p=832).
    5. Edit your udcx connection to use SSO.  Just uncomment and edit this line in your udcx file, <udc:Authentication><udc:SSO AppId='<SSO App ID>' CredentialType='ntlm' /></udc:Authentication>
    6. Update the udcx connection in your Data Connection Library.
    7. Update your InfoPath form to the new udcx conection.
    8. Publish your InfoPath form as a web-based form and you are done!
  • 06-04-2009 08:36 PM In reply to

    Re: Cannot submit data to Web Service for the life of me (401)

    Hi There,

     Can you please let us know how this is done. This is very similar to what I am trying to do nd I hve no idea how to get it done. Please help..like creating a web service for sharepoint etc

  • 06-05-2009 10:03 AM In reply to

    Re: Cannot submit data to Web Service for the life of me (401)

    Why, certainly!

    • Step 1.  Create the Web Service.  As mentioned you can use MS Visual Web Developer 2008 Express.  Here is a good link to get started on that, http://msdn.microsoft.com/en-us/library/8wbhsy70(VS.80).aspx.  I found this 'How To' to be very simple to follow and it works!  If you want to do it the "SharePoint Way", you can follow this link http://it.toolbox.com/blogs/sharepoint-blog/creating-a-custom-web-service-for-sharepoint-13553.  However, I never got mine working but you might have a better chance.  In any case, once you have your Web Service working publish it to your internal IIS server.  You can also publish it on the IIS SharePoint uses.  If you do that, I recommend putting it on a different port than 80.
    • Step 2. Create your InfoPath form and connect it to the Web Service.  If you are submitting data to the Web Service, go to Tools\Submit Options and follow below:
      • Under 'Send form data to a single destination', select 'Web Servie'
      • Click on Add.
      • Enter the URL to your Web Service, like http://<web server>/<web service>.asmx?WSDL and click on Next
      • Under 'Select an operation' select the function you want to use and click Next.
      • Here you must associate each parameter of the function to a field on your InfoPath form.  So for instance, if your are submitting 'FirstName', you would highlight the 'firstname' parameter and under 'Field or group' you would pick the 'FirstName' field so it would look like this: /my:myFields/my:FirstName.  Once done associating all the parameters, click Next.
      • Give the connection a name and Finish.
    • Step 3. Enable SSO.  See my previous post.
    • Step 4. Create a Connection Library on your SharePoint.  After doing so just copy the URL.
    • Step 5. Convert your Web Service connection into a Universal Data Connection (udcx).  Go back to your InfoPath form and under Manage Data Connections do the following:
      • Highlight the Web Service connection and click on Convert.
      • Paste in the URL of the Connection Library you just created and click OK.
      • That's it; you'll now have a udcx connection in your Connection Library waiting for you to approve but don't do it yet.
      • Switch back to your Connection Library and download a copy of the new connection.
      • Edit the file in Notepad or SharePoint Designer 2007 (it's also free, now).
      • Enter the SSO authenitcation.  See my previous post above.
      • Back to the Connection Library we go.
      • Delete the udcx file you have there (the one you downloaded).
      • Click on New Universal Data Connection File and upload the one with the SSO authentication.  Don't try changing the Title.  You can't.  There is a way but beyond this post.
      • Approve it and you are done here.
    • Step 6.  Test InfoPath form with the new udcx connection.  Test out your form on your client machine.  If all is good you can proceed to the last step.
    • Step 7.  Pulbish your InfoPath form as a web based form to a Forms library.  Make sure you turn on 'Display as a Web page' under the Advanced Settings.  Try it out and post back for issues ;-)

    These are pretty much the basic steps to get a Web Service working with Web Based Forms.  Hope this post was helpful.

Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.