web service tutorial for version 7

1
0
-1

I'm following the web service tutorial for version 7.3 here

The main problem as I see it is that the tutorial is for the pre-version 7 of bonitasoft before UI/Contracts etc. So I've tried to develop an example to use by building a contract first etc.

I've also used the example supplied by Antoine Mottier from his [dropbox account] (https://www.dropbox.com/s/3uanksh37vpdhu2/WebServiceWeather-1.0.bos?dl=0)

However this then comes up against the 2nd problem which is that the GetWeather webservice on webservicex.net doesn't seem to be working. I tried using "Grenoble/France" directly on the page here and it came back saying that "Data Not Found".

So I decided to change the example to another web service which was working, I found the ChangeLengthUnit example for changing measurements to other measurement units.

The pre-version 7 example passes the data into the SOAP envelope using process variables, I think that this is different to how it should be in 7 but I followed it anyway by assigning the variables from the instantiation contract to process variables and then referencing these in the soap envelope. However it didn't work, whereas when I used the Weather example the values were passed in: -

  1. 2016-11-13 15:35:40.147 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector serviceNS GlobalWeather
  2. 2016-11-13 15:35:40.147 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector serviceName http://www.webserviceX.NET
  3. 2016-11-13 15:35:40.148 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector portName GlobalWeatherSoap12
  4. 2016-11-13 15:35:40.148 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector binding http://www.w3.org/2003/05/soap/bindings/HTTP/
  5. 2016-11-13 15:35:40.148 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector endpointAddress http://www.webservicex.net/globalweather.asmx
  6. 2016-11-13 15:35:40.275 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector soapAction http://www.webserviceX.net/GetWeather
  7. 2016-11-13 15:35:40.275 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector envelope <?xml version="1.0" encoding="UTF-8"?>
  8. <env:Body>
  9. <tns:CityName>Paris</tns:CityName>
  10. <tns:CountryName>France</tns:CountryName>
  11. </tns:GetWeather>
  12. </env:Body>
  13. </env:Envelope>
  14. 2016-11-13 15:35:40.717 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector buildResponseDocumentEnvelope false
  15. 2016-11-13 15:35:40.718 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector buildResponseDocumentBody true
  16. 2016-11-13 15:35:40.728 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector printRequestAndResponse false

But when I tried to do the same for the other webservice, it seems like the process variables weren't passed through:-

  1. 2016-11-13 19:50:48.212 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector serviceNS ChangeLengthUnit
  2. 2016-11-13 19:50:48.212 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector serviceName http://www.webserviceX.NET
  3. 2016-11-13 19:50:48.212 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector portName ChangeLengthUnitSoap12
  4. 2016-11-13 19:50:48.213 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector binding http://www.w3.org/2003/05/soap/bindings/HTTP/
  5. 2016-11-13 19:50:48.213 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector endpointAddress http://www.webservicex.net/length.asmx
  6. 2016-11-13 19:50:48.237 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector soapAction http://www.webserviceX.NET/ChangeLengthUnit
  7. 2016-11-13 19:50:48.238 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector envelope <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
  8.  
  9. <env:Body>
  10.  
  11.  
  12. <tns:lengthValue>${afhFromLengthUnit}</tns:lengthValue>
  13.  
  14. <tns:fromLengthUnit>${afhFromLengthUnit}</tns:fromLengthUnit>
  15.  
  16. <tns:toLengthUnit>${afhToLengthUnit}</tns:toLengthUnit>
  17.  
  18. </tns:ChangeLengthUnit>
  19.  
  20. </env:Body>
  21.  
  22. </env:Envelope>
  23. 2016-11-13 19:50:48.239 +0000 SEVERE: org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork THREAD_ID=128 | HOSTNAME=JJEC-laptop | TENANT_ID=1 | The work [ExecuteConnectorOfActivity: flowNodeInstanceId = 80023, connectorDefinitionName = getlengthConversion] failed. The failure will be handled.
  24. 2016-11-13 19:50:48.256 +0000 SEVERE: org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork THREAD_ID=128 | HOSTNAME=JJEC-laptop | TENANT_ID=1 | org.bonitasoft.engine.core.connector.exception.SConnectorException : "PROCESS_DEFINITION_ID=8010533778434496574 | PROCESS_NAME=MeasurementConversion | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=4009 | ROOT_PROCESS_INSTANCE_ID=4009 | FLOW_NODE_DEFINITION_ID=7866049870035532578 | FLOW_NODE_INSTANCE_ID=80023 | FLOW_NODE_NAME=Get Calc Result | CONNECTOR_IMPLEMENTATION_CLASS_NAME=getlengthConversion | CONNECTOR_INSTANCE_ID=80009 | org.bonitasoft.engine.connector.exception.SConnectorException: java.util.concurrent.ExecutionException: org.bonitasoft.engine.connector.exception.SConnectorException: org.bonitasoft.engine.connector.ConnectorException: Exception trying to call remote webservice"
  25. org.bonitasoft.engine.core.connector.exception.SConnectorException: PROCESS_DEFINITION_ID=8010533778434496574 | PROCESS_NAME=MeasurementConversion | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=4009 | ROOT_PROCESS_INSTANCE_ID=4009 | FLOW_NODE_DEFINITION_ID=7866049870035532578 | FLOW_NODE_INSTANCE_ID=80023 | FLOW_NODE_NAME=Get Calc Result | CONNECTOR_IMPLEMENTATION_CLASS_NAME=getlengthConversion | CONNECTOR_INSTANCE_ID=80009 | org.bonitasoft.engine.connector.exception.SConnectorException: java.util.concurrent.ExecutionException: org.bonitasoft.engine.connector.exception.SConnectorException: org.bonitasoft.engine.connector.ConnectorException: Exception trying to call remote webservice

