Tech Tip: Defining XML type when using Web Services
PRODUCT: 4D | VERSION: 11.2 | PLATFORM: Mac & Win
Published On: November 25, 2008
4D v11 SQL Release 2 allows you to send XML structures or DOM references via the Web. In order to do that the command SOAP DECLARATION(variable; type; input_output{;alias}) has been changed. Two new values for the "type" parameter have been created:
Is XML
Is DOM reference
The method published as a Web Service will look as follows:
for "Is XML":
C_TEXT(doc_t) SOAP DECLARATION(doc_t;Is XML;SOAP Input;"doc_t") |
for "Is DOM reference":
C_TEXT(doc_t) SOAP DECLARATION(doc_t;Is DOM reference;SOAP Input;"doc_t") |
The proxy method (the method which call the Web Services) will look as follows:
for "Is XML":
C_TEXT(text_t) C_STRING(16;vrootRef) vrootRef:=DOM Create XML reference("root") vElemRef:=DOM Create XML element(vrootRef;"/root/element") DOM EXPORT TO VAR(vrootRef;text_t) SET WEB SERVICE PARAMETER("doc_t";text_t;"asXML") CALL WEB SERVICE("http://localhost:8080/4DSOAP/";"A_WebService#SOAP_test";"SOAP_test";"http://www.4d.com/namespace/default";Web Service Dynamic) |
for "Is Dom reference":
C_TEXT(text_t) C_STRING(16;vrootRef) vrootRef:=DOM Create XML reference("root") vElemRef:=DOM Create XML element(vrootRef;"/root/element") SET WEB SERVICE PARAMETER("vrootRef";vrootRef;"asXML") CALL WEB SERVICE("http://localhost:8080/4DSOAP/";"A_WebService#SOAP_test";"SOAP_test";"http://www.4d.com/namespace/default";Web Service Dynamic) |