Accessing Web Service that have disabled GET/POST

SteveBee

Member
Licensed User
Longtime User
Title says it all, really.... I've seen & read the tutorial re. accessing Web Services, but as far as I can tell it uses the GET method.
So how to use SOAP or some such to access these services?

e.g. how to access a service like:
"http://member.cheesecake.com.au/tcs_ws.asmx?op=StoresListing"

i.e. the method "StoresListing" in service at "http://member.cheesecake.com.au/tcs_ws.asmx" ?

:sign0104:
Just starting with all this... I'm a very experienced (old <g>) programmer, but this is a new paradigm.. looks very interesting.

Steve
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Soap is actually a POST method.
And this Url is using the GET method:
"http://member.cheesecake.com.au/tcs_ws.asmx?op=StoresListing"

There are many tutorials available about these methods: HTTP Methods: GET vs POST | Insecure Web

The main difference is that in GET method the parameters are passed as part of the URL (op=StoresListing) and in POST method the parameters are passed inside the message.

Both methods are supported by HttpUtils.
 
Upvote 0

SteveBee

Member
Licensed User
Longtime User
Hi Erel,

And this Url is using the GET method:
"http://member.cheesecake.com.au/tcs_ws.asmx?op=StoresListing"

That's simply because I grabbed it from the server on which it was running.
That url is non-functional externally...

There are many tutorials available about these methods:
Sure - but I've obviously been working in Visual Studio for too long, where it takes care of all such 'plumbing'!!

I was hoping for a working template, like in the other examples/tutorials...

Ok, I'll go researching..

S.
 
Upvote 0

SteveBee

Member
Licensed User
Longtime User
build the Soap message as a large string and then send it with HttpUtils.PostString.

So PostString takes 3 parameters:
  • JobName : I assume just a handle to use to refer to the job.
  • url : the address of the ASMX (or other)
  • text : no clue??? (querystring parameters, if used?)

Is there some formal doc./listing of all Basic4android methods & parameters that I haven't come across yet, to help fill in the many blanks of my understanding?

S.
 
Upvote 0

SteveBee

Member
Licensed User
Longtime User
Yep, I already found that link.. and I assume that you're refering to this part:

Updates:
PostString, PostBytes and PostFile methods added to HttpUtils.
These methods make it easy to post data to a web service (using http POST method).
The behavior of these methods is similar to Download and DownloadList.

But that still doesn't tell me what the 3rd parameter of .PostString is.... (Download does not in fact appear to have a 3rd parameter).

S
 
Upvote 0

SteveBee

Member
Licensed User
Longtime User
And the reason I'm pursuing this parameter documentation question is because I want to know if the 3rd ('text') parameter of PostString is where I put the actual string to be posted?

S
 
Upvote 0

SteveBee

Member
Licensed User
Longtime User
It's starting to happen...

But I'm getting an error re. "Unsupported Media Type" in HttpUtilsService.hc_ResponseError

I assume this is because I haven't explicitly set:
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

How do I do so using HttpUtils?

S.

PS my reference is this, from the browser operation summary:
POST /tcs_ws.asmx HTTP/1.1
Host: member.cheesecake.com.au
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<StoresListing xmlns="http://cheesecake.com.au/" />
</soap12:Body>
</soap12:Envelope>
 
Upvote 0

SteveBee

Member
Licensed User
Longtime User
It appears the error is being thrown from:
If PostInputStream.IsInitialized Then

in HttpUtilsService..... leading to a StatusCode of 415

HTH
 
Upvote 0

SteveBee

Member
Licensed User
Longtime User
Ok, I see.

So HttpUtilsService is intended to be customised as required... if required, the ContentType could even be a parameter/property....? hmm...

Tx
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The advantage of having the code available is that you can learn from it and also customize it as needed. A ContentType property may be added. However there are many other possible modifications that developers will need to do in other cases.

This is different than the case with the Http library which should support all the use cases (and it cannot be customized by developers).
 
Upvote 0
Top