CalcXML's calculators accept one parameter, "in0", which is a string that is formatted as XML. Since the SOAP envelope itself is XML, the value of the in0 parameter creates a situation where you have and XML document inside another XML document. This is not a problem except that you will need to replace any special characters in the in0 XML document with their entity references.
This table shows the five predefined entities representing special characters in XML.
Character | Entity Reference |
---|---|
" | " |
& | & |
' | ' |
< | < |
> | > |
In the sample SOAP envelope below, the XML document being passed as the value of the in0 parameter is marked in gray. You will notice that all the special characters have been replaced with their entity references. In many development environments, you will not need to worry about replacing special characters with entity references because the SOAP envelope is handled for you. However, if you are manually creating the SOAP envelope, you will need to make sure that the special characters are replaced with entity references as shown below.
Sample SOAP Envelope
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<det01 xmlns="http://webservice.calcxml.com">
<in0 xsi:type="xsd:string"><?xml version="1.0" encoding="UTF-8"?>
<calcxmlRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.calcxml.com/schema/1.3/calcxmlRequest.xsd" username="XXXXXX" password="XXXXXX" responseType="html" chartLibrary="flash" returnDataTable="true" language="en" countryCode="US" version="1.3" ipAddress="127.0.0.1" returnRelevantLinks="true"><flashChart><threeD>1</threeD><chartWidth>500</chartWidth><chartHeight>300</chartHeight><chartAttributes><attribute name="caption" value="Chart Title" /><attribute name="xAxisName" value="" /><attribute name="numberPrefix" value="$" /><attribute name="bgColor" value="FFFFFF" /><attribute name="showBorder" value="1" /><attribute name="borderColor" value="B8AF76" /><attribute name="borderThickness" value="1" /><attribute name="canvasBgColor" value="E6E3CF" /><attribute name="palette" value="2" /></chartAttributes></flashChart><pdf><advisor>0</advisor><onePage>0</onePage><preparedBy /><preparedFor /></pdf><dataTable><cssClassName>simpletable</cssClassName></dataTable><calcInput includeInResponse="false"><det01><ccBalance>5000.0</ccBalance><ccRate>0.18</ccRate><minpaymentRate>0.04</minpaymentRate><minpaymentAmount>10.0</minpaymentAmount><skipPayment>N</skipPayment><additionalPayment>25.0</additionalPayment><amortization>2</amortization></det01></calcInput></calcxmlRequest>
</in0>
</det01>
</soapenv:Body>
</soapenv:Envelope>
Here is the CalcXML Request that is being passed in as the value of the in0 parameter above in a more readable format, i.e., without the entity references.
CalcXML Request XML
<calcxmlRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.calcxml.com/schema/1.3/calcxmlRequest.xsd" username="XXXXXX" password="XXXXXX" responseType="html" chartLibrary="flash" returnDataTable="true" language="en" countryCode="US" version="1.3" ipAddress="127.0.0.1" returnRelevantLinks="true">
<flashChart>
<threeD>1</threeD>
<chartWidth>500</chartWidth>
<chartHeight>300</chartHeight>
<chartAttributes>
<attribute name="caption" value="Chart Title"/>
<attribute name="xAxisName" value=""/>
<attribute name="numberPrefix" value="$"/>
<attribute name="bgColor" value="FFFFFF"/>
<attribute name="showBorder" value="1"/>
<attribute name="borderColor" value="B8AF76"/>
<attribute name="borderThickness" value="1"/>
<attribute name="canvasBgColor" value="E6E3CF"/>
<attribute name="palette" value="2"/>
</chartAttributes>
</flashChart>
<pdf>
<advisor>0</advisor>
<onePage>0</onePage>
<preparedBy/>
<preparedFor/>
</pdf>
<dataTable>
<cssClassName>simpletable</cssClassName>
</dataTable>
<calcInput includeInResponse="false">
<det01>
<ccBalance>5000.0</ccBalance>
<ccRate>0.18</ccRate>
<minpaymentRate>0.04</minpaymentRate>
<minpaymentAmount>10.0</minpaymentAmount>
<skipPayment>N</skipPayment>
<additionalPayment>25.0</additionalPayment>
<amortization>2</amortization>
</det01>
</calcInput>
</calcxmlRequest>