Hi Abhishek
Use the below SimplePOJO class, and drop it into the lib directory to
make it available (either as a .class or JAR)
Use a configuration as below:
<definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy name="ServiceProxy">
<target>
<inSequence>
<pojoCommand name="SimplePOJO">
<property name="processString"
expression="//processstring" action="ReadMessage"/>
<property name="program" context-name="program-var"
action="UpdateContext"/>
</pojoCommand>
<switch source="get-property('program-var')">
<case regex="Law">
<log level="custom">
<property name="Program" value="Law **"/>
</log>
</case>
<default>
<log level="custom">
<property name="Program"
expression="get-property('program-var')"/>
</log>
</default>
</switch>
<!-- Fill as you want -->
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
</proxy>
</definitions>
Note, that when the POJO mediator is used a new instance is created to
handle each message. You could use a custom mediator or a class mediator
if you want to get around this
cheers
asankha
Hey my input request looks like this:
<?xml version='1.0' encoding='utf-8'?><S:Envelope
xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:processProspectDetails
xmlns:ns2="http://BusinessSchoolService/"><processstring><?xml
version="1.0" encoding="UTF-8"?>
<prospect>
<Name> zxcz</Name>
<Age>2q</Age>
<Address>sada</Address>
<SSN>dasdadA</SSN>
<Program>Law</Program>
</prospect>
</processstring></ns2:processProspectDetails></S:Body></S:Envelope>
and if i am doing mc.geypayloadxml() in source element of switch case , i am
getting the following error
error
org.jaxen.UnresolvableException: No Such Function mc.getPayloadXML
Can i directly check for law somehow in the input request?
public class SimplePOJO {
private String processString;
private String program;
public void setProcessString(String s) {
this.processString = s;
}
public String getProcessString() {
return processString;
}
public void setProgram(String s) {
this.program = s;
}
public String getProgram() {
return program;
}
public void execute() {
int i = processString.indexOf("Program>");
int j = processString.indexOf("</Program>");
program = processString.substring(i+8, j);
System.out.println("Executing :: program ==>" + program + "<==");
}
}
--
Asankha C. Perera
http://adroitlogic.org
http://esbmagic.blogspot.com