Can anyone explain where I'm going wrong? I would have expected to see "feet" instead of ${afhFromLengthUnit} inside of the envelope.

TIA

Comments

Submitted by the_antman on Mon, 11/14/2016 - 16:43

Just went through the tutorial again and amended the code for the envelope and now it seems to be at least passing through the values so this is better. However looking in the engine log I have the following:

  1. 2016-11-14 15:19:40.514 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector serviceNS ChangeLengthUnit
  2. 2016-11-14 15:19:40.514 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector serviceName http://www.webserviceX.NET
  3. 2016-11-14 15:19:40.514 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector portName ChangeLengthUnitSoap12
  4. 2016-11-14 15:19:40.514 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector binding http://www.w3.org/2003/05/soap/bindings/HTTP/
  5. 2016-11-14 15:19:40.514 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector endpointAddress http://www.webservicex.net/length.asmx
  6. 2016-11-14 15:19:40.534 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector soapAction http://www.webserviceX.NET/ChangeLengthUnit
  7. 2016-11-14 15:19:40.534 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector envelope <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
  8. <env:Body>
  9. <tns:LengthValue>631.0</tns:LengthValue>
  10. <tns:fromLengthUnit>feet</tns:fromLengthUnit>
  11. <tns:toLengthUnit>meter</tns:toLengthUnit>
  12. </tns:ChangeLengthUnit>
  13. </env:Body>
  14. </env:Envelope>
  15. 2016-11-14 15:19:40.534 +0000 SEVERE: org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork THREAD_ID=122 | HOSTNAME=JJEC-laptop | TENANT_ID=1 | The work [ExecuteConnectorOfActivity: flowNodeInstanceId = 100012, connectorDefinitionName = getlengthConversion] failed. The failure will be handled.
  16. 2016-11-14 15:19:40.550 +0000 SEVERE: org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork THREAD_ID=122 | HOSTNAME=JJEC-laptop | TENANT_ID=1 | org.bonitasoft.engine.core.connector.exception.SConnectorException : "PROCESS_DEFINITION_ID=8209684801499343137 | PROCESS_NAME=MeasurementConversion | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=5006 | ROOT_PROCESS_INSTANCE_ID=5006 | FLOW_NODE_DEFINITION_ID=6803091207177009552 | FLOW_NODE_INSTANCE_ID=100012 | FLOW_NODE_NAME=Get Calc Result | CONNECTOR_IMPLEMENTATION_CLASS_NAME=getlengthConversion | CONNECTOR_INSTANCE_ID=100006 | org.bonitasoft.engine.connector.exception.SConnectorException: java.util.concurrent.ExecutionException: org.bonitasoft.engine.connector.exception.SConnectorException: org.bonitasoft.engine.connector.ConnectorException: Exception trying to call remote webservice"
  17. org.bonitasoft.engine.core.connector.exception.SConnectorException: PROCESS_DEFINITION_ID=8209684801499343137 | PROCESS_NAME=MeasurementConversion | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=5006 | ROOT_PROCESS_INSTANCE_ID=5006 | FLOW_NODE_DEFINITION_ID=6803091207177009552 | FLOW_NODE_INSTANCE_ID=100012 | FLOW_NODE_NAME=Get Calc Result | CONNECTOR_IMPLEMENTATION_CLASS_NAME=getlengthConversion | CONNECTOR_INSTANCE_ID=100006 | org.bonitasoft.engine.connector.exception.SConnectorException: java.util.concurrent.ExecutionException: org.bonitasoft.engine.connector.exception.SConnectorException: org.bonitasoft.engine.connector.ConnectorException: Exception trying to call remote webservice
  18. at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeConnectorInClassloader(ConnectorServiceImpl.java:275)
  19. at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeConnector(ConnectorServiceImpl.java:148)
  20. at org.bonitasoft.engine.connector.ConnectorServiceDecorator.executeConnector(ConnectorServiceDecorator.java:114)
  21. at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.work(ExecuteConnectorWork.java:138)
  22. at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
  23. at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
  24. at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
  25. at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
  26. at org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork.work(FailureHandlingBonitaWork.java:66)
  27. at org.bonitasoft.engine.work.BonitaWork.run(BonitaWork.java:56)
  28. at org.bonitasoft.engine.work.SequenceRunnableExecutor.innerRun(SequenceRunnableExecutor.java:47)
  29. at org.bonitasoft.engine.work.BonitaRunnable.run(BonitaRunnable.java:35)
  30. at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  31. at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  32. at java.lang.Thread.run(Unknown Source)
  33. Caused by: org.bonitasoft.engine.connector.exception.SConnectorException: java.util.concurrent.ExecutionException: org.bonitasoft.engine.connector.exception.SConnectorException: org.bonitasoft.engine.connector.ConnectorException: Exception trying to call remote webservice
  34. at org.bonitasoft.engine.connector.impl.ConnectorExecutorImpl.execute(ConnectorExecutorImpl.java:125)
  35. at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeConnectorInClassloader(ConnectorServiceImpl.java:269)
  36. ... 14 more

