private static WsdlOperationInfo getWsdlOperationInfo(final Operation operation)
throws XMLStreamException
{
final WsdlOperation wsdlOperation = (WsdlOperation)operation ;
final String requestTemplate = wsdlOperation.createRequest(true);
final XMLEventReader requestReader = XMLHelper.getXMLEventReader(new StringReader(requestTemplate)) ;
final List<XMLEvent> requestEvents = ESBStaxXMLEvent.cloneStream(requestReader) ;
final String responseTemplate = wsdlOperation.createResponse(true);
final List<XMLEvent> responseEvents ;
if (responseTemplate != null)
{
final XMLEventReader responseReader = XMLHelper.getXMLEventReader(new StringReader(responseTemplate)) ;
responseEvents = ESBStaxXMLEvent.cloneStream(responseReader) ;
}
else
{
responseEvents = Collections.emptyList() ;
}
final MessagePart[] faultParts = wsdlOperation.getFaultParts();
final Map<String, List<XMLEvent>> faultEventsMap = new HashMap<String, List<XMLEvent>>() ;
final SoapMessageBuilder soapMessageBuilder = wsdlOperation.getInterface().getMessageBuilder();
final XmlObject detail = XmlObject.Factory.newInstance();
for(MessagePart messagePart: faultParts)
{
final MessagePart.FaultPart faultPart = (MessagePart.FaultPart)messagePart ;
final String faultName = faultPart.getName() ;
final SampleXmlUtil generator = new SampleXmlUtil(false) ;
generator.setExampleContent(false) ;
generator.setTypeComment(false) ;
final XmlCursor cursor = detail.newCursor();
cursor.toFirstContentToken() ;
generator.setTypeComment(true) ;
generator.setIgnoreOptional(wsdlOperation.getInterface().getSettings().getBoolean( WsdlSettings.XML_GENERATION_ALWAYS_INCLUDE_OPTIONAL_ELEMENTS ) );
for(Part part: faultPart.getWsdlParts())
{
try
{
soapMessageBuilder.createElementForPart(part, cursor, generator);