Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Soap Web services? #1

Closed
Ohpizarro opened this issue Jul 17, 2020 · 1 comment
Closed

Soap Web services? #1

Ohpizarro opened this issue Jul 17, 2020 · 1 comment

Comments

@Ohpizarro
Copy link

replace XmlElement inside an XmlDocument.
I use it to build xml for SOAP webservices

@Ohpizarro
Copy link
Author

To solve it I am parameterizing through XmlNode. It is right?
variable tipoDocumento is an array with XmlElement or must be excluded if it contains no elements.

XmlNode _segmento;
if (tipoDocumento == null) {
_segmento = XmlComment('Vacio');
} else {
_segmento = XmlElement(
name: 'wsn:tipoDocumento',
children: [
XmlElement(
name: 'java:JavaLangstring',
children: [
XmlText('$tipoDocumento'),
],
)
],
);
}


XmlDocument xmlDocument = XmlDocument(
[
XmlDeclaration(version: '1.0', encoding: 'UTF-8'),
XmlElement(
name: 'soapenv:Envelope',
attributes: [
XmlAttribute(
'xmlns:soapenv', 'http://schemas.xmlsoap.org/soap/envelope/'),
XmlAttribute('xmlns:cl', 'cl.chile.sve'),
XmlAttribute('xmlns:wsn', 'http://cl/chile/sve/cns/wsn'),
XmlAttribute('xmlns:java', 'java:cl.chile.sve.cns.wsn'),
],
children: [
XmlElement(
name: 'soapenv:Header',
children: [
XmlElement(
name: 'cl:token',
children: [
XmlText('$token'),
],
)
],
),
XmlElement(
name: 'soapenv:Body',
children: [
XmlElement(
name: 'wsn:obtenerDocumentosVisados',
children: [
_segmento, ################## Here,I use the variable #####
XmlElement(
name: 'wsn:codigoAduaneroDocumento',
children: [
XmlElement(
name: 'java:JavaLangstring',
children: [
XmlText('$codigoAduaneroDocumento'),
],
)
],
),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants