Day-8 Configuring Exception strategies

There are different types of strategies available in mule to configure exceptions.

exception-1

If we did not configure the exception strategy to the flow. then the exception will be handled by Mule Default Message exception strategy.

catchExceptionStrategy like similar to handling exception in Java using

try{

}catch(Exception ex){

}

exception-2

In flow:

<catch-exception-strategy doc:name=”CatchExceptionStrategy”>
<logger message=”Exception occured” level=”INFO” doc:name=”Logger”/>
</catch-exception-strategy>

 

It will handle all the exceptions.  if you want to handle each exception in a different manner then need to choose choiceExceptionStrategy.

exception-3

if you define exception strategy inside flow the scope of strategy is up to the flow. the flow won’t be available in other flows.

To make the flow available to al flows, the strategy need to declare exception on global scope rather flow scope. the refer the strategy in the flow using ReferenceExceptionStrategy.

exception-4

we can override Mule default exception strategy by declaring the exception strategy at global scope and marking it as default using configuration tag

  <configuration  defaultExceptionStrategy-ref=”myCatch”/> 

Code examples available at Day-8.zip at

https://drive.google.com/drive/folders/0B7kdTdRlWaF_TVhOaTk1cDVEYzQ

 

 

Day -7 Configuring SOAP web Services

In Mule ESB we can configure SOAP based web services through CXF component available in component palette.  we can develop services and clients for Simple and JAX-WS and proxy.

we can configure code first and contract first style web services.

  1. Exposing a method implementation as web service without JAX-WS
  2. Exposing a method implementation as web service with JAX-WS
  3. Exposing Contract first web service

Steps for Simple Service without JAX-WS.

  • configure HTTP component
  • Code the Service interface and implementation.

package simplesoap;
public interface WishService {
public String sayHello(String name);
}

package simplesoap;
public class WishServiceImpl implements WishService {
@Override
public String sayHello(String name) {
return “Hello” + name + “How are you ??” ;
}
}

  • Configure Java componentSOAP-1
  • Configure CXF component.SOAP-2
  • The configuration looks like
  • SOAP-3

2) Configuring service with JAX-WS

TO expose Jax-WS based web services, we need to annotate the service interface with @webservice

Steps are same as above service, only the service interface is annotated with @Webservice annotation

package jaxwssoap;
import javax.jws.WebService;
@WebService
public interface EmployeeService {
public SalaryDetails getEmpSalDetails(Employee emp);
}

  1. Exposing Contract first web service, Please refer
    •  https://dzone.com/articles/mulesoft-contract-first-web-service-development

Code examples find at Day-7.zip at

https://drive.google.com/drive/folders/0B7kdTdRlWaF_TVhOaTk1cDVEYzQ