46 void addTransactionResult( QDomDocument &responseDoc, QDomElement &responseElem,
const QString &status,
47 const QString &locator,
const QString &message );
58 response.
setHeader(
"Content-Type",
"text/xml; charset=utf-8" );
59 response.
write( doc.toByteArray() );
68 transactionRequest aRequest;
73 if ( doc.setContent( request.
data(),
true, &errorMsg ) )
75 QDomElement docElem = doc.documentElement();
83 int actionCount = aRequest.inserts.size() + aRequest.updates.size() + aRequest.deletes.size();
84 if ( actionCount == 0 )
86 throw QgsRequestNotWellFormedException( QStringLiteral(
"No actions found" ) );
95 QDomElement respElem = resp.createElement( QStringLiteral(
"WFS_TransactionResponse" ) );
96 respElem.setAttribute( QStringLiteral(
"xmlns" ),
WFS_NAMESPACE );
97 respElem.setAttribute( QStringLiteral(
"xmlns:xsi" ), QStringLiteral(
"http://www.w3.org/2001/XMLSchema-instance" ) );
98 respElem.setAttribute( QStringLiteral(
"xsi:schemaLocation" ),
WFS_NAMESPACE +
" http://schemas.opengis.net/wfs/1.0.0/wfs.xsd" );
99 respElem.setAttribute( QStringLiteral(
"xmlns:ogc" ),
OGC_NAMESPACE );
100 respElem.setAttribute( QStringLiteral(
"version" ), QStringLiteral(
"1.0.0" ) );
101 resp.appendChild( respElem );
104 QStringList errorLocators;
105 QStringList errorMessages;
107 QList<transactionUpdate>::iterator tuIt = aRequest.updates.begin();
108 for ( ; tuIt != aRequest.updates.end(); ++tuIt )
114 if ( action.
handle.isEmpty() )
116 errorLocators << QStringLiteral(
"Update:%1" ).arg( action.
typeName );
120 errorLocators << action.
handle;
126 QList<transactionDelete>::iterator tdIt = aRequest.deletes.begin();
127 for ( ; tdIt != aRequest.deletes.end(); ++tdIt )
133 if ( action.
handle.isEmpty() )
135 errorLocators << QStringLiteral(
"Delete:%1" ).arg( action.
typeName );
139 errorLocators << action.
handle;
145 QList<transactionInsert>::iterator tiIt = aRequest.inserts.begin();
146 for ( ; tiIt != aRequest.inserts.end(); ++tiIt )
148 transactionInsert &action = *tiIt;
152 if ( action.handle.isEmpty() )
154 errorLocators << QStringLiteral(
"Insert:%1" ).arg( action.typeName );
158 errorLocators << action.
handle;
160 errorMessages << action.errorMsg;
164 QStringList::const_iterator fidIt = action.insertFeatureIds.constBegin();
165 for ( ; fidIt != action.insertFeatureIds.constEnd(); ++fidIt )
167 QString fidStr = *fidIt;
168 QDomElement irElem = doc.createElement( QStringLiteral(
"InsertResult" ) );
169 if ( !action.handle.isEmpty() )
171 irElem.setAttribute( QStringLiteral(
"handle" ), action.handle );
173 QDomElement fiElem = doc.createElement( QStringLiteral(
"ogc:FeatureId" ) );
174 fiElem.setAttribute( QStringLiteral(
"fid" ), fidStr );
175 irElem.appendChild( fiElem );
176 respElem.appendChild( irElem );
182 if ( errorCount == 0 )
184 addTransactionResult( resp, respElem, QStringLiteral(
"SUCCESS" ), QString(), QString() );
188 QString locator = errorLocators.join( QStringLiteral(
"; " ) );
189 QString message = errorMessages.join( QStringLiteral(
"; " ) );
190 if ( errorCount != actionCount )
192 addTransactionResult( resp, respElem, QStringLiteral(
"PARTIAL" ), locator, message );
196 addTransactionResult( resp, respElem, QStringLiteral(
"ERROR" ), locator, message );
205 QStringList typeNameList;
207 QList<transactionInsert>::iterator tiIt = aRequest.inserts.begin();
208 for ( ; tiIt != aRequest.inserts.end(); ++tiIt )
210 QString name = ( *tiIt ).typeName;
211 if ( !typeNameList.contains( name ) )
212 typeNameList << name;
214 QList<transactionUpdate>::iterator tuIt = aRequest.updates.begin();
215 for ( ; tuIt != aRequest.updates.end(); ++tuIt )
217 QString name = ( *tuIt ).typeName;
218 if ( !typeNameList.contains( name ) )
219 typeNameList << name;
221 QList<transactionDelete>::iterator tdIt = aRequest.deletes.begin();
222 for ( ; tdIt != aRequest.deletes.end(); ++tdIt )
224 QString name = ( *tdIt ).typeName;
225 if ( !typeNameList.contains( name ) )
226 typeNameList << name;
229 #ifdef HAVE_SERVER_PYTHON_PLUGINS
245 QMap<QString, QgsVectorLayer *> mapLayerMap;
256 if ( !typeNameList.contains( name ) )
265 throw QgsRequestNotWellFormedException( QStringLiteral(
"Layer error on '%1'" ).arg( name ) );
272 throw QgsRequestNotWellFormedException( QStringLiteral(
"Provider error on layer '%1'" ).arg( name ) );
280 throw QgsRequestNotWellFormedException( QStringLiteral(
"No capabilities to do WFS changes on layer '%1'" ).arg( name ) );
287 throw QgsSecurityAccessException( QStringLiteral(
"No permissions to do WFS changes on layer '%1'" ).arg( name ) );
289 #ifdef HAVE_SERVER_PYTHON_PLUGINS
293 throw QgsSecurityAccessException( QStringLiteral(
"No permissions to do WFS changes on layer '%1'" ).arg( name ) );
302 mapLayerMap[name] = vlayer;
306 tuIt = aRequest.updates.begin();
307 for ( ; tuIt != aRequest.updates.end(); ++tuIt )
309 transactionUpdate &action = *tuIt;
312 if ( !mapLayerMap.keys().contains(
typeName ) )
315 action.errorMsg = QStringLiteral(
"TypeName '%1' unknown" ).arg(
typeName );
326 action.errorMsg = QStringLiteral(
"No permissions to do WFS updates on layer '%1'" ).arg(
typeName );
329 #ifdef HAVE_SERVER_PYTHON_PLUGINS
333 action.errorMsg = QStringLiteral(
"No permissions to do WFS updates on layer '%1'" ).arg(
typeName );
345 action.errorMsg = QStringLiteral(
"No capabilities to do WFS updates on layer '%1'" ).arg(
typeName );
362 if ( !action.serverFids.isEmpty() )
368 #ifdef HAVE_SERVER_PYTHON_PLUGINS
378 QMap<QString, QString> propertyMap = action.propertyMap;
379 QDomElement geometryElem = action.geometryElement;
382 const QMap<QString, int> fieldMap = provider->
fieldNameMap();
383 QMap<QString, int>::const_iterator fieldMapIt;
385 bool conversionSuccess;
389 #ifdef HAVE_SERVER_PYTHON_PLUGINS
390 if ( accessControl && !accessControl->
allowToEdit( vlayer, feature ) )
393 action.errorMsg = QStringLiteral(
"Feature modify permission denied on layer '%1'" ).arg(
typeName );
398 QMap< QString, QString >::const_iterator it = propertyMap.constBegin();
399 for ( ; it != propertyMap.constEnd(); ++it )
401 fieldName = it.key();
402 fieldMapIt = fieldMap.find( fieldName );
403 if ( fieldMapIt == fieldMap.constEnd() )
407 QgsField field = fields.
at( fieldMapIt.value() );
408 QVariant value = it.value();
409 if ( value.isNull() )
414 action.errorMsg = QStringLiteral(
"NOT NULL constraint error on layer '%1', field '%2'" ).arg(
typeName, field.
name() );
421 if ( field.
type() == QVariant::Type::Int )
423 value = it.value().toInt( &conversionSuccess );
424 if ( !conversionSuccess )
427 action.errorMsg = QStringLiteral(
"Property conversion error on layer '%1'" ).arg(
typeName );
432 else if ( field.
type() == QVariant::Type::Double )
434 value = it.value().toDouble( &conversionSuccess );
435 if ( !conversionSuccess )
438 action.errorMsg = QStringLiteral(
"Property conversion error on layer '%1'" ).arg(
typeName );
443 else if ( field.
type() == QVariant::Type::LongLong )
445 value = it.value().toLongLong( &conversionSuccess );
446 if ( !conversionSuccess )
449 action.errorMsg = QStringLiteral(
"Property conversion error on layer '%1'" ).arg(
typeName );
462 if ( !geometryElem.isNull() )
468 action.errorMsg = QStringLiteral(
"Geometry from GML error on layer '%1'" ).arg(
typeName );
475 action.errorMsg = QStringLiteral(
"Error in change geometry on layer '%1'" ).arg(
typeName );
485 #ifdef HAVE_SERVER_PYTHON_PLUGINS
492 if ( accessControl && !accessControl->
allowToEdit( vlayer, feature ) )
495 action.errorMsg = QStringLiteral(
"Feature modify permission denied on layer '%1'" ).arg(
typeName );
511 action.errorMsg = QStringLiteral(
"Error committing updates: %1" ).arg( vlayer->
commitErrors().join( QStringLiteral(
"; " ) ) );
516 action.error =
false;
521 tdIt = aRequest.deletes.begin();
522 for ( ; tdIt != aRequest.deletes.end(); ++tdIt )
524 transactionDelete &action = *tdIt;
527 if ( !mapLayerMap.keys().contains(
typeName ) )
530 action.errorMsg = QStringLiteral(
"TypeName '%1' unknown" ).arg(
typeName );
541 action.errorMsg = QStringLiteral(
"No permissions to do WFS deletes on layer '%1'" ).arg(
typeName );
544 #ifdef HAVE_SERVER_PYTHON_PLUGINS
548 action.errorMsg = QStringLiteral(
"No permissions to do WFS deletes on layer '%1'" ).arg(
typeName );
560 action.errorMsg = QStringLiteral(
"No capabilities to do WFS deletes on layer '%1'" ).arg(
typeName );
577 if ( action.serverFids.isEmpty() )
580 action.errorMsg = QStringLiteral(
"No feature ids to do WFS deletes on layer '%1'" ).arg(
typeName );
587 #ifdef HAVE_SERVER_PYTHON_PLUGINS
601 #ifdef HAVE_SERVER_PYTHON_PLUGINS
602 if ( accessControl && !accessControl->
allowToEdit( vlayer, feature ) )
605 action.errorMsg = QStringLiteral(
"Feature modify permission denied" );
610 fids << feature.
id();
620 action.errorMsg = QStringLiteral(
"Delete features failed on layer '%1'" ).arg(
typeName );
629 action.errorMsg = QStringLiteral(
"Error committing deletes: %1" ).arg( vlayer->
commitErrors().join( QStringLiteral(
"; " ) ) );
634 action.error =
false;
638 tiIt = aRequest.inserts.begin();
639 for ( ; tiIt != aRequest.inserts.end(); ++tiIt )
641 transactionInsert &action = *tiIt;
644 if ( !mapLayerMap.keys().contains(
typeName ) )
647 action.errorMsg = QStringLiteral(
"TypeName '%1' unknown" ).arg(
typeName );
658 action.errorMsg = QStringLiteral(
"No permissions to do WFS inserts on layer '%1'" ).arg(
typeName );
661 #ifdef HAVE_SERVER_PYTHON_PLUGINS
665 action.errorMsg = QStringLiteral(
"No permissions to do WFS inserts on layer '%1'" ).arg(
typeName );
677 action.errorMsg = QStringLiteral(
"No capabilities to do WFS inserts on layer '%1'" ).arg(
typeName );
693 action.errorMsg = QStringLiteral(
"%1 '%2'" ).arg( ex.
message() ).arg(
typeName );
697 if ( featureList.empty() )
700 action.errorMsg = QStringLiteral(
"No features to insert in layer '%1'" ).arg(
typeName );
704 #ifdef HAVE_SERVER_PYTHON_PLUGINS
708 QgsFeatureList::iterator featureIt = featureList.begin();
709 while ( featureIt != featureList.end() )
711 if ( !accessControl->
allowToEdit( vlayer, *featureIt ) )
714 action.errorMsg = QStringLiteral(
"Feature modify permission denied on layer '%1'" ).arg(
typeName );
731 action.errorMsg = QStringLiteral(
"Insert features failed on layer '%1'" ).arg(
typeName );
732 if ( provider ->hasErrors() )
744 action.errorMsg = QStringLiteral(
"Error committing inserts: %1" ).arg( vlayer->
commitErrors().join( QStringLiteral(
"; " ) ) );
749 action.error =
false;
753 for (
const QgsFeature &feat : qgis::as_const( featureList ) )
760 filterRestorer.reset();
770 const QMap<QString, int> fieldMap = provider->
fieldNameMap();
771 QMap<QString, int>::const_iterator fieldMapIt;
773 for (
int i = 0; i < featureNodeList.count(); i++ )
777 QDomElement featureElem = featureNodeList.at( i ).toElement();
778 QDomNode currentAttributeChild = featureElem.firstChild();
779 bool conversionSuccess =
true;
781 while ( !currentAttributeChild.isNull() )
783 QDomElement currentAttributeElement = currentAttributeChild.toElement();
784 QString attrName = currentAttributeElement.localName();
786 if ( attrName != QLatin1String(
"boundedBy" ) )
788 if ( attrName != QLatin1String(
"geometry" ) )
790 fieldMapIt = fieldMap.find( attrName );
791 if ( fieldMapIt == fieldMap.constEnd() )
796 QgsField field = fields.
at( fieldMapIt.value() );
797 QString attrValue = currentAttributeElement.text();
798 int attrType = field.
type();
800 QgsMessageLog::logMessage( QStringLiteral(
"attr: name=%1 idx=%2 value=%3" ).arg( attrName ).arg( fieldMapIt.value() ).arg( attrValue ) );
802 if ( attrType == QVariant::Int )
803 feat.setAttribute( fieldMapIt.value(), attrValue.toInt( &conversionSuccess ) );
804 else if ( attrType == QVariant::Double )
805 feat.setAttribute( fieldMapIt.value(), attrValue.toDouble( &conversionSuccess ) );
807 feat.setAttribute( fieldMapIt.value(), attrValue );
809 if ( !conversionSuccess )
819 throw QgsRequestNotWellFormedException( QStringLiteral(
"Geometry from GML error on layer insert" ) );
821 feat.setGeometry( g );
824 currentAttributeChild = currentAttributeChild.nextSibling();
834 if ( !parameters.contains( QStringLiteral(
"OPERATION" ) ) )
836 throw QgsRequestNotWellFormedException( QStringLiteral(
"OPERATION parameter is mandatory" ) );
838 if ( parameters.value( QStringLiteral(
"OPERATION" ) ).toUpper() != QStringLiteral(
"DELETE" ) )
840 throw QgsRequestNotWellFormedException( QStringLiteral(
"Only DELETE value is defined for OPERATION parameter" ) );
844 if ( ( parameters.contains( QStringLiteral(
"FEATUREID" ) )
845 && ( parameters.contains( QStringLiteral(
"FILTER" ) ) || parameters.contains( QStringLiteral(
"BBOX" ) ) ) )
846 || ( parameters.contains( QStringLiteral(
"FILTER" ) )
847 && ( parameters.contains( QStringLiteral(
"FEATUREID" ) ) || parameters.contains( QStringLiteral(
"BBOX" ) ) ) )
848 || ( parameters.contains( QStringLiteral(
"BBOX" ) )
849 && ( parameters.contains( QStringLiteral(
"FEATUREID" ) ) || parameters.contains( QStringLiteral(
"FILTER" ) ) ) )
852 throw QgsRequestNotWellFormedException( QStringLiteral(
"FEATUREID FILTER and BBOX parameters are mutually exclusive" ) );
855 transactionRequest request;
857 QStringList typeNameList;
859 if ( parameters.contains( QStringLiteral(
"FEATUREID" ) ) )
861 QStringList fidList = parameters.value( QStringLiteral(
"FEATUREID" ) ).split(
',' );
863 QMap<QString, QStringList> fidsMap;
865 QStringList::const_iterator fidIt = fidList.constBegin();
866 for ( ; fidIt != fidList.constEnd(); ++fidIt )
869 QString fid = *fidIt;
872 if ( !fid.contains(
'.' ) )
877 QString
typeName = fid.section(
'.', 0, 0 );
878 fid = fid.section(
'.', 1, 1 );
879 if ( !typeNameList.contains(
typeName ) )
893 QMap<QString, QStringList>::const_iterator fidsMapIt = fidsMap.constBegin();
894 while ( fidsMapIt != fidsMap.constEnd() )
896 transactionDelete action;
897 action.typeName = fidsMapIt.key();
899 action.serverFids = fidsMapIt.value();
902 request.deletes.append( action );
907 if ( !parameters.contains( QStringLiteral(
"TYPENAME" ) ) )
909 throw QgsRequestNotWellFormedException( QStringLiteral(
"TYPENAME is mandatory except if FEATUREID is used" ) );
912 typeNameList = parameters.value( QStringLiteral(
"TYPENAME" ) ).split(
',' );
915 QStringList::const_iterator typeNameIt = typeNameList.constBegin();
916 for ( ; typeNameIt != typeNameList.constEnd(); ++typeNameIt )
921 transactionDelete action;
924 request.deletes.append( action );
928 if ( parameters.contains( QStringLiteral(
"EXP_FILTER" ) ) )
930 QString expFilterName = parameters.value( QStringLiteral(
"EXP_FILTER" ) );
931 QStringList expFilterList;
932 QRegExp rx(
"\\(([^()]+)\\)" );
933 if ( rx.indexIn( expFilterName, 0 ) == -1 )
935 expFilterList << expFilterName;
940 while ( ( pos = rx.indexIn( expFilterName, pos ) ) != -1 )
942 expFilterList << rx.cap( 1 );
943 pos += rx.matchedLength();
948 if ( request.deletes.size() == expFilterList.size() )
951 QList<transactionDelete>::iterator dIt = request.deletes.begin();
952 QStringList::const_iterator expFilterIt = expFilterList.constBegin();
953 for ( ; dIt != request.deletes.end(); ++dIt )
955 transactionDelete &action = *dIt;
958 if ( expFilterIt != expFilterList.constEnd() )
960 expFilter = *expFilterIt;
962 std::shared_ptr<QgsExpression> filter(
new QgsExpression( expFilter ) );
965 if ( filter->hasParserError() )
971 if ( filter->needsGeometry() )
975 action.featureRequest.setFilterExpression( filter->expression() );
986 if ( parameters.contains( QStringLiteral(
"BBOX" ) ) )
989 QString bbox = parameters.value( QStringLiteral(
"BBOX" ) );
990 if ( bbox.isEmpty() )
992 throw QgsRequestNotWellFormedException( QStringLiteral(
"BBOX parameter is empty" ) );
996 QStringList corners = bbox.split(
',' );
997 if ( corners.size() != 4 )
999 throw QgsRequestNotWellFormedException( QStringLiteral(
"BBOX has to be composed of 4 elements: '%1'" ).arg( bbox ) );
1005 for (
int i = 0; i < 4; i++ )
1007 corners[i].replace(
' ',
'+' );
1008 d[i] = corners[i].toDouble( &ok );
1011 throw QgsRequestNotWellFormedException( QStringLiteral(
"BBOX has to be composed of 4 double: '%1'" ).arg( bbox ) );
1018 QList<transactionDelete>::iterator dIt = request.deletes.begin();
1019 for ( ; dIt != request.deletes.end(); ++dIt )
1021 transactionDelete &action = *dIt;
1022 action.featureRequest.setFilterRect( extent );
1026 else if ( parameters.contains( QStringLiteral(
"FILTER" ) ) )
1028 QString filterName = parameters.value( QStringLiteral(
"FILTER" ) );
1029 QStringList filterList;
1030 QRegExp rx(
"\\(([^()]+)\\)" );
1031 if ( rx.indexIn( filterName, 0 ) == -1 )
1033 filterList << filterName;
1038 while ( ( pos = rx.indexIn( filterName, pos ) ) != -1 )
1040 filterList << rx.cap( 1 );
1041 pos += rx.matchedLength();
1046 if ( request.deletes.size() != filterList.size() )
1048 throw QgsRequestNotWellFormedException( QStringLiteral(
"There has to be a 1:1 mapping between each element in a TYPENAME and the FILTER list" ) );
1052 QList<transactionDelete>::iterator dIt = request.deletes.begin();
1053 QStringList::const_iterator filterIt = filterList.constBegin();
1054 for ( ; dIt != request.deletes.end(); ++dIt )
1056 transactionDelete &action = *dIt;
1059 QDomDocument filter;
1060 if ( filterIt != filterList.constEnd() )
1063 if ( !filter.setContent( *filterIt,
true, &errorMsg ) )
1065 throw QgsRequestNotWellFormedException( QStringLiteral(
"error message: %1. The XML string was: %2" ).arg( errorMsg, *filterIt ) );
1069 QDomElement filterElem = filter.firstChildElement();
1070 QStringList serverFids;
1071 action.featureRequest =
parseFilterElement( action.typeName, filterElem, serverFids, project );
1072 action.serverFids = serverFids;
1074 if ( filterIt != filterList.constEnd() )
1087 transactionRequest request;
1089 QDomNodeList docChildNodes = docElem.childNodes();
1091 QDomElement actionElem;
1094 for (
int i = docChildNodes.count(); 0 < i; --i )
1096 actionElem = docChildNodes.at( i - 1 ).toElement();
1097 actionName = actionElem.localName();
1099 if ( actionName == QLatin1String(
"Insert" ) )
1102 request.inserts.append( action );
1104 else if ( actionName == QLatin1String(
"Update" ) )
1107 request.updates.append( action );
1109 else if ( actionName == QLatin1String(
"Delete" ) )
1112 request.deletes.append( action );
1121 QString
typeName = actionElem.attribute( QStringLiteral(
"typeName" ) );
1125 QDomElement filterElem = actionElem.firstChild().toElement();
1126 if ( filterElem.tagName() != QLatin1String(
"Filter" ) )
1131 QStringList serverFids;
1138 action.
error =
false;
1140 if ( actionElem.hasAttribute( QStringLiteral(
"handle" ) ) )
1142 action.
handle = actionElem.attribute( QStringLiteral(
"handle" ) );
1150 QString
typeName = actionElem.attribute( QStringLiteral(
"typeName" ) );
1154 QDomNodeList propertyNodeList = actionElem.elementsByTagName( QStringLiteral(
"Property" ) );
1155 if ( propertyNodeList.isEmpty() )
1160 QMap<QString, QString> propertyMap;
1161 QDomElement propertyElem;
1162 QDomElement nameElem;
1163 QDomElement valueElem;
1164 QDomElement geometryElem;
1166 for (
int l = 0; l < propertyNodeList.count(); ++l )
1168 propertyElem = propertyNodeList.at( l ).toElement();
1169 nameElem = propertyElem.elementsByTagName( QStringLiteral(
"Name" ) ).at( 0 ).toElement();
1170 valueElem = propertyElem.elementsByTagName( QStringLiteral(
"Value" ) ).at( 0 ).toElement();
1171 if ( nameElem.text() != QLatin1String(
"geometry" ) )
1173 propertyMap.insert( nameElem.text(), valueElem.text() );
1177 geometryElem = valueElem;
1181 QDomNodeList filterNodeList = actionElem.elementsByTagName( QStringLiteral(
"Filter" ) );
1183 QStringList serverFids;
1184 if ( filterNodeList.size() != 0 )
1186 QDomElement filterElem = filterNodeList.at( 0 ).toElement();
1196 action.
error =
false;
1198 if ( actionElem.hasAttribute( QStringLiteral(
"handle" ) ) )
1200 action.
handle = actionElem.attribute( QStringLiteral(
"handle" ) );
1208 QDomNodeList featureNodeList = actionElem.childNodes();
1209 if ( featureNodeList.size() != 1 )
1211 throw QgsRequestNotWellFormedException( QStringLiteral(
"Insert action element must have one or more child node" ) );
1215 for (
int i = 0; i < featureNodeList.count(); ++i )
1217 QString tempTypeName = featureNodeList.at( i ).toElement().localName();
1218 if ( tempTypeName.contains(
':' ) )
1219 tempTypeName = tempTypeName.section(
':', 1, 1 );
1225 else if ( tempTypeName !=
typeName )
1227 throw QgsRequestNotWellFormedException( QStringLiteral(
"Insert action element must have one typename features" ) );
1231 transactionInsert action;
1233 action.featureNodeList = featureNodeList;
1234 action.error =
false;
1236 if ( actionElem.hasAttribute( QStringLiteral(
"handle" ) ) )
1238 action.handle = actionElem.attribute( QStringLiteral(
"handle" ) );
1247 void addTransactionResult( QDomDocument &responseDoc, QDomElement &responseElem,
const QString &status,
1248 const QString &locator,
const QString &message )
1250 QDomElement trElem = responseDoc.createElement( QStringLiteral(
"TransactionResult" ) );
1251 QDomElement stElem = responseDoc.createElement( QStringLiteral(
"Status" ) );
1252 QDomElement successElem = responseDoc.createElement( status );
1253 stElem.appendChild( successElem );
1254 trElem.appendChild( stElem );
1255 responseElem.appendChild( trElem );
1257 if ( !locator.isEmpty() )
1259 QDomElement locElem = responseDoc.createElement( QStringLiteral(
"Locator" ) );
1260 locElem.appendChild( responseDoc.createTextNode( locator ) );
1261 trElem.appendChild( locElem );
1264 if ( !message.isEmpty() )
1266 QDomElement mesElem = responseDoc.createElement( QStringLiteral(
"Message" ) );
1267 mesElem.appendChild( responseDoc.createTextNode( message ) );
1268 trElem.appendChild( mesElem );