Camel Web service message consumer - web-services

I am trying to build an xml spring-based camel web service consumer using apache cxf endpoint similar to the example here...
<cxf:cxfEndpoint id="soapMessageEndpoint"
serviceClass="org.apache.camel.example.cxf.provider.GreeterProvider"
address="http://localhost:9000/GreeterContext/SOAPMessageService"
wsdlURL="wsdl/hello_world.wsdl"
endpointName="s:SoapOverHttpRouter"
serviceName="s:SOAPService"
xmlns:s="http://apache.org/hello_world_soap_http"/>
<camelContext id="test_context" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="cxf:bean:soapMessageEndpoint"/>
<to uri="bean:testBean?method=processSOAP"/>
</route>
</camelContext>
The web service already exists, but I'm not interested in setting up and exposing a client like in the example. Under normal operation clients would subscribe to the web service and the web service in turn publishes out events to the subscribers periodically.
I have a simulator that generates the web service messages automatically already and I just want to consume the web service message in my camel route and log it, so I don't need to process it or do something with the messages.
I just want my endpoint to act as a listener/sniffer for these messages as they are published therefore I don't really need a service class.
What's the easiest or most efficient way to set this up in camel? Maybe cxf is the wrong component to be leveraging here. The web service is using SOAP.

Related

How to make call out to secured web service

Am receiving the message "System.Net.WebException: The HTTP request was forbidden with client authentication scheme 'Anonymous'." when trying to call the web service at "https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php" using BizTalk 2013.
I've imported the wsdl directly from the site, creating the schemas and the bindings to make the call. The Send port is set up as WCF-BasicHttp, Security Mode: Transport, Transport Client Credential Type: None. I'm able to call the service using SOAP-UI from the BizTalk server, providing no form of authentication.
Have read numerous posts and documentation, but nothing I've done to this point has helped. I'm sure I'm missing something; just not sure what that something is!
From the looks of the WSDL: <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> it's an RPC type web service
Like the documentation specifies: 'The WCF adapters do not support consuming Remote Procedure Call (RPC)-style Web services because the message parts in RPC-style Web services are referring to the message types rather than the message elements where WCF adapters are using elements for the message parts. We recommend that you add the RPC-style Web services through Add Web Reference wizard for consuming the Web services in BizTalk projects.'

How to Configure Spring MVC 4 to send and receive soap messages in two way SSL using Web Service Consumer?

I have tried to configure Spring MVC in two way SSL using Spring Ws to connect to third party but due to the lack of documentation I have decided to integrate my Spring MVC 4 Application with Web Service Consumer .I am a beginner in Web Service consumption.I would like to know how to configure my Spring MVC 4 application with web service consumer with annotation based configuration to achieve a Two way SSl communication with Third party and also encrypt my soap messages before it is sent to the https server ?If any links or sample code would be helpful.
Also if the WSDL is located in a a https link how do I generate the classes?
This question is huge. There is no a trivial solution
I can provide the steps and guide to the manual
1)Resolve CXF dependencies to include libraries in your project
Use maven, ivy or download. You need jax-ws and related
http://cxf.apache.org/docs/using-cxf-with-maven.html
2) Generate a Java client with wsdl2java to your wsdl
For example
wsdl2java -p com.mycompany.greeting Greeting.wsdl
http://cxf.apache.org/docs/wsdl-to-java.html
3) Create the jax-ws programmatically
wdsl2java have done the work for you
http://cxf.apache.org/docs/how-do-i-develop-a-client.html#HowdoIdevelopaclient?-JAX-WSProxy
HelloService service = new HelloService();
Hello helloClient = service.getHelloHttpPort();
String result = helloClient .sayHi("Joe");
Note: It is also possible configure with spring
4) Configure the authentication with client certificate
This is the hard step
http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport(includingSSLsupport)-ConfiguringSSLSupport
Define a conduit file with the reference to your certificate. This is an example
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xmlns:sec="http://cxf.apache.org/configuration/security"
xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<http-conf:conduit name="*.http-conduit">
<http-conf:tlsClientParameters disableCNCheck="true" secureSocketProtocol="TLS">
<sec:keyManagers keyPassword="password" >
<sec:keyStore type="pkcs12" password="password"
file="yourcertificate.p12" />
</sec:keyManagers> </http-conf:tlsClientParameters>
<http-conf:client Connection="Keep-Alive" MaxRetransmits="1" AllowChunking="false" />
</http-conf:conduit>
</beans>
If you prefer to do programmaticaly you can do
Client client = ClientProxy.getClient(helloClient);
HTTPConduit http = (HTTPConduit) client.getConduit();
//set the parameters in a similar way to file

