AddEnvelope method: SOAPDoc class
Syntax
AddEnvelope(SOAP_Schema)
Description
Use the AddEnvelope method to add the envelope element tags and the default schema. The default encoding styles are also set with this method.
Note:
Only one envelope section can be set within one PeopleSoft SOAP XML document.
If you're going to be adding an envelope section, you must do this before you add the body section or any methods by calling the EnvelopeNode property and using XmlNode methods and properties.
Parameters
| Parameter | Description |
|---|---|
|
SOAP_Schema |
Specify whether to use the default SOAP schema or the UDDI schema. You can specify either a numeric value or a constant for this property. The values are: |
| Numeric Value | Constant Value | Description |
|---|---|---|
|
0 |
%SOAP_Schema |
Use the SOAP schema (1.1 format). Specifying this value adds the following attributes to the SOAP envelope:
|
|
1 |
%SOAP_UDDI |
Use the UDDI schema. Specifying this value adds the following attribute to the SOAP envelope:
|
|
2 |
%SOAP_Custom |
Specify this value to add custom Namespace schemas to the SOAP envelope instead of the default SOAP schemas. Note: You must create the custom schema before you use it. See XML Schema. You must add the SOAP_ENV URI (as an attribute, using AddAttribute) before adding any other SOAP attributes. Note: For highly customized SOAP documents, PeopleSoft recommends using the XmlDoc class and creating the tags yourself. |
|
3 |
Use the SOAP schema (1.2 format). |
Returns
None.
Example
The following example uses the default SOAP schema (1.1 format). The following PeopleCode program:
&MyDoc.AddEnvelope(%SOAP_Schema);
Creates the following XML:
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV= "http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENV= "http://schemas.xmlsoap.org/soap/encoding/">
</SOAP-ENV:Envelope>
The following example creates an envelope and validates it.
The following PeopleCode program:
&soapReq = CreateSOAPDoc(); /* required */
/* manually add SOAP XML envelope, header, body, method and parameters */
/* &soapReq.AddHeader(); MUST come before any other section, but is optional */
&soapReq.AddEnvelope(%SOAP_Custom);
&EnvNode = &soapReq.EnvelopeNode;
&AddEnvelopeAttribute = &EnvNode.AddAttribute("xmlns:SOAP-ENV", "urn:MyCustom⇒
Schema.org");
&AddEnvelopeAttribute = &EnvNode.AddAttribute("xmlns:xsi", http://www.w3.org/2001⇒
/XMLSchema-instance);
&AddEnvelopeAttribute = &EnvNode.AddAttribute("xmlns:xsd", http://www.w3.org/2001⇒
/XMLSchema);
&AddEnvelopeAttribute = &EnvNode.AddAttribute("xmlns:soap", http:⇒
//schemas.xmlsoap.org/soap/envelope/);
&soapReq.AddMethod("requestAccessCode", 1);
/* Validate the message */
MessageBox(%MsgStyle_OK, "", 0, 0, "Validate the message");
&OK = &soapReq.ValidateSOAPDoc();
MessageBox(%MsgStyle_OK, "", 0, 0, "Message Validated and &OK = " | &OK);
/* Convert SOAP XML to XML */
MessageBox(%MsgStyle_OK, "", 0, 0, "Sending the message next");
&string = &soapReq.GenXmlString();
MessageBox(%MsgStyle_OK, "", 0, 0, "SOAP XML = " | &string);
Creates the following XML:
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:xsd= "http://www.w3.org/2001/XMLSchema"
xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
xmlns:soap= "http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENV= "urn:MyCustomSchema.org">
<SOAP-ENV:Body>
<requestAccessCode/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The following example uses the default SOAP schema (1.2 format).
The following PeopleCode program:
Local Soapdoc &sdoc;
&sdoc = CreateSOAPDoc("");
&sdoc.AddEnvelope(3);
&sdoc.AddHeader();
&sdoc.AddBody();
&sdoc.AddMethod("SOAPXml", 1);
&sdoc.AddParm("symbols", "ORCL");
&sdoc.AddParm("team", "PTQA");
Creates the following
XML. Generate XML through &sdoc.GenFormattedXmlString():
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding/" xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<SOAPXml>
<symbols>ORCL</symbols>
<team>PTQA</team>
</SOAPXml>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Related Topics