testing wcf service in browser - iphone

How can i test a wcf service in a browser? I mean if i only enter the url in the browser it should give me only relevent xml

It depends on what type of WCF service you have:
if you're using a WCF REST service (webHttpBinding), then you should be able to just navigate to the service address, e.g. http://yourserver/somedir/service.svc
if you're using anything else, you have a SOAP service, and you cannot test a SOAP service in a web browser - the browser just doesn't understand and speak SOAP. There's however a WCF Test Client app in your C:\ drive somewhere which you can use for that purpose.

Make a test application for it. It can be as simple as having a UI with a bunch of buttons, when you press a button then a certain function exposed by the WCF service is called, you could maybe echo the output to a textblock in the app. You could also have a bunch of input type UI items (textboxes, dropdowns, whatever) so you can select parameters to pass to the WCF function.
If you want to be really classy, then make a set of unit tests for it - this means that you will have to have it hosted somewhere though so that it can be called any time the tests are run.

Related

Is it possible to call/trigger Domino rest web service from domino agents or any other backend processess?

I have a REST custom web service written in java using xpages.
It works well when it is called from the browser, but when it is triggered from the scheduled tasks/agents it fails.
Is it possible to call the domino rest web service which defined in the xpage from Agent or any other scheduled process.
Below are couple of error messages I recieved in the log
State data not available for /services because no control tree was found in the cache.
Cannot use BufferedReader while ServletInputStream is in use
Any help will be greatly appreciated.
Thanks,
James
There are a few things to watch out for:
Rest services are by definition stateless, so make sure you have nostate as attribute of your XPage
You only can have a Writer or an OutputStream, so use only one. See my article on XAgents revisited
Authentication is always a headache, so configure your REST endpoint to allow basic auth (setting in internet site configuration)
LotusScript doesn't do network so you would use #Formula or Java in a scheduled agent
Simplest form is a Formula agent using #UrlOpen("https://username:password#yourserver.com/yourdb.nsf/somexpage.xsp/yourrest");
When you pack your logic into a bean, you can use the OpenNTF Domino Api to define a XOTS scheduled task. Most advanced option (in many meanings of that word)
Hope that helps, let us know how it goes!

SOAP UI mock server groovy scripting

Currently i am having two SOAP projects(A and B) imported from WSDL files.
I created a mock server with one of the projects(A) and from my application i am able to call the mock server and get response.
Now i want to go further and try to invoke a request to another service situated in another project(B) when a soap operation is called in mock server project(A).The Project B is a call to another application.
Can i write groovy scripts to do this?
so whenever an operation A1 is called in project A after a time lapse a request needs to be sent from project B which might be an operation B1.
Here actually i am trying to simulate an external application using soap ui.
I understand i can do it by writing a program using java but thought i could do this in short time using soap ui.
As question i wanted to know if my thought is right of using soap ui or should i go do it through another tool or writing a java app.

Rest path for application

I'm fairly new to Spring Boot, but I want to want to build my application in such a way, that can deploy mulitple applications on the same server and i want to distinguish the applications in the rest path.
For example, say i have the applications user-management and animal-management and i have a rest-controller in both of them responding to the path \names.
Both those applications run on localhost:8080 so when sending a GET to localhost:8080/users/names, I want the controller of the user-management to react and the same for animal with a GET to localhost:8080/animals/names.
I can put a #RequestMapping on the controller to acchieve the names part, but if i do the same on the application, it gets ignored.
Basically I want to tell my application "Every controller in this application should be mapped to the rest path specified on the controller, but prefixed with 'x'".
How can I do that.
I was looking for the contextPath, I just didn't know the name.
By putting the server.contextPath=/users attribute in the application.properies it worked like i wanted to.
Thank you #Vaionixx

call c function in running app from web service

I have a web server running on a RaspberryPI. The web server is supposed to provide an interface to a program that deals with a connected 3D printing hardware.
How can I create an element on the web page, that triggers via the web server a function inside an already running C program?
More details:
The printer management app is written in C/C++ and runs all the time, providing a few buttons on a touch screen. The web interface will provide an upload button for printing files, a few status informations, and a start/pause/stop button.
I know a lot about C/C++ and the Unix RPC or named-pipe API. However, I know little about HTML and all the associates ways of scripting and communicationg with the web server.
What is the best approach to implement the start/stop button on the web page, so that a function inside my printer controller is triggered, and secondly, how can I get data back from the printer controller onto the web page?
Thanks!

Fake services mock for local development

This has happend to me more than once, thought someone can give some insight.
I have worked on multiple projects where my project depends on external service. When I have to run the application locally, i would need that service to be up. But sometimes I would be coding to the next version of their service which may not be ready.
So the question is, is there already a way that can have a mock service up and running that i could configure with some request and responses?
For example, lets say that I have a local application that needs to make a rest call to some other service outside to obtain some data. E.g, say, for given a user, i need to find all pending shipments which would come from other service. But I dont have access to that service.
In order to run my application, i need a working external service but I dont have access to it in my environment. Is there a better way rather than having to create a fake service?
You should separate the communications concerns from your business logic (something I call "Edge Component" see here and here).
For one it will let you test the business logic by itself. It will also give you the opportunity to rethink the temporal coupling you currently have. e.g. you may want the layer that handle communications to pre-fetch, cache etc. data from other services so that you will also have more resilient services at run time