you mix up 2 variants of indirection

W @B
S @("C="_B)

These both are ARGUMENT indirections, where the arguments of WRITE or SET are replaced.

But

S C=@B

is a NAME indirection where the name of a variable or global is expected.
$P(A,S,2) is definitely no a variable or global name.

Docs on Indirection is quite verbose and shows the limits. 

Most important: this is a runtime feature and not a compile-time feature!

You can achieve this using TRANSACTIONS in combination with ISOLATION LEVELS

BUT: as with the  LOCK in COS you depend on the other players to take notice of your isolation.  
If they don't care you are lost since this is no absolute locking.
COS has the option to lock your record ahead - but you depend on the other participants.

An other option is to use ROWVERSION  to protect your record. (optimistic locking)
If someone has changed your record under cover you get alerted on the fact.

You may create your private row count by group. 

Class DC.any [ Abstract ]
{
ClassMethod MyVid(group = "") As %String [ SqlName = MyVid, SqlProc ]
{
 if group="" kill %myVid quit 0  ;;initialize it
  quit $I(%myVid(group))
}

 .

how to use it:

SELECT DC.MyVid(company) RowNumber, Company,Company->Name, Name
FROM Sample.Employee where DC.MyVid()=0 /* static condition for init */
order by 2

 .

looks like this:

RowNumber

Company

Name

Name

1

1

O' KwalLateral Group Ltd.

Moon,Mary Q.

2

1

O' KwalLateral Group Ltd.

Ximines,Alice Z.

3

1

O' KwalLateral Group Ltd.

Malynko,Greta H.

4

1

O' KwalLateral Group Ltd.

Lubbar,Emily Q.

1

2

InterPlex Holdings Inc.

Tesla,Kenny W.

2

2

InterPlex Holdings Inc.

Jones,Valery N.

3

2

InterPlex Holdings Inc.

Baker,Samantha D.

1

3

GlobaSys LLC.

Quixote,Marvin C.

2

3

GlobaSys LLC.

Xerxes,Violet Y.

3

3

GlobaSys LLC.

Adams,Kim W.

4

3

GlobaSys LLC.

Ubertini,Roberta N.

5

3

GlobaSys LLC.

Jackson,Buzz V.

6

3

GlobaSys LLC.

Clinton,Keith C.

7

3

GlobaSys LLC.

Isaksen,Juanita T.

8

3

GlobaSys LLC.

Solomon,Imelda Z.

1

4

SynerMatix Associates

Humby,Olga A.

2

4

SynerMatix Associates

Orwell,Maureen R.

3

4

SynerMatix Associates

O'Donnell,Ed Q.

4

4

SynerMatix Associates

Orlin,Mary D.

5

4

SynerMatix Associates

Vanzetti,Pam V.

6

4

SynerMatix Associates

Noodleman,Chris O.

All I know about python is  "Monty Python" smiley

OK.

The table you want to control needs to get a parameter   Parameter DSTIME = "AUTO";  and a recompile

Then you can use this class to trace  changes, new, delete

/// Handle DSTIME using SQL
/// 
select * from OBJ.DSTIME where version = lastversion
/// to show all
Class OBJ.DSTIME Extends %Persistent [ Final, SqlRowIdPrivate {
Index idx On (Table, Version, RowID) [ IdKey ];
Property Version As %Integer [ ReadOnly, SqlColumnNumber = 2 ];
Property Table As %String [ ReadOnly, SqlColumnNumber = 3 ];
Property RowID As %String [ ReadOnly, SqlColumnNumber = 4 ];
Property Signal As %Integer(DISPLAYLIST = ",Modified,New,Deleted", VALUELIST = ",0,1,2")
   [
Calculated, , SqlComputedSqlColumnNumber = 5,
     SqlComputeCode = { set {*}=^OBJ.DSTIME({Table},{Version},{RowID})}];
Property LastVersion As %Integer [ Calculated, SqlComputed, SqlColumnNumber = 6,
   
SqlComputeCode = { set {*}=+$G(^OBJ.DSTIME) } ];


/// to get actual last version and switch to new version
/// select top 1 LastVersion,OBJ.DSTIME_NewVersion(LastVersion) from OBJ.DSTIME
/// 
ClassMethod NewVersion(anycolumn As %String) As %Integer [ SqlProc ]
 Quit $I(^OBJ.DSTIME) }

Storage Default {
<DataLocation>^OBJ.DSTIME</DataLocation>
<IdLocation>^OBJ.DSTIMED</IdLocation>
<IndexLocation>^OBJ.DSTIMEI</IndexLocation>
<StreamLocation>^OBJ.DSTIMES</StreamLocation>
<Type>%Library.CacheStorage</Type>
}

 

 so get your actual changes

select * from OBJ.DSTIME where version = lastversion

and switch to next version by 

select top 1 LastVersion,OBJ.DSTIME_NewVersion(LastVersion) from OBJ.DSTIME

.

But you have to have full access to Caché as you have to make the DB "talking"  to be able to "listen"

There are some mistakes.

#1 the links should be "HTTPS://www.intersystems.com" and you didn't set a ssl/tls config.

if you use 

Set sc=httprequest.Get("http://www.intersystems.com",2)
Do $system.OBJ.DisplayError(sc)

you get ERROR #6159: ===> SSL missing

#2 HttpResponse is an ObjectReferce not a Property

set res=httprequest.HttpResponse
ZW res
 
res=<OBJECT REFERENCE>[3@%
Net.HttpResponse]
+----------------- general information ---------------
|      oref value: 3
|      class name: %Net.HttpResponse
| reference count: 3
+----------------- attribute values ------------------
|    ContentBoundary = ""
|        ContentInfo = ""
|      ContentLength = 178
|        ContentType = "text/html"
|               Data = "4@%Stream.GlobalCharacter"   ;;; here is your reply
|Headers("CONNECTION") = "keep-alive"
|Headers("CONTENT-LENGTH") = 178
|Headers("CONTENT-TYPE") = "text/html"
|    Headers("DATE") = "Wed, 01 Aug 2018 15:25:05 GMT"
|Headers("LOCATION") = "https://www.intersystems.com/"
|  Headers("SERVER") = "nginx"
|  Headers("X-TYPE") = "default"
|        HttpVersion = "HTTP/1.1"
|       ReasonPhrase = "Moved Permanently"
|         StatusCode = 301
|         StatusLine = "HTTP/1.1 301 Moved Permanently"
+-----------------------------------------------------

The content is in a Stream!! 
So Write is totally inappropriate to show it. Instead:

do res.OutputToDevice()   ;;;or similar

HTTP/1.1 301 Moved Permanently
CONNECTION: keep-alive
CONTENT-LENGTH: 178
CONTENT-TYPE: text/
html
DATE: Wed, 01 Aug 2018 15:25:05 GMT
LOCATION: https://www.intersystems.com/
SERVER:
nginx
X-TYPE: default
 
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>

Hi Thomas,

If you generate your webservice from a WSDL  you should check your classes
for correct hierarchical structure AND for properties flagged as required in WSDL.
Typical situation: 
an address is optional but inside the address, the street is required.  
This can cause the whole address to be interpreted as required.
You may either remove the required in properties or before generating the classes you edit the WSDL ( often easier).