Consuming SOAP web services without the add reference approach - web-services

I am looking to make a service agent in C# from scratch. If the contracts/XSD are shareable via WSDL or dll. How do I go about writing a light weight service agent that can be configured to make calls to the SOAP webservice. When you do an add reference I feel too much code is generated behind my back.

You can post data to a webservice using the following url structure:
http://mydomain.com/mywebservicedirectory/mywebservice.asmx/mywebservicemethod
Simply use an HTTP POST to pass data(typically xml/json) to the service and process the response.

I use a bassic soap template and XSLT to render it out for what I want. It isn't that fun if you need to call multiple methods. I'm simply calling the same method over and over so it's no big deal. Simple HTTP POST will do it, that's all WCF/ASMX does.
You can get the WSDL and use XSD.exe to generate the object classes for you.

Related

WSO2-ESB: SOAP Mediator from wsdl

I have seen some of the SOAP- Example- Mediators. I have not found a transformation based on the endpoint-WSDL.
I want to send some nested named array in json or POX and that data should go into a complete namespaced headered (username, password) SOAP-Request based on the names.
All the examples I have found had either a very simple wsdl or the namespaces were static in the XSL-Transformation.
It should be possible to do that, as I see in for example php-NuSOAP. You feed it with a wsdl-endpoint, the operation you want to execute and the parameter-array, and it calls the Webservice.
I am looking for a solution which is not too much hardcoded for every single service, so the proxy still works when the wsdl changes and Server Clients get changed.
As far as I understand the payload factory mediator in (https://stackoverflow.com/a/12969814/2277620) you would have to hardcode the soap-format in the mediator.
If WSO2 is the wrong tool for that I'd like to have a hint which tool could help.
Thanks in advance!
Marco.
For my understanding, you want to have a proxy, but it's backend service/wsdl may vary..
What , you can do is, you can save the wsdl (dynamic wsdl)in registry and point that in your proxy. whenever you edit the wsdl, proxy will automatically adopt to that..But the request, which you send to your backend should follow the wsdl definitions..It is totally client side responsibility..

Client Generation in web service(jax)

I made a web service endpoint and exposed a method now i wanna add more parameter to my method
so each time i change in my method i have to regenerate my client. Is there any way so that i
dont have to generate my client again and again.
No, there is no way. If you change the method then the WSDL file is changed also. Web services communicates through SOAP between client and server. When you deploy your web service application and it has been changed, so how then client supposed to know if there is a new method or a new parameters added if the classes was generated from the old WSDL file. Client will send a SOAP request according to the old WSDL and the server won't be able to understand the SOAP message received from the client if there was any changes made to WSDL part related to the received message.
You could design a better webservice/endpoint that accepts a standalone xml document as argument so that the operation signature stays the same, even when you add more parameters.
More generally, it's bad form for a web service to expose it operations as literal method signatures.

Remote Web service

I am new to web services. I have a requirement in my project. They gave me a wsdl file and a web service link and document about the description of methods.
In the documentation there is method called retriveDocuments with request parameters request, loginUser, loginPassword, systemId, maxResults, searchCriteria.
They want me call webservice and get the required documents and show them in app.
My question is how do I call web service and how do I pass all these parameters and get the result?
Most likely this a SOAP service. Your programming language (such as Java) should have tools allowing you to generate a SOAP client for the service, using the WSDL. Once you have the cient code, it should be easy to pass your parameters, make the call, and get the result. There are lots of tutorials on the Web, but you can start researching from there.

PHP library similar to REST-driver in Java

I found this little library to be perfect solution for my problem. It allows you to stub REST service responses easily.
Now i need to replicate the same set of test cases in PHP version of our library. Do you know any similar library/framework in PHP?
You could use Guzzle. Guzzle is a PHP HTTP client & framework for building RESTful web service clients. The thing is that you can create Response objects. In this library, you have a Response class. You could just create the Guzzle Response that you want (choosing the desired status code, content, etc), and mock your HTTP Client so it returns the Response object that you just created.
If you read the documentation, it seems that there is a plugin to mock responses, although I've never used it.

Send XML file to Web Service using Java

I want to send an XML file to a Web Service.
The Web Service is a java application.
I know the endpoint of the Web Service.
Typically I know I have to create the request and send it as an http/https request.
What I want to know is what would I have to make to send the request - as in what development tool could I use e.g. Visual Web Developer (preffered as I am familiar with this) or Visual Studio? And what sends the request - e.g. another Web Service, a Website etc?
Where do I even begin with this?
Any comments are much appreciated.
Where do I even begin with this?
One purpose of a Webservice is loose coupling. So it depends on what you want to do. You can write a simple program in what ever language which constructs a request and sends it. You can write a Webservice on its own which uses the other Webservice to handle it's own requests.
You can handle this in a very simple or complex way. You only need to be able to generate a request (per xml) and send it.