web service tutorial for version 7

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: -

2016-11-13 15:35:40.147 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector serviceNS GlobalWeather
2016-11-13 15:35:40.147 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector serviceName http://www.webserviceX.NET
2016-11-13 15:35:40.148 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector portName GlobalWeatherSoap12
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/
2016-11-13 15:35:40.148 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector endpointAddress http://www.webservicex.net/globalweather.asmx
2016-11-13 15:35:40.275 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector soapAction http://www.webserviceX.net/GetWeather
2016-11-13 15:35:40.275 +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">
   <env:Body>
      <tns:GetWeather xmlns:tns="http://www.webserviceX.NET">
         <tns:CityName>Paris</tns:CityName>
         <tns:CountryName>France</tns:CountryName>
      </tns:GetWeather>
   </env:Body>
 </env:Envelope>
2016-11-13 15:35:40.717 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector buildResponseDocumentEnvelope false
2016-11-13 15:35:40.718 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector buildResponseDocumentBody true
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:-

2016-11-13 19:50:48.212 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector serviceNS ChangeLengthUnit
2016-11-13 19:50:48.212 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector serviceName http://www.webserviceX.NET
2016-11-13 19:50:48.212 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector portName ChangeLengthUnitSoap12
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/
2016-11-13 19:50:48.213 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector endpointAddress http://www.webservicex.net/length.asmx
2016-11-13 19:50:48.237 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector soapAction http://www.webserviceX.NET/ChangeLengthUnit
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">

  <env:Body>

	<tns:ChangeLengthUnit xmlns:tns="http://www.webserviceX.NET">

	<tns:lengthValue>${afhFromLengthUnit}</tns:lengthValue>

      <tns:fromLengthUnit>${afhFromLengthUnit}</tns:fromLengthUnit>

      <tns:toLengthUnit>${afhToLengthUnit}</tns:toLengthUnit>

    </tns:ChangeLengthUnit>

  </env:Body>

</env:Envelope>
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.
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"
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

Hi,

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

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://www.webserviceX.NET/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:ChangeLengthUnit>
         <web:LengthValue>${afhLengthValue}</web:LengthValue>
         <web:fromLengthUnit>${afhFromLengthUnit}</web:fromLengthUnit>
         <web:toLengthUnit>${afhToLengthUnit}</web:toLengthUnit>
      </web:ChangeLengthUnit>
   </soapenv:Body>
</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

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:

2016-11-14 15:19:40.514 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector serviceNS ChangeLengthUnit
2016-11-14 15:19:40.514 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector serviceName http://www.webserviceX.NET
2016-11-14 15:19:40.514 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector portName ChangeLengthUnitSoap12
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/
2016-11-14 15:19:40.514 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector endpointAddress http://www.webservicex.net/length.asmx
2016-11-14 15:19:40.534 +0000 INFO: org.bonitasoft.connectors.ws.cxf.SecureWSConnector soapAction http://www.webserviceX.NET/ChangeLengthUnit
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">
     <env:Body>
       <tns:ChangeLengthUnit xmlns:tns="http://www.webserviceX.NET">
         <tns:LengthValue>631.0</tns:LengthValue>
         <tns:fromLengthUnit>feet</tns:fromLengthUnit>
         <tns:toLengthUnit>meter</tns:toLengthUnit>
       </tns:ChangeLengthUnit>
     </env:Body>
    </env:Envelope>
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.
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"
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
	at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeConnectorInClassloader(ConnectorServiceImpl.java:275)
	at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeConnector(ConnectorServiceImpl.java:148)
	at org.bonitasoft.engine.connector.ConnectorServiceDecorator.executeConnector(ConnectorServiceDecorator.java:114)
	at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.work(ExecuteConnectorWork.java:138)
	at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
	at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
	at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
	at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
	at org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork.work(FailureHandlingBonitaWork.java:66)
	at org.bonitasoft.engine.work.BonitaWork.run(BonitaWork.java:56)
	at org.bonitasoft.engine.work.SequenceRunnableExecutor.innerRun(SequenceRunnableExecutor.java:47)
	at org.bonitasoft.engine.work.BonitaRunnable.run(BonitaRunnable.java:35)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
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
	at org.bonitasoft.engine.connector.impl.ConnectorExecutorImpl.execute(ConnectorExecutorImpl.java:125)
	at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeConnectorInClassloader(ConnectorServiceImpl.java:269)
	... 14 more

Any pointers, really appreciated.

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

Are you behind a proxy?

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.

Hi,

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

Thanks

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,