Unity + SOAP issue

This is a bit of an odd one. Hate when my workaround doesn’t work :stuck_out_tongue: I have a SOAP envelope I created and confirmed through SoapUI that it is a valid envelop and works with the server. However, when I use the following code to send it, both www.text and www.error hold absolutely nothing. It’s something I extracted and modified from the SoapObject code posted some time back:

    private SoapTree RequestSync(string envelope, float timeout)
    {
		
        Debug.Log("Start Sync URL request: " + Time.time.ToString() + " seconds");

        WWW www = new WWW(Url, System.Text.Encoding.UTF8.GetBytes(envelope));
		

        float stop = Time.time + timeout;

        while ((!www.isDone)  (stop > Time.time))
        {
            StartCoroutine(IEWaitaSec(www, stop));
        }
		
        if (www.isDone)
        {
            if (www.error != "")
            {
                Debug.Log("[Status]");
                Debug.Log("Error=Ok");
            }
            else
            {
                Debug.Log("[Status]");
                Debug.Log("Error=" + www.error);
            }
        }
        else
        {
            Debug.Log("[Status]");
            Debug.Log("Timeout=" + stop);

            return new SoapTree();
        }
    }

As mentioned, if I drop the envelope(string) that it attempts to send into SoapUI, the request goes right through with the expected data returned. Anyone know why? Starting to think it’s a hitch in the WWW method itself to go with the absence of the IExtensibleDataObject that made me have to take this route in the first place.

Not sure if it matters, but I am using a Mac with the most recent version of Unity installed.

EDIT: Almost forgot to mention that I had a tech on the phone when I sent it and he didn’t detect it even hitting the server even though if I simply remove the data for a straight request it returns the info to make the web page.

The code looks extremely suspicios on the while !done loop, as if it is gonna spread a plentitude of coroutines you likely don’t want to appear.

What is that coroutine in there doing and why do you have it present and being spread each frame?

I guess the intend of the loop is a “timeout handling”, if thats the case, replace the loop content with yield return null; instead

Unsure if the byte sending works as an option on mobile where the mobile OS request functionality is used that have distinct limitations, but using WWWForm works for sure for requests. Any reason you use the bytes push path instead of WWWForm or any limitation in WWWForm that makes it impossible for you to use it?

I was running off what the originally posted code had there. Just seems odd that the data being sent is confirmed to be 100% right when sent through SoapUI, but the WWW class fails. There are some POSTs down the road that will need to be encrypted as well. Would the fatc it’s going to an https address cause any problems with the WWW class?

As to the loop, it is for the timeout handling. I’ll try the other way :slight_smile:

Just remembered why it was done that way. Switching to your suggest it complains:

Funny story :stuck_out_tongue: Apparently the call needed to be set up to be asynchronous to work.