JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Use Agile By Default
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile Access more options (Alt+g)
  • Create Issue
  • Mule
  • MULE-4235

Enable validation in a CXF endpoint

  • Agile Board
  • More Actions
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Patch submission Patch submission
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.1.3
  • Fix Version/s: 3.1.0
  • Component/s: Modules: CXF
  • Labels:
    • sr
  • Environment:

    Standalone

  • Includes test case?:
    no
  • User impact:
    Medium
  • Affects Docs:
    Yes
  • Similar Issues:
    None

Description

CXF allows incoming messages to be automatically validated using the wsdl/xsd. Mule CXF Transport should allow to set this cxf feature using out of the box tags. The code for the cxf feature to allow validation is attached. Currently you can use the attached code and the following config on <inbound- endpoint:>

<cxf:inbound-endpoint address="http://localhost:8082/services/Foo"
serviceClass="org.mule.Foo"
>
<cxf:features>
<spring:bean id="SchemaValidationFeature" class="org.mule.transport.cxf.support.SchemaValidationFeature"/>
</cxf:features>

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Java Source File
    SchemaValidationFeature.java
    05/Mar/09 01:29 PM
    2 kB
    Puneet Gupta

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Transitions
  • Commits
  • Source
  • Builds
Hide
Permalink
Ken Yagen added a comment - 01/Jul/09 12:37 PM

stretch task for iteration 22

Show
Ken Yagen added a comment - 01/Jul/09 12:37 PM stretch task for iteration 22
Hide
Permalink
Daniel Feist added a comment - 14/Jul/09 02:26 PM - edited

This is very quick/easy to add, will take some time to implement a test case though. Ideally we would add a functional test case that using this feature/interceptor tests both valid and invalid messages,

Show
Daniel Feist added a comment - 14/Jul/09 02:26 PM - edited This is very quick/easy to add, will take some time to implement a test case though. Ideally we would add a functional test case that using this feature/interceptor tests both valid and invalid messages,
Hide
Permalink
asdf sdf added a comment - 15/Sep/09 03:03 AM

You CANNOT get you want according to the Description. I wasted three days. I don't know wthether the solution is provided by MULE. I seriously disagree the irresponsible attitude.

If you write like below in a endPoint in configuration:
<cxf:features>
<spring:bean id="SchemaValidationFeature" class="org.mule.transport.cxf.support.SchemaValidationFeature"/>
</cxf:features>

You MUST override the initialize(Server server, Bus bus) method. the initialize(Bus bus) method is never invoked.
like this:

/** Be invoked, if the feature is defined in a endpoint. */
@Override
public void initialize(Server server, Bus bus) { Service service = server.getEndpoint().getService(); addInterceptors(service); }

/** Just for all the service */
@Override
public void initialize(Bus bus) { addInterceptors(bus); }

private void addInterceptors(InterceptorProvider provider) { AbstractPhaseInterceptor<Message> in = new EnabledSchemaValidationInterceptor(); provider.getInInterceptors().add(in); //provider.getInFaultInterceptors().add(in); AbstractPhaseInterceptor<Message> out = new DisabledSchemaValidationInterceptor(); provider.getOutInterceptors().add(out); //provider.getOutFaultInterceptors().add(out); }

Relevant Classes:

class EnabledSchemaValidationInterceptor extends AbstractPhaseInterceptor<Message> {
public EnabledSchemaValidationInterceptor() { super(Phase.UNMARSHAL); addBefore(DocLiteralInInterceptor.class.getName()); }
public void handleMessage(Message message) throws Fault { message.put("schema-validation-enabled",true); }
}

/** Do not validate a reponse. */
class DisabledSchemaValidationInterceptor extends AbstractPhaseInterceptor<Message> {

public DisabledSchemaValidationInterceptor() { super(Phase.MARSHAL); addBefore(BareOutInterceptor.class.getName()); }

public void handleMessage(Message message) throws Fault { message.put("schema-validation-enabled",false); }
}

Show
asdf sdf added a comment - 15/Sep/09 03:03 AM You CANNOT get you want according to the Description. I wasted three days. I don't know wthether the solution is provided by MULE. I seriously disagree the irresponsible attitude. If you write like below in a endPoint in configuration: <cxf:features> <spring:bean id="SchemaValidationFeature" class="org.mule.transport.cxf.support.SchemaValidationFeature"/> </cxf:features> You MUST override the initialize(Server server, Bus bus) method. the initialize(Bus bus) method is never invoked. like this: /** Be invoked, if the feature is defined in a endpoint. */ @Override public void initialize(Server server, Bus bus) { Service service = server.getEndpoint().getService(); addInterceptors(service); } /** Just for all the service */ @Override public void initialize(Bus bus) { addInterceptors(bus); } private void addInterceptors(InterceptorProvider provider) { AbstractPhaseInterceptor<Message> in = new EnabledSchemaValidationInterceptor(); provider.getInInterceptors().add(in); //provider.getInFaultInterceptors().add(in); AbstractPhaseInterceptor<Message> out = new DisabledSchemaValidationInterceptor(); provider.getOutInterceptors().add(out); //provider.getOutFaultInterceptors().add(out); } Relevant Classes: class EnabledSchemaValidationInterceptor extends AbstractPhaseInterceptor<Message> { public EnabledSchemaValidationInterceptor() { super(Phase.UNMARSHAL); addBefore(DocLiteralInInterceptor.class.getName()); } public void handleMessage(Message message) throws Fault { message.put("schema-validation-enabled",true); } } /** Do not validate a reponse. */ class DisabledSchemaValidationInterceptor extends AbstractPhaseInterceptor<Message> { public DisabledSchemaValidationInterceptor() { super(Phase.MARSHAL); addBefore(BareOutInterceptor.class.getName()); } public void handleMessage(Message message) throws Fault { message.put("schema-validation-enabled",false); } }
Hide
Permalink
Dan Diephouse added a comment - 01/Dec/10 04:32 PM

Fixed in r20429. To enable validation add validationEnabled="true" to your cxf service element in your configuraiton. Validation is only supported on inbound.

Show
Dan Diephouse added a comment - 01/Dec/10 04:32 PM Fixed in r20429. To enable validation add validationEnabled="true" to your cxf service element in your configuraiton. Validation is only supported on inbound.
Hide
Permalink
Pablo Kraan added a comment - 01/Dec/10 05:02 PM

Is same fix applicable in 2.2.x? (CXF version=2.1.10)

Show
Pablo Kraan added a comment - 01/Dec/10 05:02 PM Is same fix applicable in 2.2.x? (CXF version=2.1.10)
Hide
Permalink
Dan Diephouse added a comment - 01/Dec/10 05:09 PM

Nope. This requires CXF 2.3.0

Show
Dan Diephouse added a comment - 01/Dec/10 05:09 PM Nope. This requires CXF 2.3.0

People

  • Assignee:
    Dan Diephouse
    Reporter:
    Puneet Gupta
Vote (1)
Watch (1)

Dates

  • Created:
    05/Mar/09 01:28 PM
    Updated:
    01/Dec/10 05:09 PM
    Resolved:
    01/Dec/10 04:32 PM

Agile

  • View on Board
  • Atlassian JIRA (v5.0.7#734-sha1:8ad78a6)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for MuleForge. Try JIRA - bug tracking software for your team.