xml-toolkit 1.0.27 → 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -107,4 +107,30 @@ const rq = http.request (endpointURL, {method, headers})
107
107
  rq.write (body)
108
108
  ```
109
109
 
110
+ * [Implementing](https://github.com/do-/node-xml-toolkit/wiki/Use-Case:-Implement-a-SOAP-Web-Service) a SOAP service
111
+
112
+ ```js
113
+ const {XMLSchemata, SOAP11, SOAP12, SOAPFault} = require ('xml-toolkit')
114
+
115
+ const SOAP = SOAP11 // or SOAP12
116
+
117
+ const xs = new XMLSchemata (`myService.wsdl`)
118
+
119
+ let body, statusCode; try {
120
+ body = xs.stringify (myMethod (/*...*/))
121
+ statusCode = 200
122
+ }
123
+ catch (x) {
124
+ body = new SOAPFault (x)
125
+ statusCode = 500
126
+ }
127
+
128
+ rp.writeHead (statusCode, {
129
+ 'Content-Type': SOAP.contentType,
130
+ })
131
+
132
+ const xml = SOAP.message (body)
133
+ rp.end (xml)
134
+ ```
135
+
110
136
  For more information, see [wiki docs](https://github.com/do-/node-xml-toolkit/wiki).
@@ -3,8 +3,8 @@ const assert = require ('assert')
3
3
  const NamespacePrefixesMap = class extends Map {
4
4
 
5
5
  constructor (schemata) {
6
-
7
- super ()
6
+
7
+ super ([['http://www.w3.org/2001/XMLSchema-instance', 'xsi']])
8
8
 
9
9
  for (const uri of schemata.keys ())
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xml-toolkit",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "description": "Collection of classes for dealing with XML",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -12,8 +12,9 @@
12
12
  },
13
13
  "keywords": [
14
14
  "xml",
15
- "sax",
16
- "stax"
15
+ "soap",
16
+ "xsd",
17
+ "sax"
17
18
  ],
18
19
  "author": "Dmitry Ovsyanko",
19
20
  "license": "MIT",
package/test/test.js CHANGED
@@ -337,7 +337,7 @@ function test_007_wsdl (fn) {
337
337
  const soap11 = new SOAP11 ('test/20186.wsdl')
338
338
  const soap12 = new SOAP12 ('test/20186.wsdl')
339
339
 
340
- const d = {GetForm9Sync: {address: {Region: {Code: 78}}}}
340
+ const d = {"GetForm9Sync":{"person":{"LastName":"ИВАНОВА","FirstName":"ПЕТР","SecondName":null,"BirthDate":"1970-11-11"},"address":{"Region":{"Code":"78","Name":"Санкт-Петербург"},"Street":{"Code":6597,"Name":"Московский пр-кт"},"House":"д. 18 литера Е","Flat":"33"}}}
341
341
 
342
342
  console.log (soap11.http (d))
343
343
  console.log (soap12.http (d))