SOAPDoc Class Properties
In addition to the properties listed here, most of the XmlDoc and XmlNode class properties can be used with a SOAPDoc object. The properties are discussed in alphabetical order.
Description
This property returns a reference to the body section of a SOAPDoc, as an XmlNode.
This property is read-only.
Related Links
Description
This property returns a reference to the envelope section of a SOAPDoc, as an XmlNode.
This property is read-only.
Related Links
Description
Use the FaultCode property to return the fault code if the SOAP message has one. Not every message has a fault code. It is returned only when the SOAP method has had an error in processing and the SOAP method supports fault codes. This property returns a number.
If the fault code in the message cannot be converted to a number, the value 0 is returned. Use FaultCodeS to get the fault code value as a string.
This property is read-only.
Example
Local SOAPDoc &MyDoc;
Local integer &Fault;
&MyDoc = CreateSOAPDoc();
&MyDoc.AddFault("400", "Server Error");
&Fault = &MyDoc.FaultCode;
Description
Use the FaultCodeS property to return the fault code if the SOAP message has one. Not every message has a fault code. It is returned only when the SOAP method has had an error in processing and the SOAP method supports fault codes. This property returns a string.
This property is read-only.
Example
Local SOAPDoc &MyDoc;
Local string &Fault;
&MyDoc = CreateSOAPDoc();
&MyDoc.AddFault("400", "Server Error");
&Fault = &MyDoc.FaultCodeS;
Description
Use the FaultString property to return the fault string if the reply has one. Not every SOAP message has a fault string. It is only returned when the SOAP method has had an error in processing and the SOAP method supports fault strings.
Example
&Fault = &MyDoc.FaultString;
Description
Use the HeaderNode property to return a reference to the header node. After you have a reference, you can use the XmlDoc methods to read and make changes to the node.
This property is read/write.
Example
The following test adds a header section, validates the SOAPDoc, then access the header.
Local SOAPDoc &Sdoc;
Local XMLNode &Node;
/* ===> Add inputs: */
&Sdoc = CreateSOAPDoc(); /* required */
&Sdoc.AddHeader(); /* optional */
&Sdoc.AddMethod("SOAPXml", 1); /* required */
&OK = &Sdoc.ValidateSOAPDoc();
/*Append to TEMP file*/
&Xstring = &Sdoc.GenXmlString();
&myfile = GetFile("cmsDoc.xml", "A");
&myfile.WriteLine(&Xstring);
&myfile.Close();
&METHOD = &Sdoc.MethodName;
&ParmCnt = &Sdoc.ParmCount;
&HdrNode= &Sdoc.HeaderNode; //returns SOAP-ENV:Header
&HdrName = &HdrNode.NodeName;
/* Echo out the Returned Outputs */
out_BI_results("SOAP Header test 1");
out_BI_results(" ");
out_BI_results("Validated: " | &OK);
out_BI_results("Method: " | &METHOD);
out_BI_results("Parm Count: " | &ParmCount);
out_BI_results("Header : " | &HdrName);
out_BI_results("End-of-Test");
Description
This property returns the name of the method of the SOAPDoc, as a string.
If you want a reference to the method that you can work with, as an XmlNode, use the MethodNode property.
This property is read-only.
Description
This property returns a reference to the method section of a SOAPDoc, as an XmlNode.
If you want only the name of the method returned, use the MethodName property.
This property is read-only.
Related Links
Description
This property returns the total number of parameters for the method section in a SOAP XML document as a number.
This property is read-only.
Example
For &I = 1 to &SOAPDoc.ParmCount
&ParmName = &SOAPDoc.GetParmName(&I);
&ParmValue = &SOAPDoc.GetParmValue(&I);
/* do processing */
End-For;
Description
This property transforms a SOAPDoc object to an XmlDoc object. This is necessary only when sending or receiving a response message. You do not need to do this conversion to use the XmlDoc or XmlNode methods and properties.
This property is read/write.
Example
The following is an example of sending a SOAP message and receiving the response:
Local XmlDoc &request, &response;
Local string &strXml;
Local SOAPDoc &soapReq, &soapRes;
/* create the SOAP XML Document */
&soapReq = CreateSOAPDoc();
&soapReq.AddMethod("GetPrice");
&soapReq.AddParm("Item", "Apples");
/* convert SOAP to XmlDoc */
&request = &soapReq.XmlDoc;
/* Send the Request */
&response = SyncRequestXmlDoc(&request, Message.QE_SOAP_REQ, Node.UNDERDOG);
/* Get the SOAP response from the XmlDoc response */
&soapRes = CreateSOAPDoc();
&soapRes.XmlDoc = &response;
&OK = &soapRes.ValidateSOAPDoc();
&strXml = &soapRes.GenXmlString();