HTTPGET request of a soap webservice in java application - java

I had written a method in soap web service which returns the data from database. now i am facing the problem to write HTTP GET request in java application. Any help and suggestions will be appreciated
Thank you

Why you are not using jax-ws or apache axis2 or apache CXF for consuming your webbservice ? Direct http invoke will be little tricky and you will required to construct your soap message and some http headers to call soap based service directly http client. check the http client for soap service here How to call a SOAP webservice with a simple String (xml in string format)

Related

Visualise soap request

I am using spring boot framework to generate a soap request to consume the soap service.
Using SOAP-UI/ Postman, I can be able to send the request in xml format as specified in service wsdl.
But, I am generating soap request body my marshalling the java object and sending it through spring application.
Is there any way to see/visualise the intermediate request in XML format in this case ?

Rest version of "Soap Headers and Handlers"

I have a question about Rest web services.
In soap, we can use SOAP handlers to process the request before execution. For example we can parse Soap Headers in Soap Handlers before we are doing the real job.
Is there something like that in Rest services? Rest headers and Rest handlers?
Thanks
I guess you are working on client side. If you use jersey framework for rest request , you can use filter implementations. Otherwise If you use apache httpclient, you can use handler implementations.
Jersey docs: https://docs.oracle.com/cd/E19182-01/821-0540/6nlj9lcpf/index.html
apache docs:https://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientWithResponseHandler.java

Calling SOAP service inside REST service

I want to code for a REST service using Restlet framework that wraps a third party SOAP service with some XML data. So whenever I call the REST service with some XML data that REST service internally calls that third party SOAP service with the XML data that I provided and the response travels from that third party SOAP API to REST API and from REST API to me.
I have gone through this questions;
Calling a SOAP service using REST service
Calling SOAP in Jersey
But it didn't help me a lot, So it would be great if anyone provide me the links or tutorial where I can get any help. Thanks.
I think that the following links could help you if you want to implement by hand:
Restlet tutorial - http://restlet.com/technical-resources/restlet-framework/tutorials/2.3
Writing a SOAP Client - https://docs.oracle.com/cd/E19340-01/820-6767/aeqgc/index.html
The key challenge here is to convert request elements into the SOAP request since SOAP only uses HTTP as a transport protocol (both headers and payload) and the same for response (extract headers and payload to build the REST response). With Restlet, you need to leverage its REST API for this. See this link: http://restlet.com/technical-resources/restlet-framework/guide/2.3/core/http-headers-mapping.
I also saw these tools that seem to provide a proxy to adapt a SOAP service as REST service:
Exposing SOAP Services as REST Resources - http://www.membrane-soa.org/service-proxy-doc/4.0/rest2soap-gateway.htm, https://github.com/membrane/service-proxy
a RESTful API proxy to a SOAP-based service - http://apigee.com/docs/api-services/content/exposing-soap-service-api-proxy
Hope it helps you,
Thierry

SOAP POST method performs GET?

I have a SOAP webservice that is currently POST method, however I saw on my logs that when client is consuming my service there are two calls being made, 1 is to GET the wsdl file then POST to the webservice? Should it be POST call only?
You can think of the WSDL file as a sort of blueprint for a SOAP service. Given the WSDL, your client application can figure how to use the SOAP service. So I see nothing wrong with your client app first doing a GET to download the WSDL, following by a POST to actually consume the SOAP service.

How to generate Response XML using Webservice Request?

I am building a whole new webservice application using SOAP, java and JBOSS FUSE. I have a request xml and xsd..
Can we guess the response xml by just referring to the request and the data elements?
You cannot guess exact response, if you could what is the point of calling, you could guess response schema from WSDL that SOAP webservice publishes

Categories