how can use wire-tape in mule for statstict wsdl? - web-services

i define a web-service in mule i want to get statistics user that use from web-service
how can use wire-tape in my project? what is wire-tape? i have not wire- tap in mule pallet
<flow name="service-cxf-wsdlfirstFlow1" doc:name="service-cxf-wsdlfirstFlow1">
<wire-tap>
<vm:outbound-endpoint path="tapped.channel"/>
<wildcard-filter pattern="the quick brown*"/>
</wire-tap>
<http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:8882/OrderSvcs" doc:name="HTTP"/>
<cxf:proxy-service payload="envelope" doc:name="SOAP" enableMuleSoapHeaders="false" namespace="http://tempuri.org/" service="XXX_News" wsdlLocation="http://www.XXXXXtab.org/XXXX.asmx?WSDL"/>
</flow>

The wire-tap routing message processor seems like a good candidate for what you want to achieve. From its documentation:
The WireTap message processor allows you to route certain messages to
a different message processor as well as to the next one in the chain.

Related

Mule ESB -- Introduce a Middleware to Publish and Consume SOAP

I just have started using Mule 3.8 CE version. My use case is to like this,
Publish SOAP -- Hit any method from Published SOAP -- Receive data -- Pass this Data to consume SOAP -- Fetch Response -- Process response via Java -- Return this as response from Method of Published SOAP.
In short I want to introduce a middleware (not a proxy) from Mule which will publish endpoint (e1) -- receive data from that endpoint (e1) -- pass this data to another endpoint(e2) -- receive data from this another endpoint.(e2) -- return response to original endpoint (e1).
Currently I am using following Mule configuration to achieve this,
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8085" doc:name="HTTP Listener Configuration"/>
<endpoint exchange-pattern="request-response" address="http://192.168.2.3:9080/crestelBEExport/billexport/CrestelBEExportService/CrestelBEExport" name="Generic" doc:name="Generic"/>
<flow name="webserviceproducerFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/hello" doc:name="HTTP"/>
<cxf:jaxws-service serviceClass="com.poc.example.ws.IHelloWorld" doc:name ="CXF" />
<component class="com.poc.example.ws.HelloWorldWSImpl" doc:name="Java"/>
</flow>
In the 'HellowWorldWSImpl" I have Webmethod. I am consuming SOAP and receive data in this webmethod. I am returning this data consumed from SOAP as response to this Webmethod. Is this right approach or is there any better way to achieve my requirement?
With Mule 3.8 enterprise edition, you have a feature, which will help you to specify WSDL in the beginning
This will create similar structure like a RAMLSample WSDL
You can use WS Consumer for calling the WS. No need in writing java code. This will be more "mule" way.

Exposing web service in mule

I want to expose a web service. I have WSDL file with me. I am using CXF proxy service as operation. Now, I have doubt that in Inbound attributes value of port,namespace & service should take from WSDL file only,Right?
If yes, then, after deploying through, http://localhost:8081?wsdl this link am not getting same WSDL which I want to expose.
So, tell me where am I going wrong?Thanks.
To test the project, which URL should use in SoapUI, so that appropriate request XML will generate...
Here is my flow,
<flow name="meterreadingdocumenterpresultbulkcreateconfirmation_outFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<cxf:proxy-service configuration-ref="CXF_Configuration" port="MeterReadingDocumentERPResultBulkCreateConfirmation_OutPort" namespace="http://sap.com/xi/IS-U/Global2" service="MeterReadingDocumentERPResultBulkCreateConfirmation_OutService" payload="body" doc:name="CXF" validationEnabled="true"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
<logger level="INFO" doc:name="Logger" message="#[payload]"/>
</flow>
After exposing a web service I am not getting proper response...

Filter payload that passes to the transformer in Webservice Proxy pattern in Mule ESB

When using a web service proxy pattern in Mule, you have the ability to pass the message through 1 or more transformers. Is there anyway to avoid passing ?Wsdl gets or other messages filtered on Content-Type for example? My transformer is manipulating the XML payload prior to passing it off to the web service, but I've found my wsdl calls are also being processed by the transformer and failing.
I've put a check in my transformer code, but this doesn't seem like the right way to go about solving this.
if(message.getOriginalPayload().toString().endsWith("wsdl")||!(xmlString.startsWith("<") && xmlString.endsWith(">"))){return message; }
The Proxy config:
<pattern:web-service-proxy name="SR-Proxy"
doc:name="SR-Proxy"
transformer-refs="enrichPayloadWithSFSession"
wsdlFile="service/SR_Webservice.wsdl">
<http:inbound-endpoint exchange-pattern="request-response" host="${hostname}" port="${http.port}" path="service/SRProxy" doc:name="HTTP" />
<https:outbound-endpoint exchange-pattern="request-response" address="${sfdc.wsUrl}SR_Webservice" />
</pattern:web-service-proxy>
Use the http.query.string inbound message property to detect the ?wsdl request.
See http://www.mulesoft.org/documentation/display/current/HTTP+Transport+Reference#HTTPTransportReference-HTTPProperties for more information about the available inbound properties you can find in inbound HTTP messages.

Exposing WebService on Mule

I wanted expose an WebService on mule and its working.
My concern is that am not sure if this is the right approach to follow in exposing a webservice.
As I wanted to be able to view my Mule HTTP Inbound endpoint wsdl i.e
XXX:8084/HelloService?wsdl
, notice the actual service is running on port 8085.
<flow name="WS_In" doc:name="WS_In">
<http:inbound-endpoint address="http://localhost:8084/HelloService" exchange-pattern="request-response" doc:name="HTTP">
<cxf:proxy-service wsdlLocation="http://localhost:8085/HelloService?WSDL" payload="envelope" namespace="http://example.org/HelloService" service="Hello"/>
</http:inbound-endpoint>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8085" doc:name="HTTP" path="test"/>
</flow>
So you're not exposing a service but just proxying it right?
Why not using the ready made pattern for that? See: http://www.mulesoft.org/documentation/display/current/Web+Service+Proxy+Pattern
Proxying web services is a very common practice used for different reasons like security or auditing. This pattern allows a short and easy configuration of such a proxy.
With this you can
Transform the SOAP envelope (body or header) to add or remove specific entries.
Rewrite remote WSDLs so they appear to bind to services inside a corporate firewall.
Mule has already defined these proxy transformers in various ways:
Ref: https://docs.mulesoft.com/mule-user-guide/v/3.7/web-service-proxy-pattern#wsdl-redirection

Exception handling in Mule ESB Flows: Multiple exception strategies

I want to add exception handling in Mule ESB using custom-exception-strategy. However, I have multiple service calls in one flow, and I want to handle exceptions from each service call separately.
Is it possible to have multiple custom-exception strategies in a single flow? Right now, I am able to use only one custom-exception-strategy, and only when I place it at the end of the flow, after the last outbound endpoint. This is the expected behavior. All right. But I want to use multiple exception strategies in a flow.
The Mulesoft documentation says we have to use processor chains if we want to use multiple exception strategies. I am not sure how it will translate into the configuration XML. Any guidance?
For this you need place your different service calls in private flows.
Something like:
<flow name="main">
<inbound-endpoint ref="in" />
<flow-ref name="sub1" />
<flow-ref name="sub2" />
</flow>
<flow name="sub1" processingStrategy="synchronous">
<!-- do something -->
<custom-exception-strategy>
<!-- sub1 specific -->
</custom-exception-strategy>
</flow>
<flow name="sub2" processingStrategy="synchronous">
<!-- do something -->
<custom-exception-strategy>
<!-- sub2 specific -->
</custom-exception-strategy>
</flow>