CXF Web Services with Apache Camel - web-services

I would like to do something like this with Camel:
from(Web_Service_1_URI).to(Web_Service_2_URI).to(Web_Service_3_URI).
So basically Web-Service1 acts as a facade for Web-Service2 and Web-Service3 (first Web-Service2 is called, than the result serves as input for Web-Service3). The result is finally returned to Web-Service1.
How would I do this using Camel?
regards,
F.

You will use the pipes and filters EIP
http://camel.apache.org/pipes-and-filters.html
And you can use camel-cxf component. Something like
from("cxf:bean:ws1").to("cxf:bean:ws2").to("cxf:bean:ws3");
But the WSDL of the 3 web services have to "fit". Otherwise you will need to translate the message between the calls
http://camel.apache.org/message-translator.html

Related

How to pass arguments with Axis2 webservice URL?

I have created a web service interface with Axis2, and it's working well. However, I want to pass arguments with the url pattern from the client side, so that I can make use of them in the service side (like "..//ADDRESS:PORT/service/ServiceName?ARGUMENT=123").
Can any one help me to achieve this?
Thanks
Rob
You could add a dispatcher class and implement in its 'invoke' method a
functionality which parses the URL, and then pass the arguments to your
service.

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..

How do I use CXFNonSpringJaxrsServlet with a serviceBean instead of a serviceClass?

I am trying to use Apache CXF with JAX-RS to serve as an embedded REST endpoint within a larger application. I cannot use spring configured CXF because my application needs to manage the lifecycle of the Jetty instance and servlets.
The example here shows how to do this with a service class name, but in my application it will be roundabout and ugly to pass a classname rather than a bean. Can anyone point me toward a way to use a bean here?
You have to leave CXFNonSpringJaxrsServlet create your instance, but you can configure it (=bind it to outside world) by extending CXFNonSpringJaxrsServlet#configureSingleton
See this post: CXF/Jetty equivalent of the following Jersey/Jetty code for a solution. Tested with CXF 3.0.3 and Jety 9.2.5.v20141112.
This is how it's done
Object serviceObject = // your JAX-RS service object
JAXRSServerFactoryBean rs = new JAXRSServerFactoryBean();
rs.setServiceBeanObjects(serviceObject);
Server server = rs.create();

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.

How to decide between Message Contract and Data Contract in WCF?

I am reading so many things to understand various things in WCF.
Very soon, actually, i want to move/convert existing WSE3 web services to WCF. In existing WSE web services, I have some (data) classes that model entities in our environment.
While transforming those classes, should I use Data Contract/Data Member attribute or the MessageContract attribute?
1. How to decide between Message Contract and Data Contract in WCF?
2. Does type of binding (like basicHttpBinding) has any role in this decision?
3. Does proxies created at client side (when we add web reference) change significantly depending on the Data or Message Contract?
(PS: I am trying to find a way so that existing WSE clients should be able to consume the WCF service without much alterations/modifications. Is it possible to use the current proxies generated from ASMX web services, to connect to the new WCF service just by setting URL of the proxy to WCF service?)
Here is a quick go at answering your questions:
1) Unless there is a specific reason like tweaking the structure of the soap XML, use DataContract instead of MessageContract.
2 & PS) Since you are currently using soap over HTTP, you'll most likely need the new services to be configured for basicHttpBinding. This will provide the interoperability that you need for the ASMX clients.
3) It shouldn't if the soap structure created by the WCF service matches your current soap.
I vaguely remember that WSE 3.0 supported some of the WS-* standards. If your current code depends on these then you may be able to also expose a wsHttpBinding for these operations but I don't think a default ASMX client works with a wsHttpBinding configured service.
It depends on control you need over resulting SOAP message. DataContract defines part of message body wrapped by element defined by operation. MessageContract defines a structure of whole message - you can use multiple body members, you don't have to use default wrapper element and you can also place some data into SOAP headers.
In your scenario the most important part is to define WCF to use same SOAP messages as your former WSE3 service. Here the important is how do you currently serialize data? If you use Xml serialization (and attributes) you can use it directly in WCF by switchinig from data contract serialization to xml serialization.
Btw. why did you use WSE3 instead of plain ASMX? Did you use message security? In such case you will need another binding. BasicHttpBinding is not able to do message security.
General answer is yes, you can create service wich your current client proxies will be able to consume. But in reality the effort depends on your current service and current code.