Consuming web service from console app - vb.net

We have a web app that contains web methods. I want to invoke one of those methods from a console app. I am new at this but I wrote a console app, added a service reference and tried to code invoking it.
If my web method is called "Transmit", I expected to see Transmit in the namespace I specified but instead I see "TransmitRequest", "TranmsitRequestBody", "TransmitResponse" and "TransmitResponseBody".
What are these things?
Have I done something wrong?
How do I invoke the web method in the web app from the console app?
Thank you for all help to this newbie. I am using VB.net 2008.

If you expand the ServiceReference Folder in solutionExplorer, double click on your service and it should open the object explorer. Now you will see the class (the one without the I infront). In your code you will then instantiate a new variable with the [ServiceReferenceName].[ClassName] i.e.
Dim svc as new ServiceReference1.MyWebService();
svc.Transmit();

Related

FLOWABLE: Authenticating flowable-task from another application via rest call

So, I am creating an application which will be using flowable.
We can say that once my application starts, it's gonna start a particular process deployed on flowable, proceed ahead accordingly.
So, in a way there will be lot of talking between flowable and other application, but for now suppose I just want to call flowable applications from POSTMAN (outside FLOWABLE).
I have used 3 modules: flowable-idm, flowable-modeler, flowable-task in my application.
Everything works fine when I am starting my deployed process from UI of flowable task, problems come when I want to start the processInstance using REST endpoint.
In flowable-task application, there is already a REST endpoint to start the process deployed: http://localhost:8080/flowable-task/app/rest/process-instances.
Now, if I call this from Swagger of flowable-task application, it works fine.
But it doesn't work when I try to call it from another application or POSTMAN for now (once POSTMAN call works, I can make the same arrangement in code), where I'm doing a basic auth and providing what's required in body.
Also, there is no error or exception displayed on console, I believe that is because of something catching that error or exception and not displaying anything.
However, to overcome the problem of starting process from POSTMAN, I can use REST endpoint http://localhost:9999/flowable-task/process-api/runtime/process-instances, but this is just a workaround, in future if I create new endpoints I would have to figure out a way to call those endpoints.
I saw this post and I guess this guy was also trying to achieve something similar but for flowable-modeler.
It's been suggested to make changes in SecurityConfiguration.java of flowable-task-conf module for my case, but I haven't done such changes before so not exactly sure where to start and how to proceed.
So, my question is how to talk to flowable-applications from outside flowable applications.
Edit:
Forum post about getting exception when imported flowable-rest module in workspace
The flowable-task UI Application is an example application that exposes non public REST API for the UI. However, the application also exposes the full REST API of Flowable.
There is also the flowable-rest application that has the Swagger doc and exposes the full REST API without a UI.
You would want to communicate with those REST endpoints.
The endpoints are under the following contexts:
process-api for the Process Engine
cmmn-api for the CMMN Engine
dmn-api for the DMN Engine
idm-api for the IDM Engine
form-api for the Form Engine
content-api for the Content Engine
For your example you would need to use POST to /process-api/runtime/process-instances for Starting a Process Instance

Cannot get custom header value from web api if called too frequently

I am calling web api services from angularjs. I am setting some custom header before calling the service. I am getting the value by
Request.Headers.GetValues. It is working fine.
But the problem is if I call multiple service immediately I am getting the header null.
If I use some setTimeout from JavaScript before service call then again it is working fine.
Can anybody let me know what is wrong with my approach?
Thanks in advance.

Web Reference appending 'call' before method name

I have a web service set up in IIS that works. I can call it from the browser and it loads properly - I see my method.
I have a website where I tried to add a web reference. I searched for web services on the local machine and my service came up. I was even able to find my method by clicking on the service.
But for some reason, after I add the reference, the method is not available. I created an instance of the service, but when I try to call the method I get an error - 'method' is not a member of 'service'. I checked the reference.vb and I see that the reference appended the word 'call' to the beginning of my method name so it is now calluploadBurnData(parameters). Using this method name works, but why is 'call' appended?? I have many web references in this project and none of them had this issue.

Wcf Services in Ektron

I am working with WCF Services in Ektron(rrot/Workarea/Services).
When i am trying to consume the ContentService.svc service in a client using the following code,
ContentManagerClient cClient = new ContentManagerClient();
UpdatedContentService.ContentData data = new UpdatedContentService.ContentData();
data.m_strTitle = "test";
data.m_strHtml = "test";
data.m_intFolderId = 72;
data.m_intUserId = 1;
cClient.Add(data);
I am getting the following error ' The current user does not have permission to carry out this request'.
How can i authenticate an ektron user to perform this action from a client?
The answer you received on the ektron dev forums was a good one. (prior discussion for anyone with the same problem: http://developer.ektron.com/forums/?v=t&t=1280)
You will need to use the Auth service, not the content service. this can be done using the following steps:
Create a proxy object for the web service:
Run .Net tool wsdl.exe against your webservice address, e.g. http://localhost:/Workarea/webservices/AuthService.asmx
Compile into DLL by running “csc /t:library AuthenticationService.cs”:
Add the DLL as a reference to your DLL or console app
Copy the DLL to a Lib folder in your project
Add the DLL as a reference to your DLL or console app
Copy the DLL to a Lib folder in your project
Right click “Add reference” and browse to your created proxy DLL.
Add System.Web.Services as a reference to your DLL or console app
Call the proxy code from your app:
AuthenticationService auth = new AuthenticationService();
IAsyncResult response = auth.BeginisValidUser(username, password, etc...);
a working code example of this can be found at:
http://developer.ektron.com/Templates/CodeLibraryDetail.aspx?id=1036&blogid=116
This example was adapted from the VooDoo engineering example of pulling in the content service:
http://ektroneering.blogspot.com/2011/01/accessing-ektron-from-dll-or-console.html

Web Service missing methods when called from Silverlight

I created WCF web service, deployed it, and debugged it. I wrote a console app, referenced the web service, and everything works.
Now, I'm attempting to consume the web service in a silverlight 3 application. I added the following code to a click event.
TagServiceClient client = new TagServiceClient();
Tag[] tags = client.GetTags();
client.Close();
VS is telling me it can't find the GetTags() and Close() methods. But VS has no problem with these methods in the console app.
I added a using statement for the service reference to the top of my file.
I placed a clientaccesspolicy.xml file in the root domain and in the folder containing the web service. Doesn't seem to change anything regardless where it is.
What's going on? Any suggestions? This is my first time consuming a web service in Silverlight so I may just be missing something.
You will need to generate a new client proxy to use in the Silverlight app - IOW, from the Silverlight app, add a new service reference, and point it to the service.
You will then see that things are a little different - you will find that there are async methods in the proxy, not the synchronous ones you will have seen in the proxy generated for the console app. So in the silverlight app, your code will end up looking something like this:
client.GetTagsCompleted += [my event handler];
client.GetTagsAsync();
and in your event handler:
if (e.Error == null)
if (!e.Cancelled)
List<Tag> tags = new List<Tag>(e.result);
When you add a the service reference to the silverlight app, make sure you have a poke around the advanced settings, because you can change what sort of collection the items are returned in, etc (the default return collection is an ObservableCollection<T>).
If you want to avoid this sort of thing (different proxies for different apps or modules), then consider using svcutil to generate your proxy instead of allowing VS to do it (VS doesn't use svcutil).