Any pointers, really appreciated.

Submitted by Sean McP on Tue, 11/15/2016 - 00:49

well done for trying to get this working, will you provide details once it's working?

Are you behind a proxy?

Submitted by the_antman on Tue, 11/15/2016 - 20:47

No, I'm not behind a proxy, I'm working from home.

I will post details of how I got this to work but without any guidance as in where to start looking, the investigation kind of stops here.

Submitted by Lionel Palacin on Tue, 11/15/2016 - 21:03

Hi,

Do you mind sharing your BOS file here? So I can have a look to what you have done so far.

Thanks

Submitted by the_antman on Tue, 11/15/2016 - 21:23

Sure, the link is here.

It's pretty messy, I suspected that you'd pass objects from the BDM in v.7 but I sort of assigned the objects from the input forms to process variables (to be similar to the tutorial) before the out connector.

Much appreciated,

1 answer

1
+1
-1
This one is the BEST answer!

Hi,

It sounds like the envelope sends by the connector was wrong. I changed it to:

  1. <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://www.webserviceX.NET/">
  2. <soapenv:Header/>
  3. <soapenv:Body>
  4. <web:ChangeLengthUnit>
  5. <web:LengthValue>${afhLengthValue}</web:LengthValue>
  6. <web:fromLengthUnit>${afhFromLengthUnit}</web:fromLengthUnit>
  7. <web:toLengthUnit>${afhToLengthUnit}</web:toLengthUnit>
  8. </web:ChangeLengthUnit>
  9. </soapenv:Body>
  10. </soapenv:Envelope>

Now it works for the connector part. Sounds like there is an error further in the process but I didn't take a look.

Best

Notifications