ActiveMQ 5.8 Http GET configuration or example

I've installed ActiveMQ 5.8 and have created some internal queues.
I then created camel routes to reroute messages from first queue(inbound.A) to other internal queues (B,A,D etc).
Now the next part is to configure ActiveMQ to recieve xmls from a webservice which posts messages to a http URL. I have tried to get some examples but none of the bundled demos are working.
I can see that there is nothing in the webapps/api/ folder. Even when o looked in the webapps-demo/demo folder I don't see any examples of how I can do this or something similar.
I have outlined that I need to :
First expose a url where the producer webservice can access it .Can this be simply done by updating the transport connector?
<transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61617?maximumConnections=1000&wireformat.maxFrameSize=104857600"/>
<!--<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireformat.maxFrameSize=104857600"/>-->
</transportConnectors>
Then I need to configure this endpoint so that messages posted to this URL reach my inbound.A queue.
Can someone suggest any examples i can look at?
if you just need to post XML messages to an ActiveMQ queue, then just use camel-jetty to expose an inbound HTTP endpoint and send the XML as text directly to the queue, like this...
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route id="InboundHTTPRoute">
<from uri="jetty:http://0.0.0.0:8080/inbound/"/>
<inOnly uri="activemq:inboundQ?jmsMessageType=Text"/>
</route>
</camelContext>
otherwise, if you need to define an HTTP SOAP interface, use camel-cxf

SOAP over HTTP and SOAP over JMS

I have a requirement where a web service has to be exposed both as SOAP over HTTP and JMS. How would be the bindings for both in a WSDL at the same time ?
Also what all extra care(compared to a simple web service SOAP over HTTP) need to be taken for generating and deploying webservice in this scenario?
If possible, please give an example of a WSDL where both bindings are mentioned.

IP-addresses Log file by all requests in MULE CE 3.3.0?

in MULE CE 3.3.0 I want to implement this process:
1- Post- office has a service for giving postal-code to clients. So post-office creates a WSDL-file for its service.
2- Here, our company is a connector between post-office and clients. Our company using mule and create another WSDL file based on post-office’s WSDL file and published out the WSDL for client usage.
3- Company-A and Company-B, get the WSDL-file URL and for instance in My-eclipse IDE or any other IDEs create a portlet and deploy it in a liferay portal as a web-service for displaying postal-code to its clients.
During this process I want to have a log file of ip-addresses. It means, I want to after each request that Company-A’s client or Company-B’s client sent to the server(Our company), it’s Ip-address insert into a database or in a file.
I illustrated my position in the image by a red Arrow. Now I want to put an script in MULE server that and gather all the ip addresses that Company-A's and Company-B's customers who use post-code webservice.
Can I use cxf-interceptor for this issuse ? and how? guide me?
As genjosanzo has suggested in https://stackoverflow.com/a/15993127/387927, you can access all the Mule headers in a CXF interceptor. This means that yes, you can achieve your goal with a CXF interceptor.
Here is an example of such an interceptor: https://github.com/mulesoft/mule/blob/mule-3.3.1/modules/cxf/src/main/java/org/mule/module/cxf/support/MuleHeadersInInterceptor.java
Here is a configuration sample that shows how to use Spring to instantiate and configure CXF interceptors: https://github.com/mulesoft/mule/blob/mule-3.3.1/modules/cxf/src/test/resources/header-conf.xml
The gist of it is:
<cxf:inInterceptors>
<spring:bean id="foo1" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
</cxf:inInterceptors>