Target namespace for exposed webservice on custom cloud

1
Hi guys, We have exposed a number of webservices on an existing application and we are having problems trying to use the webservice when we deploy it to the custom cloud. We have created a test app that consumes the webservices locally and all works. We get the data back and even with filters we get all the correct data we are supposed to. So, deadline is approaching and we've deployed app to the custom cloud test environment and webservices don't seem to work at all. the customer will need to use the webservices and I just cannot understand what is wrong in terms of it works locally, but not on the cloud. ws-doc shows an error! We've changed the namespace to the test environment url and we also used "/ws/" as instructed in other similar forum questions, but we keep not getting any results. The documentation is great only for locally exposing a webservice. There is no example how to set the namespace for the mendix cloud. Can someone help me with the setup on the cloud? There doesn't seem to be anywhere else I can see that needs updating, apart for the namespace, so must be there that we need to get the correct detail, as with localhost everything works great. This is what we have and tried: a) locally: http://localhost:8085/ws-doc/mywebservice1?wsdl with the above target namespace, we can run a secondary app that consumes the webservice(s) and get back the required data. b) custom cloud test environment: https://myapplication-test.mendix.com/ws/mywebservice1?wsdl when deployed, we try to cal /ws/ and we get the following error: <soap:Envelope><soap:Body><soap:Fault><faultcode>Client</faultcode><faultstring>Service name should be specified</faultstring></soap:Fault></soap:Body></soap:Envelope> if we try to call the whole wsdl we get the following error: <soap:Envelope><soap:Body><soap:Fault><faultcode>Server</faultcode><faultstring>com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0]</faultstring></soap:fault></soap:body></soap:envelope> We've tried a number of different things for the namespace... with "/ws/", without it,. with /"ws-doc/", without it, with "?wsdl" at the end, without it, etc, etc. Locally still points to the correct webservice, even if we change the namespace, and obviously is only over http, so as the app in the custom cloud is over secured http (https), what else do we need to do, that is not currently on any documentation, to get the webservices working on the custom cloud? LR.
asked
2 answers
3

I think you are confusing namespaces and endpoints.

The namespace for a webservice should be set once, when creating the published webservice. It is a fundamental part of the webservice definition. Note expecially that the value of the namespace doesn't really matter, since the URL isn't actually used, called or opened anywhere.

The endpoint defines where the webservice is located. This can vary, for instance depending on whether you want to call a websrevice in a production, acceptance or test environment.

Based on your errors, I think you have published a webservice with a certain namespace, imported that into a different project, and then changed the namespace in the publishing project. Again, once you publish a webservice, you should define the namespace once, and then never touch it again. To fix this, re-import the webservice definition (wsdl) into you consuming project. Then, set the endpoint location to the endpoint of your publishing app node.

*Edit: According to your comments, you are mostly interested in downloading the ws-doc from a cloud node. As Achiel comments, this is disallowed on production environments for security reasons. Using the WSDL you can get from a development environment, your customer should be able to call your webservice using your production endpoint.

*Edit 2: The easiest way to have a third party consume your web service for a production cloud environment:

  • Open the published web service in the modeler, click 'Export WSDL file'
  • Send this file to the third party
  • Tell them to replace the "localhost:8080" part in the soap endpoint with the actual URL of your production app (maybe something like "app.mendixcloud.com"?)

If you are using an older modeler that does not have the option above:

  • Deploy the app locally, browse to http://localhost:8080/ws-doc/
  • Find the web service you want to use, click the 'WSDL schema' link
  • Save that page to disk (as a .wsdl) file, send it to the third party.
  • Again, tell them to fix the soap endpoint using you app URL
answered
0

Regarding the "service name should be specified" error, we've also experienced this problem. For us the problem was in the IIS configuration; if you have IIS in front of your Mendix application, make sure you setup the URL Rewrite Rules correctly.

Make sure you have a Reverse Proxy rule as follows:

pattern: ^(ws/)(.*) and rewrite URL: http://localhost:8080/{R:1}{R:2}

answered