Topic
  • No replies
SystemAdmin
SystemAdmin
3556 Posts

Pinned topic Return Exception to Client from converFromNativeData (HTTPStreamDataBinding

‏2012-10-22T20:23:23Z |
I am trying to expose a service that will allow a user to call a service via the HTTP Binding by providing arguments by specifying them on the query string. When I encounter a problem with parsing the data within the convertFormNativeData method within the class that implements HTTPStreamDataBinding and try to throw an exception, my mediation flow is still executed along with the associated maps, but those processes aren't sent any data. Is there any way to get the entire process to stop if I encounter an error when I execute the convertFromNativeData method? I've provided some sample code below which shows what I've included in the class. Please note that when I send all of data in the format I expect, then I am able to successfully load all of the parameters I am interested in.




public 

class HTTPGetRequestParser 

implements HTTPStreamDataBinding, BindingContext 
{ 

public 

void convertFromNativeData(HTTPInputStream arg0) 

throws DataBindingException, IOException 
{ 

throw 

new DataBindingException(
"Unable to convert data"); 
}   

public DataObject getDataObject() 

throws DataBindingException 
{ 

if (fieldDataObject == 

null) 
{ ServiceManager serviceManager = ServiceManager.INSTANCE; BOFactory bofactory = (BOFactory) serviceManager.locateService(
"com/ibm/websphere/bo/BOFactory"); fieldDataObject = bofactory.create(targetNamespace, localName); 
} 

return fieldDataObject; 
}   

public 

void setBindingContext(Map arg0) 
{ bindingContext = arg0; QName qname = (QName) bindingContext.get(
"ExpectedType"); 

if (qname != 

null) 
{ targetNamespace = qname.getNamespaceURI(); localName = qname.getLocalPart(); 
} 
} 
}

Thanks,
Jeremy