loopbackio / loopbackio/loopback-datasource-juggler

Js-code from lib/model.js gets included in SOAP-request causing SOAP-fault

Open
#1,412 39 comments 1 reaction 1 assignee View on GitHub

@rashmihunt is already working on this.

Since Jul 5, 2017.

bug help wanted major pinned
Dominant language
JavaScript
Stars
282
Forks
366
Avg merge
17h 4m
Merged PRs (30d)
10

Description

# Steps to reproduce
- [ ] bug

I have auto discovered a SOAP 1.1 Webservice with `lb soap` and Loobback created models as expected. However when using the StrongLoop API explorer, the SOAP requests fail as they are not properly formatted.

**Stack trace**
````
"Error: faultcode: soap:Client faultstring: Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element '__cachedRelations'. One of '{xxx, xxx}' is expected.
at XMLHandler.xmlToJson (testapp\node_modules\strong-soap\src\parser\xmlHandler.js:635:23)
at testapp\node_modules\strong-soap\src\client.js:279:28
at testapp\node_modules\loopback\node_modules\loopback-datasource-juggler\lib\observer.js:172:22
at doNotify (testapp\node_modules\loopback\node_modules\loopback-datasource-juggler\lib\observer.js:99:49)
at SOAPConnector.ObserverMixin._notifyBaseObservers (testapp\node_modules\loopback\node_modules\loopback-datasource-juggler\lib\observer.js:122:5)
at SOAPConnector.ObserverMixin.notifyObserversOf (testapp\node_modules\loopback\node_modules\loopback-datasource-juggler\lib\observer.js:97:8)
at cbForWork (testapp\node_modules\loopback\node_modules\loopback-datasource-juggler\lib\observer.js:162:14)
at Request._callback (testapp\node_modules\loopback-connector-soap\lib\http.js:98:9)
at Request.self.callback (testapp\node_modules\request\request.js:188:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request. (testapp\node_modules\request\request.js:1171:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage. (testapp\node_modules\request\request.js:1091:12)\
at IncomingMessage.g (events.js:292:16)"
````

When enabling the debug on `loopback:persisted-model` I can see the SOAP xml is cluttered by code originating from `strongloop/loopback-datasource-juggler` as is mentioned in [issue 77 from loopback-connecter-soap](https://github.com/strongloop/loopback-connector-soap/issues/77) by @liudonghua123. Since the code is in this repo I thought it would be best to open an issue here.

# Expected result
I would expect the SOAP request to be properly formatted. And a SOAP response without an error.

# Additional information

win32 x64 6.11.0

+-- loopback@3.8.0
+-- loopback-boot@2.24.1
+-- loopback-component-explorer@2.7.0
+-- loopback-connector-soap@4.0.0
+-- loopback-datasource-juggler@3.9.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.