ServiceMix 4 communicate with external WebService - web-services

Currently, I have a WebService which accepts HTTP Post requests, containing byte array of WAV files. This works completely fine. It then gives back XML results of WAV file metadata. I test this by sending curl commands and looking at the output given back. The question I have is, in my opinion, a very basic ServiceMix question. It's just this one part I'm stuck on. How would I send this curl command to ServiceMix, and have it forward it along to the external WebService? In the future, I will have numerous WebServices, that give different types of data about the WAV file, in different XML formats, and I'll want ServiceMix to handle routing and parsing the results accordingly. Before I can embark on that, I need to figure how the heck to just send a single request through ServiceMix, and to a WebService. Is it a WAR file that sits in ServiceMix deploy? An OSGi bundle? A blueprint.xml file? I truly have no idea, so any help to steer me in the right direction, would be great.

Take a look at camel documentation How to use camel as a http proxy between a client and server . You could build a camel route and deploy the bundle in servicemix to proxy to your webservice

Related

User defined log files for SOAP requests and Responses in Websphere 8

I have a Soap based web services running in websphere 8. Since we have he trace.log, which have the Webservices request and response XML. I am trying to log it to a different file apart from trace.log.
To be very precise, If my service is HelloWorldService. I would like to log the SOAP requests in service_helloworld.log. I have defined the appenders and loggers in log 4j already. But I am looking into a way where I could configure websphere to redirect the webservices traces to that file.
I still could write a interceptor, but I am trying it in websphere configs. Please help
I don't know if you still have that problem... But I had the same one and I just fix it implementing a GenericHandler that interceps the request/response.
Take a look:
http://www.ibm.com/developerworks/websphere/library/techarticles/0511_phung-lu/0511_phung-lu.html

Optimizing webservice response message

I'm facing a performance issue with my web-service.
The context
I'm coding a game on Android that consumes a web service. It 's a multiplayer game so there are many connections done to the web service.
My Rest web service is provided by an Axis2 instance on a Tomcat server.
The problem
All is working fine, except that the amount of data is huge because of the verbosity of XML.
I tried to optimize the exchange by never resending a data that the client already have.
I use gzip compression.
I think that jSon is not a solution because, it will light the response message but not as I would.
So my questions, what should I do to maximum light the response size? What are the best practices?
Is it possible to send only a serialized object without using jSon or xml to avoid verbosity?
Thank you for all your reponses xD
I think that I have to send serialized objects in a custom format but Axis2 only deals with xml stuff (Jax-WS).
So I'll try another Rest server like Jersey which deals with custom format (Jax-RS).
What do you think about that?

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.

Spring Web Services - WSDL

In your wsdl, is it possible to connect directly to the wsdl(i.e - http://(url)?wsdl.
When I copy the wsdl locally to src/main/resources - I am able to connect generate objects including Web Service client, but when I try to connect to the WSDL that I copied from, I cannot generate. Perhaps I am not understanding QName and wsdllocation and even port for that matter.
I have searched fairly extensively on the web and there aren't that many clear cut examples. I know WebServiceTemplate makes things a LOT easier but without connecting to the WSDL, I cannot connect.
All I am trying to do is connect to the client. So it is a question more about Endpoints.
Also is it best practice to copy the WSDL locally. I am asking this because the client that we are working for has a 100 million environments.
Thanks.
Thanks
WSDL url will be like http://localhost:8080/<< Context-Name >>/<< ServiceName >>?wsdl
If you are generating the wsdl by running a server, then localhost:, should be given. If its a direct wsdl file, then try right clicking and opening it using a web browser. It will simply give you the link. You can use the same link to produce client stubs too.

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.