コード例 #1
0
/**
 * xmlSecSoap12AddFaultDetailEntry:
 * @faultNode:          the pointer to <Fault> node.
 * @detailEntryNode:    the pointer to detail entry node.
 * 
 * Adds a new child to the Detail child element of @faultNode.
 *
 * Returns pointer to the added child (@detailEntryNode) or NULL if an error 
 * occurs.
 */
EXPORT_C
xmlNodePtr 
xmlSecSoap12AddFaultDetailEntry(xmlNodePtr faultNode, xmlNodePtr detailEntryNode) {
    xmlNodePtr detailNode;

    xmlSecAssert2(faultNode != NULL, NULL);
    xmlSecAssert2(detailEntryNode != NULL, NULL);

    /* find Detail node and add it if needed */
    detailNode = xmlSecFindChild(faultNode,  xmlSecNodeDetail, xmlSecSoap12Ns);
    if(detailNode == NULL) {
        detailNode = xmlSecAddChild(faultNode, xmlSecNodeDetail, xmlSecSoap12Ns);
        if(detailNode == NULL) {
    	    xmlSecError(XMLSEC_ERRORS_HERE,
		        NULL,
		        "xmlSecAddChild",
		        XMLSEC_ERRORS_R_XMLSEC_FAILED,
		        "node=%s",
		        xmlSecErrorsSafeString(xmlSecNodeDetail));
	    return(NULL);	        	
        }
    }
    
    return(xmlSecAddChildNode(detailNode, detailEntryNode));
}
コード例 #2
0
ファイル: soap.c プロジェクト: ONLYOFFICE/core
/**
 * xmlSecSoap12AddBodyEntry:
 * @envNode:            the pointer to <soap:Envelope> node.
 * @entryNode:          the pointer to body entry node.
 *
 * Adds a new entry to <soap:Body> node.
 *
 * XML Schema (http://www.w3.org/2003/05/soap-envelope):
 *
 *     <xs:element name="Body" type="tns:Body"/>
 *     <xs:complexType name="Body">
 *         <xs:sequence>
 *             <xs:any namespace="##any" processContents="lax"
 *                     minOccurs="0" maxOccurs="unbounded"/>
 *         </xs:sequence>
 *         <xs:anyAttribute namespace="##other" processContents="lax"/>
 *     </xs:complexType>
 *
 * Returns: pointer to the added entry (@contentNode) or NULL if an error occurs.
 */
xmlNodePtr
xmlSecSoap12AddBodyEntry(xmlNodePtr envNode, xmlNodePtr entryNode) {
    xmlNodePtr bodyNode;

    xmlSecAssert2(envNode != NULL, NULL);
    xmlSecAssert2(entryNode != NULL, NULL);

    bodyNode = xmlSecSoap12GetBody(envNode);
    if(bodyNode == NULL) {
        xmlSecError(XMLSEC_ERRORS_HERE,
                    NULL,
                    "xmlSecSoap12GetBody",
                    XMLSEC_ERRORS_R_XMLSEC_FAILED,
                    XMLSEC_ERRORS_NO_MESSAGE);
        return(NULL);
    }

    return(xmlSecAddChildNode(bodyNode, entryNode));
}