public Message handleMessage(Packet packet,String payloadName) throws Exception{
Map<String, Object> invocationProperties = packet.invocationProperties;
boolean OUT_BOUND = invocationProperties.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY) != null &&
(Boolean)invocationProperties.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
SEIModel seiModel = this.codec.getSEIModel(packet);
JAXBContextImpl context = (JAXBContextImpl)seiModel.getJAXBContext();
Style style = seiModel.getPort().getBinding().getStyle();
if(!OUT_BOUND){
// Request message
// TODO when operation <input><json:body contains different namespace than port level name space bellow call fails to identify operation.
WSDLBoundOperation operation = seiModel.getPort().getBinding().getOperation(seiModel.getTargetNamespace(),payloadName);
if(operation == null || !packet.invocationProperties.containsKey(JSONCodec.JSON_MAP_KEY)){
throw new RuntimeException("Operation %s input parameter(s) not found or invalid.");
}
JavaMethod javaMethod = seiModel.getJavaMethod(operation.getName());
if(javaMethod == null && javaMethodAccessor != null){
javaMethod = (JavaMethod) javaMethodAccessor.invoke(seiModel, operation.getName());
}else{
// TODO iterate all method and find
}
Method seiMethod = javaMethod.getSEIMethod();
JSONWebService jsonwebService = javaMethod.getMethod().getAnnotation(JSONWebService.class);
// Put codec specific properties in invoke
invocationProperties.put(JSONCodec.globalMapKeyPattern_KEY, (jsonwebService == null || jsonwebService.listMapKey().isEmpty())?
JSONCodec.globalMapKeyPattern : Pattern.compile(jsonwebService.listMapKey()));
invocationProperties.put(JSONCodec.globalMapValuePattern_KEY, (jsonwebService == null || jsonwebService.listMapValue().isEmpty())?
JSONCodec.globalMapValuePattern : Pattern.compile(jsonwebService.listMapValue()));
//
Map<String,Object> operationParameters = (Map<String, Object>) invocationProperties.remove(JSONCodec.JSON_MAP_KEY);
WSJSONPopulator jsonPopulator = new WSJSONPopulator((Pattern)invocationProperties.get(JSONCodec.globalMapKeyPattern_KEY),
(Pattern)invocationProperties.get(JSONCodec.globalMapValuePattern_KEY),JSONCodec.dateFormat,
codec.getCustomSerializer()
,(DebugTrace)invocationProperties.get(JSONCodec.TRACE));
Object[] parameterObjects = new Object[operation.getInParts().size()];
Class<?>[] parameterTypes = seiMethod.getParameterTypes();// This parameter types not trustable in case of HOLDER
for(Map.Entry<String, WSDLPart> part : operation.getInParts().entrySet()){
Class<?> parameterType;
if(context.getGlobalType(part.getValue().getDescriptor().name()) != null)
parameterType = context.getGlobalType(part.getValue().getDescriptor().name()).jaxbType;
else
/*
* This parameter types not trustable in case of HOLDER
* We can't find it in global type once user extend simple type and use it as method parameter.
* E.g String255 extended from String