for servicemix 3.2.1, jdk 5
Hi all, I am a bit puzzled.
I did code a simple SE component which can deploy fine to servicemix 3.2.1
I have tests units to test the component service in both embedded and
remote mode.
Everything is working perfectly fine when I get the component through
its service name or static endpoint.
Now I try to play with dynamic endpoint resolution.
The problem is that the following client code never triggers the
overriden 'protected Endpoint getResolvedEPR( ServiceEndpoint ep )
throws Exception' method in my component :
Document document = null;
DocumentFragment fragment = null;
DocumentBuilder builder = null;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try{
builder = factory.newDocumentBuilder();
document = builder.newDocument();
} catch (Exception e) {
e.printStackTrace();
}
// Insert Root Order
Element root = (Element) document.createElement("root");
fragment = document.createDocumentFragment();
fragment.appendChild( root );
Node manifestChild = document.createElement("element1");
root.appendChild(manifestChild);
ServiceEndpoint se =
client.getContext().resolveEndpointReference(fragment);
me.setEndpoint(se);
System.out.println( se.getEndpointName() );
System.out.println( se.getServiceName() );
// set the target operation for this service (optional)
me.setOperation( new QName("get") );
// set the invocation data
me.getInMessage().setContent( new StringSource(
"<ok><hello>world</hello></ok>" ) );
client.sendSync( me );
I always get a null pointer exception at line 'System.out.println(
se.getEndpointName() );' so se is obviously null and I can see in my
component trace log that getResolvedEPR is never called.
I suspect that the client API (embedded and remote, I tried both) is
using ComponentSupport which has hardcoded:
public ServiceEndpoint resolveEndpointReference(DocumentFragment fragment) {
return null;
}
By the way what is the recommended/valid DOM fragment structure for
describing an endpoint ?
The idea behind all of that is to have endpoints as Resources for a
REST-like architecture and it means pattern based identification for
endpoints
Any help much appreciated as obviously I miss something