Parameters in POST call to Data Service in Enterprise Integrator - wso2

I'm migrating some data services from DSS to EI but I have problems with the parameters in POST calls. I published a Data Service with a query exposed as a REST resource using the methods POST and GET, just for testing. Then I try to call it using cURL.
The GET is easy because I only need to append the parameter to the URL, but for the POST I try passing it using -d and a JSON or XML structure but always the server responds with error 400 (bad request).
If the resource have no parameters both calls works fine.
Can anyone tell me the right way to pass the parameters to the RESTFUL resource when I use the POST method?

If you publish this service as wsdl service do you have same problems with methods, thats analogies to your post methods? I was catch similar problem when don't set request_box parameter of my service to on. It was look as I send request without parameters, but they was send correcltly in fact.

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.

Send/Receive a SOAP request using SPRING JAVA

I am new to Spring web services. I am going to create an xml request, and send it as a SOAP request to a web service and receive the response.I read different documents but still confused as I could not find a working sample yet.
I know that I should use WebServiceTemplate and WebServiceMessageSender, SaajSoapmessageFactory (please let me know if I am wrong) but not sure how to use them.
Do I need WSDL? if yes why?
If you have any sample code please send me to get clear on it.
Thanks
If you want to send SOAP requests, you would like to be a SOAP client. Seems like you want to use spring-ws project. Check out their great documentation on the client side. The same documentation will guide you through the process of creating a server. There are plenty of examples and ready-made configuration snippets waiting for you.
Spring-WS is built on top of XML Schema description of your message, so you will need WSDL to generate e.g. JAXB models of your requests and responses.
AFAIK, for "web services" , the WSDL file is the machine blueprint of the "ports" as they are called However! ports in WSDL "means" java language(or any other programming language used with a routine or sub or procedure or function) method and has a specific naming scheme associate the .wsdl xml file(template of the service). Each WSDL port(language method) has specifications of return value and data specifications for how to feed it arguments and their type values.

Consuming SOAP web services without the add reference approach

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.