Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sean Dooley 288 posts 527 karma points
    Jul 27, 2015 @ 16:21
    Sean Dooley
    0

    Forms: workflow 'Post form to url' failed on Submitted

    Using Umbraco Forms and I'm looking to add a Workflow that will post form to URL. I have the following setup

    Name: Post form to URL Type: Post form to URL Url: http://domain.com/umbraco/api/subscribers/get Method: GET Fields: (initially blank - is there any documentation for this?)

    Below is the code for my post URL which is initially setup just to see if the URL gets hit

    public class SubscribersController : UmbracoApiController {
    
            public HttpResponseMessage Get() {
                LogHelper.Debug(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "GET");
    
                return new HttpResponseMessage(HttpStatusCode.OK)
                {
                    Content =
                    new StringContent(JsonConvert.SerializeObject(new
                    {
                        msg = "GET"
                    }, Formatting.None))
                    {
                        Headers = { ContentType = new MediaTypeHeaderValue("application/json") }
                    }
                };
            }
    }
    

    The form submits successfully as entries are being stored, but the post form to URL is failing on submit as indicated the UmbracoTraceLog below

    2015-07-27 17:06:56,737 [39] ERROR Umbraco.Forms.Data.LogHelper - [Thread 30] Forms: workflow 'Post form to url' failed on Submitted
    System.Net.WebException: An exception occurred during a WebClient request. ---> System.Net.ProtocolViolationException: Cannot send a content-body with this verb-type.
       at System.Net.HttpWebRequest.CheckProtocol(Boolean onRequestStream)
       at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
       at System.Net.HttpWebRequest.GetRequestStream()
       at System.Net.WebClient.UploadBits(WebRequest request, Stream readStream, Byte[] buffer, Int32 chunkSize, Byte[] header, Byte[] footer, CompletionDelegate uploadCompletionDelegate, CompletionDelegate downloadCompletionDelegate, AsyncOperation asyncOp)
       at System.Net.WebClient.UploadValues(Uri address, String method, NameValueCollection data)
       --- End of inner exception stack trace ---
       at System.Net.WebClient.UploadValues(Uri address, String method, NameValueCollection data)
       at System.Net.WebClient.UploadValues(String address, String method, NameValueCollection data)
       at Umbraco.Forms.Core.Providers.WorkflowTypes.PostToUrl.Execute(Record record, RecordEventArgs e)
       at Umbraco.Forms.Core.Services.WorkflowService.ExecuteWorkflows(List`1 workflows, RecordEventArgs e)
    

    Any ideas on what might be wrong?

Please Sign in or register to post replies

Write your reply to:

Draft