Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by KeithK · Aug 24, 2011 at 12:15 PM · errorwwwwwwformpost

POST request using WWW class. error: necessary data rewind wasn't possible

I'm trying to call a web service, using the WWW class with a WWWForm to fill in the POST data.

It's an extremely simple web service for this test purpose. All it does is take in two ints, sum them and return the result. Unfortunately, when I call the service I get this error when it returns:

"necessary data rewind wasn't possible"

Does anybody have any idea what the cause of this could be?

Here is my code snippet for the request. It's really just this simple a test:

     WWWForm form = new WWWForm();
     
     form.AddField("A", 1);
     form.AddField("B", 1);
     
     WWW request;
     
     request = new WWW(url, form);

     yield return request;
     
     if (request.error != null)
     {
         Debug.Log("Error completing request: " + request.error);
     }
     else
     {
         Debug.Log(request.text);
     }

Any assistance on this issue would be greatly appreciated.

Thanks in advance.

::EDIT:: - Added server side web method.

     [WebMethod]
     public int AddTest(int A, int B)
     {
         return A + B;
     }

And here is the URL which is stored in the variable url in the request:

 http://www.somedomain.com/SomeDirectory/WebServices.asmx/AddTest
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image srinathbairi_unity · Oct 31, 2021 at 03:16 PM 0
Share

you can do this by using wsdl tool. This may help you: http://gyanendushekhar.com/2017/02/18/call-asp-net-web-service-unity3d-asmx-service/

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by KeithK · Aug 25, 2011 at 08:35 AM

Solved.

I grabbed a hold of Wireshark and had a look at the TCP Stream that was being returned from my request. There was an error from the Web Service that was different to the error Unity's WWW class had stored.

The ASP web service actually had an error along the lines of:

Request format is unrecognized for URL unexpectedly ending in '/AddTest'.

Basically my ASP Web Service was only willing to handle SOAP requests.

To enable the handling of Web Form POST requests "application/x-www-form-urlencoded". I just need to add the following to my web.config:

 <configuration>
    <system.web>
       <webServices>
          <protocols>
             <add name="HttpPost"/>
             <add name="HttpGet"/>
          </protocols>
       </webServices>
    <system.web>
 </configuration>

Thanks to BerggreenDK for his answer which made me scrutinize my server side setup, rather than my Unity scripts.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by BerggreenDK · Aug 24, 2011 at 12:50 PM

Sounds to me like the server script needs something. Not your Unity script.

Is it PHP? I'm using ASP.net/C# and havent seen this type of error so far and I use plenty of WWWForm calls.

How to you store your FORM values on the server? are they appended to some textstream perhaps and could it be that you need to rewind this stream to be able to save?

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image KeithK · Aug 24, 2011 at 01:00 PM 0
Share

Thanks for the reply. It's an ASP.NET web service. I usually call them writing my SOAP requests manually, when working in Objective-C or C++, and haven't experienced an issue like this before. I will update my question and place the server side function definition in it.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

GET Request Wrapper 1 Answer

How do I send data over the internet? 0 Answers

Sending data to a .php service using Unity's WWW? 1 Answer

How do I make a simple POST request to Amazon S3? 2 Answers

Upload large files 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges