Question

I have been struggling very much with handling collection type response parameters in web services.

When response parameters are or normal type they are very easy to handle in the business processes. Here we are able to handle them as parameters on the Call web service process element. And use these in the process right away.

When there is a Collection which is returned, this is very different. Now the Call web service element parameter is of type Collection of Objects with attributes.

It seems to me that this parameter-type is very difficult to handle in the business process. I can't seem to find documentation in the Academy about how to extract and loop through the contents of the Collection of Objects with attributes.

What I have found in the academy is this article about setting up the Web service.
https://academy.bpmonline.com/documents/administration/7-14/adding-resp…

What I need to learn is how to handle them in bpm'online business processes.
Is there something about this in the Academy?
Is writing source code the only option? It's difficult to debug.

Like

3 comments

Dear Julius,

Unfortunately, it is impossible to handle parameters that have the “collection of object” type without using the source code.

Therefore, in this case we recommend using “ScriptTask” element for both calling the web-service and processing the results of call.

For more detailed assistance, please contact technical support.

Best regards,

Norton

Norton Lingard, Thank you. Is there anything like this in the academy? Because there is a special bpm'online syntax to go by in the source-code.

Dear Julius,

The service call in a "Script task” business process element can be implemented via native C#. Please find a lot of examples on how to do that in Google. For example, several links below:

https://stackoverflow.com/questions/9620278/how-do-i-make-calls-to-a-rest-api-using-c

https://code-maze.com/different-ways-consume-restful-api-csharp/

Please note that it is possible to use the native C# collections instead of working with the the special bpmonline collections.

Best regards,

Norton

Log in or register to comment
Question

Good day. I have a big task, and the last part is sending the document through a web service.
Generally speaking, I need to send not only a document, but an array of objects, among which there are documents. Documents will be in PDF format.
As I could see, the "Content type" field is protected from changes and is always JSON.
Is there any simple (or at least some) way to accomplish the task sent to me?
I have an example of performing this task in Java and there the document is loaded into the stream and then passed as an attribute ContentReference, but I do not understand how to implement this in bpm'online ..

Like

3 comments

It's hard to understand where you want to send the document from. From bpm'online to a third party, or vise versa. If it's from bpm'online please do that via c# in a Script task in a business process. If it's vise versa, please use the same web service that we call when we add a new file to a "File" detail. Please use Fiddler in order to find the service name. 

Eugene Podkovka,
Thank you very much, I finally realized that I had to do this through C# in the Script task, but now I have another problem.
I found a code (https://stackoverflow.com/questions/17027159/how-send-a-pdf-by-post-htt…) that converts the PDF file into bytes and sends them via HttpWebRequest, but I don’t know how to get a document file.
I mean, the Server.MapPath method is used in this example, but I cannot do this. I only know that this document should be on the "Attachments and notes" tab in Contact. Is there a way to get a link to the desired document (by name, etc.) Or use the MapPath function?
I am also trying to figure out how to attach more data than just a file, because the file is just one of them. The following is the complete structure:

If you have any suggestions or tips, please, help me.

Dear Pavlo,

Please note that all documents are saved in the database in the appropriate table. For example, documents from the “Attachments and notes” tab from the Contact section are saved in the “ContactFile” table and have the object name “Contact attachment”. Therefore, it’s possible to read it like ordinary data from the database.

Please note that the column with data of the document has name “Data” and type “varbinary(max)”. In order to read data from the database please use “Read data” element of business process or use ESQ in the code of the Script task element.

Please find more detail instructions about reading and using data in the Script task element from the link below:

https://community.bpmonline.com/questions/how-read-entity-lookup-column-script-task

Best regards,

Norton

Log in or register to comment
Question

Hi,

If I have to build a web service from bpmonline through an api which requires the method signature to be generated by taking the query string, and creating a HMAC-SHA256 signature using your API key as the secret key.

Is there a way to do that?

There is available a sample c# code, if that helps.

Generating the method signature

    <span>private</span> <span>static</span> <span>string</span> <span>GetSignature</span><span>(</span><span>string</span> <span>args</span><span>,</span> <span>string</span> <span>privatekey</span><span>)</span> 
    <span>{</span> 
        <span>var</span> <span>encoding</span> <span>=</span> <span>new</span> <span>System</span><span>.</span><span>Text</span><span>.</span><span>UTF8Encoding</span><span>();</span> 
        <span>byte</span><span>[]</span> <span>key</span> <span>=</span> <span>encoding</span><span>.</span><span>GetBytes</span><span>(</span><span>privatekey</span><span>);</span> 
        <span>var</span> <span>myhmacsha256</span> <span>=</span> <span>new</span> <span>HMACSHA256</span><span>(</span><span>key</span><span>);</span> 
        <span>byte</span><span>[]</span> <span>hashValue</span> <span>=</span> <span>myhmacsha256</span><span>.</span><span>ComputeHash</span><span>(</span><span>encoding</span><span>.</span><span>GetBytes</span><span>(</span><span>args</span><span>));</span> 
        <span>string</span> <span>hmac64</span> <span>=</span> <span>Convert</span><span>.</span><span>ToBase64String</span><span>(</span><span>hashValue</span><span>);</span> 
        <span>myhmacsha256</span><span>.</span><span>Clear</span><span>();</span> 
        <span>return</span> <span>hmac64</span><span>;</span> 
    <span>}</span>

<span>I am trying to integrate with </span>https://apidocs.unleashedsoftware.com/AuthenticationHelp

 

Like

1 comments

It's hard to understand what is "from bpmonline through an api". Will the service be in bpm'online or somewhere else? Should bpm'online call an external web service? 

Anyway. Please find more information about calling web services in the article by the link below.

https://academy.bpmonline.com/documents/technic-sdk/7-13/executing-odata-queries-using-fiddler

Log in or register to comment
Question

Hi , Can anyone help me in solving the errror while seeting up OAuth Authentication getting error in redirect Url as 

The server encountered an error processing the request. The exception message is 'Object reference not set to an instance of an object.' 

Here I am attaching the screenshot of configuration of OAuth login Page.

I am getting the exception after allowing permsission and after redirect Url . Should i need to add anything extra in redirect url or how will i get access token based on result of Redirect URL?

 

Thank You.

 

 

Like

1 comments
Log in or register to comment
Question

Hi,

I'm trying to create an anonymous we folllowing the guide from: 

https://academy.bpmonline.com/documents/technic-sdk/7-13/creating-anony…

The example provided is only for Verb GET and it works fine, but as soon as i change it to POST i get 403 code returned instead.

I tried changing different settings on the .config files to allow verb post but with no luck. What am i missing?

Is the system only meant to expose GET anonymous services?

Regards,

Luciano

Like

5 comments

No. The system allows post requests. Probably you're trying to convert the GET request to the POST one. Please don't copy/paste. Write the service and the request manualy. This way you'll not make mistakes.

Hi Eugene,

Are you sure you are not talking about normal authenticated webservices?

It turns out that i had to add the svc path to DisableCsrfTokenValidationForPaths for the anonymous  in order to make it work.

Keep in mind that i need to call the POST method from outside bpm and without any authentication.

 

 

 

I'm sure. http://prntscr.com/myfefm

I tested without CSRF on localhost. 

That's not the behavior i'm seeing on my local environment. After creating the svc and registering the service on all the .config files i kept getting 403 until i enabled the path on DisableCsrfTokenValidationForPaths. Otherwise i was always getting 403.

I notice from you screenshot that you were also getting 403 before the 400 bad request,, did you change something?

 

Luciano De Munno,

Try to check how the GeneratedObjectWebFormService registered. It works with post and it seems like it doesn't require disabling CSRF.

>did you change something?

- I stoped copy-pasting and wrote the request manually from scratch. Anyway the request is on the screenshot. Please compare they on your own.

 

Log in or register to comment
Question

Hi,

Is there a way to package an anonymus webservice created using the guide from the academy?

https://academy.bpmonline.com/documents/technic-sdk/7-13/creating-anony…

I need to have a public endpoint to integrate with a texting app that notifies of messages realtime, but the endpoint cant have authentication. Is there any other way to expose a public endpoint?

 

Regards,

Luciano

Like

5 comments

Hello Luciano,

Basically, to implement the anonymous webservice you should simply follow the instructions from the article that you sent. Anonymous webservice concept means that authentication is not a required step to interact with this service.
Also, if you use onsite version of bpm'online, don`t forget to register the service (there is an explanation how to do it in the article).
In case your site is located in cloud you should email support@bpmonline.com so the support team will help you with registration.

Best regards,
Alex

Alex_Tim,

Thank you for the answer, so the the package only contains the webservice class, the svc creation and .config changes are done by support, right?

Edit:

Additionally if also want to package this to make it available on the store, how would it work? do every customer that's bpm hosted needs to email support to get the webservice registered?

Regards,

Luciano

Luciano De Munno,

Hello, yes, you can create the webservice class in any package that you want.
Svc creation and changes in config should be done by support team. 

You can upload the package to the marketplace, but since changes should also be made in .config and svc files every customer will need to email support to register the webservice.

Best regards,
Alex

Alex_Tim,

Hi, do you know fi it's possible to use POST o r PUT instead of GET? whenever i put 

WebInvoke(Method = "POST") i keep getting 403

Luciano De Munno,

Hello! Error 403 means that there is no header with a CSRF token. To make a request using ARC, you need to add a header with a valid csrf token for the current session. You can get it, for example, by taking any post request from the network chrome tab. It is also better to put a header with cookies.
Read more about CSRF in the article:https://academy.bpmonline.com/documents/technic-sdk/7-13/protection-csrf-attacks-during-integration-bpmonline

Log in or register to comment
Question

I created a web service reference in GUI so I can call it from processes. I want to, depending on some settings, call a test version of this web service or a production version. Only their addresses differ. Is it possible to choose the address dynamically?

Like

2 comments

Dear Carlos,

You can create two web services in the system, one with test version URL, other with productive version URL.

Create a system setting, based on which you will decide test or production. Other solution is to use an Exclusive Gateway element, which wold determine which pass to choose. Each of the passes would lead to one Web Services Call element. 

The diagram should look somewhat like this:

Regards,

Anastasia

Anastasia Botezat,

Thank you. I hoped that I could avoid adding two web services but if that's the only option then I'll have to do that.

Log in or register to comment
Question

Hi,

I checked and tested an example using this documentation (https://academy.bpmonline.com/documents/administration/7-13/web-service-integration). Web service example (http://fixer.io) is JSON formatted and there is no issue to configure in Process library.

I have another web service link which required output is in XML format. I'm not sure if its configurable in Process library or it will be only possible through code customization.

 

Below is screenshot of specific area of output from that web service link

Any help will be highly appreciable. 

 

Regards

Like

3 comments

Please deploy the application locally and catch the request and the response with fiddler.

https://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/ConfigureDotNE…

This way you'll get more information. 

Hi Eugene,

Thank you for reply.

It means there will be code customization is required?

 

Regards

The code customization is not required. But in order to create an integration with a web service the skill in working with web services is required. 

Log in or register to comment
Question

Is there a way to capture the Request message from a Call Web Service activity for debugging?

Like

3 comments

Dear Glenn,

You can use Fiddler to catch requests that are being sent to and from the application and use it for debbuging. But you will be able to do it starting from 7.13.2 version of the applciaiton. Until that you can either create the functionality and then use it after the upgrade or create the request on c# via a script task element.

Best regards,

Oscar

Oscar Dylan,

Both bpm'online and the service are in cloud, so I cannot use fiddler.  What is the target release for 7.13.2?

Dear Glenn,

You will be able to use fiddler to catch requests even if the instance is located on-cloud. As for 7.13.2 version - please take a look at release notes here https://academy.bpmonline.com/documents/bpmonline-release-notes-7-13-2.

Best regards,

Oscar

Log in or register to comment
Question

Hi Community,

we have the following problem, when we make a data load through the consumption of a "REST - WebService"

We would like to know how we could fix the "parse" error so that the execution does not fall ?. This happens when reading a JSON from the WebService.

 

 

 

Newtonsoft.Json.JsonException: Unexpected character while parsing path: 

   at Newtonsoft.Json.Linq.JsonPath.JPath.ParseMain()

   at Newtonsoft.Json.Linq.JToken.SelectToken(String path, Boolean errorWhenNoMatch)

   at Terrasoft.Services.Runtime.JsonResponseBodyParser.FillServiceParameterValues(IEnumerable`1 parameters, JToken responseToken, Dictionary`2 parameterValues)

   at Terrasoft.Services.Runtime.JsonResponseBodyParser.FillComplexArray(ServiceParameter parameter, JArray jsonArray)

   at Terrasoft.Services.Runtime.JsonResponseBodyParser.FillArrayValues(JToken token, ServiceParameter parameter, Type valueType)

   at Terrasoft.Services.Runtime.JsonResponseBodyParser.FillServiceParameterValues(IEnumerable`1 parameters, JToken responseToken, Dictionary`2 parameterValues)

   at Terrasoft.Services.Runtime.JsonResponseBodyParser.Parse(String body, Dictionary`2 dataAdapters)

   at Terrasoft.Services.Runtime.ServiceClientResponse.FillInBodyParameters(Dictionary`2 parameterValues)

   at Terrasoft.Services.Runtime.ServiceClientResponse.ParseResponse()

   at Terrasoft.Services.Runtime.ServiceClientResponse.get_ParameterValues()

   at Terrasoft.Services.WebServiceUserTaskImplementation.FillResponseParameters(IServiceClientResponse response, ProcessWebService userTask, IProcessParametersMetaInfo schema)

   at Terrasoft.Services.WebServiceUserTaskImplementation.Execute(ProcessWebService userTask, ProcessExecutingContext context)

   at Terrasoft.Core.Process.ProcessActivity.Execute(ProcessExecutingContext context)

Like

1 comments

Hello,

Basically, the error means that system receives an unexpected json object from web service.

If you use business process element "call web service" to make requests to external web service you should check web service settings.

In case you make a request to a web service via script task i.e. c# code, you should check your code for incorrect casts. 

Also you can simply catch requests and responses from web services via fiddler. With fiddler you are able to view headers, body and other request parameters.

Best regards,
Alex

Log in or register to comment