src/share/jaxws_classes/com/sun/tools/internal/ws/processor/modeler/wsdl/WSDLModeler.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -24,10 +24,11 @@
  */
 
 package com.sun.tools.internal.ws.processor.modeler.wsdl;
 
 import com.sun.codemodel.internal.JType;
+import com.sun.istack.internal.NotNull;
 import com.sun.istack.internal.SAXParseException2;
 import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
 import com.sun.tools.internal.ws.processor.generator.Names;
 import com.sun.tools.internal.ws.processor.model.*;
 import com.sun.tools.internal.ws.processor.model.Fault;

@@ -52,11 +53,10 @@
 import com.sun.tools.internal.ws.wsdl.parser.MetadataFinder;
 import com.sun.tools.internal.ws.wsdl.parser.WSDLParser;
 import com.sun.tools.internal.xjc.api.S2JJAXBModel;
 import com.sun.tools.internal.xjc.api.TypeAndAnnotation;
 import com.sun.tools.internal.xjc.api.XJC;
-import com.sun.xml.internal.ws.spi.db.BindingContext;
 import com.sun.xml.internal.ws.spi.db.BindingHelper;
 import com.sun.xml.internal.ws.util.xml.XmlUtil;
 import org.xml.sax.InputSource;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;

@@ -93,14 +93,16 @@
         RPC_LITERAL, DOC_LITERAL
     }
 
     private JAXBModelBuilder jaxbModelBuilder;
 
+    @Override
     public Model buildModel() {
         try {
             parser = new WSDLParser(options, errReceiver, forest);
             parser.addParserListener(new ParserListener() {
+                @Override
                 public void ignoringExtension(Entity entity, QName name, QName parent) {
                     if (parent.equals(WSDLConstants.QNAME_TYPES)) {
                         // check for a schema element with the wrong namespace URI
                         if (name.getLocalPart().equals("schema")
                                 && !name.getNamespaceURI().equals("")) {

@@ -108,41 +110,46 @@
                         }
                     }
 
                 }
 
+                @Override
                 public void doneParsingEntity(QName element, Entity entity) {
                 }
             });
 
             document = parser.parse();
-            if (document == null || document.getDefinitions() == null)
+            if (document == null || document.getDefinitions() == null) {
                 return null;
+            }
 
             document.validateLocally();
             Model model = internalBuildModel(document);
-            if(model == null || errReceiver.hadError())
+            if (model == null || errReceiver.hadError()) {
                 return null;
+            }
             //ClassNameCollector classNameCollector = new ClassNameCollector();
             classNameCollector.process(model);
             if (classNameCollector.getConflictingClassNames().isEmpty()) {
-                if(errReceiver.hadError())
+                if (errReceiver.hadError()) {
                     return null;
+                }
                 return model;
             }
             // do another pass, this time with conflict resolution enabled
             model = internalBuildModel(document);
 
             classNameCollector.process(model);
             if (classNameCollector.getConflictingClassNames().isEmpty()) {
                 // we're done
-                if(errReceiver.hadError())
+                if (errReceiver.hadError()) {
                     return null;
+                }
                 return model;
             }
             // give up
-            StringBuffer conflictList = new StringBuffer();
+            StringBuilder conflictList = new StringBuilder();
             boolean first = true;
             for (Iterator iter =
                     classNameCollector.getConflictingClassNames().iterator();
                  iter.hasNext();
                     ) {

@@ -206,11 +213,10 @@
             for (Iterator iter = document.getDefinitions().services();
                  iter.hasNext();
                     ) {
                 processService((com.sun.tools.internal.ws.wsdl.document.Service) iter.next(),
                         model, document);
-                hasServices = true;
             }
         } else {
             // emit a warning if there are no service definitions
             warning(model.getEntity(), ModelerMessages.WSDLMODELER_WARNING_NO_SERVICE_DEFINITIONS_FOUND());
         }

@@ -274,12 +280,13 @@
                     // not a SOAP port, ignore it
                     warning(wsdlPort, ModelerMessages.WSDLMODELER_WARNING_IGNORING_NON_SOAP_PORT_NO_ADDRESS(wsdlPort.getName()));
                     return false;
                 }
             }
-            if(soapAddress != null)
+            if (soapAddress != null) {
                 port.setAddress(soapAddress.getLocation());
+            }
             Binding binding = wsdlPort.resolveBinding(document);
             QName bindingName = getQNameOf(binding);
             PortType portType = binding.resolvePortType(document);
 
             port.setProperty(

@@ -391,11 +398,11 @@
 
                     com.sun.tools.internal.ws.wsdl.document.Operation portTypeOperation =
                             null;
                     Set operations =
                             portType.getOperationsNamed(bindingOperation.getName());
-                    if (operations.size() == 0) {
+                    if (operations.isEmpty()) {
                         // the WSDL document is invalid
                         error(bindingOperation, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_NOT_IN_PORT_TYPE(bindingOperation.getName(), binding.getName()));
                     } else if (operations.size() == 1) {
                         portTypeOperation =
                                 (com.sun.tools.internal.ws.wsdl.document.Operation) operations

@@ -453,13 +460,13 @@
                                         hasOverloadedOperations,
                                         headers);
 
 
                         Operation operation;
-                        if(soapBinding != null)
+                        if (soapBinding != null) {
                             operation = processSOAPOperation();
-                        else{
+                        } else {
                             operation = processNonSOAPOperation();
                         }
                         if (operation != null) {
                             port.addOperation(operation);
                             hasOperations = true;

@@ -598,25 +605,27 @@
      * Shall this check if parts are mixed and throw error message?
      */
     private void setNonSoapStyle(Message inputMessage, Message outputMessage) {
         SOAPStyle style = SOAPStyle.DOCUMENT;
         for(MessagePart part:inputMessage.getParts()){
-            if(part.getDescriptorKind() == SchemaKinds.XSD_TYPE)
+            if (part.getDescriptorKind() == SchemaKinds.XSD_TYPE) {
                 style = SOAPStyle.RPC;
-            else
+            } else {
                 style = SOAPStyle.DOCUMENT;
         }
+        }
 
         //check the outputMessage parts
         if(outputMessage != null){
             for(MessagePart part:outputMessage.getParts()){
-                if(part.getDescriptorKind() == SchemaKinds.XSD_TYPE)
+                if (part.getDescriptorKind() == SchemaKinds.XSD_TYPE) {
                     style = SOAPStyle.RPC;
-                else
+                } else {
                     style = SOAPStyle.DOCUMENT;
             }
         }
+        }
         info.modelPort.setStyle(style);
     }
 
     /* (non-Javadoc)
      * @see WSDLModelerBase#processSOAPOperation()

@@ -664,11 +673,10 @@
         if (info.hasOverloadedOperations) {
             operation.setUniqueName(uniqueOperationName);
         }
 
         info.operation = operation;
-        info.uniqueOperationName = uniqueOperationName;
 
         //attachment
         SOAPBody soapRequestBody = getSOAPRequestBody();
         if (soapRequestBody == null) {
             // the WSDL document is invalid

@@ -690,12 +698,13 @@
         return processLiteralSOAPOperation(StyleAndUse.DOC_LITERAL);
     }
 
     protected Operation processLiteralSOAPOperation(StyleAndUse styleAndUse) {
         //returns false if the operation name is not acceptable
-        if (!applyOperationNameCustomization())
+        if (!applyOperationNameCustomization()) {
             return null;
+        }
 
         boolean isRequestResponse = info.portTypeOperation.getStyle() == OperationStyle.REQUEST_RESPONSE;
         Message inputMessage = getInputMessage();
         Request request = new Request(inputMessage, errReceiver);
         request.setErrorReceiver(errReceiver);

@@ -722,41 +731,44 @@
             response = new Response(null, errReceiver);
         }
 
         //ignore operation if there are more than one root part
         if (!validateMimeParts(getMimeParts(info.bindingOperation.getInput())) ||
-                !validateMimeParts(getMimeParts(info.bindingOperation.getOutput())))
+                !validateMimeParts(getMimeParts(info.bindingOperation.getOutput()))) {
             return null;
-
+        }
 
         if (!validateBodyParts(info.bindingOperation)) {
             // BP 1.1
             // R2204   A document-literal binding in a DESCRIPTION MUST refer, in each of its soapbind:body element(s),
             // only to wsdl:part element(s) that have been defined using the element attribute.
 
             // R2203   An rpc-literal binding in a DESCRIPTION MUST refer, in its soapbind:body element(s),
             // only to wsdNl:part element(s) that have been defined using the type attribute.
-            if (isOperationDocumentLiteral(styleAndUse))
-                if (options.isExtensionMode())
+            if (isOperationDocumentLiteral(styleAndUse)) {
+                if (options.isExtensionMode()) {
                     warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_TYPE_MESSAGE_PART(info.portTypeOperation.getName()));
-                else
+                } else {
                     error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_DOCLITOPERATION(info.portTypeOperation.getName()));
-            else if (isOperationRpcLiteral(styleAndUse)) {
-                if (options.isExtensionMode())
+                }
+            } else if (isOperationRpcLiteral(styleAndUse)) {
+                if (options.isExtensionMode()) {
                     warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_CANNOT_HANDLE_ELEMENT_MESSAGE_PART(info.portTypeOperation.getName()));
-                else
+                } else {
                     error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_RPCLITOPERATION(info.portTypeOperation.getName()));
             }
+            }
             return null;
         }
 
         // Process parameterOrder and get the parameterList
         List<MessagePart> parameterList = getParameterOrder();
 
         //binding is invalid in the wsdl, ignore the operation.
-        if (!setMessagePartsBinding(styleAndUse))
+        if (!setMessagePartsBinding(styleAndUse)) {
             return null;
+        }
 
         List<Parameter> params = null;
         boolean unwrappable = isUnwrappable();
         info.operation.setWrapped(unwrappable);
         if (isOperationDocumentLiteral(styleAndUse)) {

@@ -900,17 +912,19 @@
         return info.operation;
     }
 
 
     private boolean validateParameterName(List<Parameter> params) {
-        if (options.isExtensionMode())
+        if (options.isExtensionMode()) {
             return true;
+        }
 
         Message msg = getInputMessage();
         for (Parameter param : params) {
-            if (param.isOUT())
+            if (param.isOUT()) {
                 continue;
+            }
             if (param.getCustomName() != null) {
                 if (Names.isJavaReservedWord(param.getCustomName())) {
                     error(param.getEntity(), ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOM_NAME(info.operation.getName(), param.getCustomName()));
                     return false;
                 }

@@ -933,30 +947,33 @@
 
         boolean isRequestResponse = info.portTypeOperation.getStyle() == OperationStyle.REQUEST_RESPONSE;
         if (isRequestResponse) {
             msg = getOutputMessage();
             for (Parameter param : params) {
-                if (param.isIN())
+                if (param.isIN()) {
                     continue;
+                }
                 if (param.getCustomName() != null) {
                     if (Names.isJavaReservedWord(param.getCustomName())) {
                         error(param.getEntity(), ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOM_NAME(info.operation.getName(), param.getCustomName()));
                         return false;
                     }
                     return true;
                 }
                 //process doclit wrapper style
                 if (param.isEmbedded() && !(param.getBlock().getType() instanceof RpcLitStructure)) {
-                    if (param.isReturn())
+                    if (param.isReturn()) {
                         continue;
+                    }
                     if (!param.getName().equals("return") && Names.isJavaReservedWord(param.getName())) {
                         error(param.getEntity(), ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_WRAPPER_STYLE(info.operation.getName(), param.getName(), param.getBlock().getName()));
                         return false;
                     }
                 } else {
-                    if (param.isReturn())
+                    if (param.isReturn()) {
                         continue;
+                    }
 
                     //non-wrapper style and rpclit
                     if (Names.isJavaReservedWord(param.getName())) {
                         error(param.getEntity(), ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_NON_WRAPPER_STYLE(info.operation.getName(), msg.getName(), param.getName()));
                         return false;

@@ -970,87 +987,97 @@
 
     private boolean enableMimeContent() {
         //first we look at binding operation
         JAXWSBinding jaxwsCustomization = (JAXWSBinding) getExtensionOfType(info.bindingOperation, JAXWSBinding.class);
         Boolean mimeContentMapping = (jaxwsCustomization != null) ? jaxwsCustomization.isEnableMimeContentMapping() : null;
-        if (mimeContentMapping != null)
+        if (mimeContentMapping != null) {
             return mimeContentMapping;
+        }
 
         //then in wsdl:binding
         Binding binding = info.port.resolveBinding(info.document);
         jaxwsCustomization = (JAXWSBinding) getExtensionOfType(binding, JAXWSBinding.class);
         mimeContentMapping = (jaxwsCustomization != null) ? jaxwsCustomization.isEnableMimeContentMapping() : null;
-        if (mimeContentMapping != null)
+        if (mimeContentMapping != null) {
             return mimeContentMapping;
+        }
 
         //at last look in wsdl:definitions
         jaxwsCustomization = (JAXWSBinding) getExtensionOfType(info.document.getDefinitions(), JAXWSBinding.class);
         mimeContentMapping = (jaxwsCustomization != null) ? jaxwsCustomization.isEnableMimeContentMapping() : null;
-        if (mimeContentMapping != null)
+        if (mimeContentMapping != null) {
             return mimeContentMapping;
+        }
         return false;
     }
 
     private boolean applyOperationNameCustomization() {
         JAXWSBinding jaxwsCustomization = (JAXWSBinding) getExtensionOfType(info.portTypeOperation, JAXWSBinding.class);
         String operationName = (jaxwsCustomization != null) ? ((jaxwsCustomization.getMethodName() != null) ? jaxwsCustomization.getMethodName().getName() : null) : null;
         if (operationName != null) {
             if (Names.isJavaReservedWord(operationName)) {
-                if (options.isExtensionMode())
+                if (options.isExtensionMode()) {
                     warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(info.operation.getName(), operationName));
-                else
+                } else {
                     error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(info.operation.getName(), operationName));
+                }
                 return false;
             }
 
             info.operation.setCustomizedName(operationName);
         }
 
         if (Names.isJavaReservedWord(info.operation.getJavaMethodName())) {
-            if (options.isExtensionMode())
+            if (options.isExtensionMode()) {
                 warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(info.operation.getName()));
-            else
+            } else {
                 error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(info.operation.getName()));
+            }
             return false;
         }
         return true;
     }
 
     protected String getAsyncOperationName(Operation operation) {
         String name = operation.getCustomizedName();
-        if (name == null)
+        if (name == null) {
             name = operation.getUniqueName();
+        }
         return name;
     }
 
     /**
      * @param styleAndUse
      */
     private void addAsyncOperations(Operation syncOperation, StyleAndUse styleAndUse) {
         Operation operation = createAsyncOperation(syncOperation, styleAndUse, AsyncOperationType.POLLING);
-        if (operation != null)
+        if (operation != null) {
             info.modelPort.addOperation(operation);
+        }
 
         operation = createAsyncOperation(syncOperation, styleAndUse, AsyncOperationType.CALLBACK);
-        if (operation != null)
+        if (operation != null) {
             info.modelPort.addOperation(operation);
     }
+    }
 
     private Operation createAsyncOperation(Operation syncOperation, StyleAndUse styleAndUse, AsyncOperationType asyncType) {
         boolean isRequestResponse = info.portTypeOperation.getStyle() == OperationStyle.REQUEST_RESPONSE;
-        if (!isRequestResponse)
+        if (!isRequestResponse) {
             return null;
+        }
 
         //create async operations
         AsyncOperation operation = new AsyncOperation(info.operation, info.bindingOperation);
 
         //creation the async operation name: operationName+Async or customized name
         //operation.setName(new QName(operation.getName().getNamespaceURI(), getAsyncOperationName(info.portTypeOperation, operation)));
-        if (asyncType.equals(AsyncOperationType.CALLBACK))
+        if (asyncType.equals(AsyncOperationType.CALLBACK)) {
             operation.setUniqueName(info.operation.getUniqueName() + "_async_callback");
-        else if (asyncType.equals(AsyncOperationType.POLLING))
+        } else if (asyncType.equals(AsyncOperationType.POLLING)) {
             operation.setUniqueName(info.operation.getUniqueName() + "_async_polling");
+        }
 
         setDocumentationIfPresent(
                 operation,
                 info.portTypeOperation.getDocumentation());
 

@@ -1147,11 +1174,11 @@
             }
         } else {
             //create response bean
             String nspace = "";
             QName responseBeanName = new QName(nspace, getAsyncOperationName(info.operation) + "Response");
-            JAXBType responseBeanType = jaxbModelBuilder.getJAXBType(responseBeanName);
+            JAXBType responseBeanType = getJAXBModelBuilder().getJAXBType(responseBeanName);
             if (responseBeanType == null) {
                 error(info.operation.getEntity(), ModelerMessages.WSDLMODELER_RESPONSEBEAN_NOTFOUND(info.operation.getName()));
             }
             operation.setResponseBean(responseBeanType);
         }

@@ -1164,24 +1191,23 @@
         respParam.setParameterIndex(-1);
         response.addParameter(respParam);
         operation.setProperty(WSDL_RESULT_PARAMETER, respParam.getName());
 
 
-        List<String> definitiveParameterList = new ArrayList<String>();
         int parameterOrderPosition = 0;
         for (String name : parameterList) {
             Parameter inParameter = ModelerUtils.getParameter(name, inParameters);
             if (inParameter == null) {
-                if (options.isExtensionMode())
+                if (options.isExtensionMode()) {
                     warning(info.operation.getEntity(), ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_PART_NOT_FOUND(info.operation.getName().getLocalPart(), name));
-                else
+                } else {
                     error(info.operation.getEntity(), ModelerMessages.WSDLMODELER_ERROR_PART_NOT_FOUND(info.operation.getName().getLocalPart(), name));
+                }
                 return null;
             }
             request.addParameter(inParameter);
             inParameter.setParameterIndex(parameterOrderPosition);
-            definitiveParameterList.add(name);
             parameterOrderPosition++;
         }
 
         operation.setResponse(response);
 

@@ -1201,29 +1227,31 @@
     protected boolean isAsync(com.sun.tools.internal.ws.wsdl.document.PortType portType, com.sun.tools.internal.ws.wsdl.document.Operation wsdlOperation) {
         //First look into wsdl:operation
         JAXWSBinding jaxwsCustomization = (JAXWSBinding) getExtensionOfType(wsdlOperation, JAXWSBinding.class);
         Boolean isAsync = (jaxwsCustomization != null) ? jaxwsCustomization.isEnableAsyncMapping() : null;
 
-        if (isAsync != null)
+        if (isAsync != null) {
             return isAsync;
+        }
 
         // then into wsdl:portType
-        QName portTypeName = new QName(portType.getDefining().getTargetNamespaceURI(), portType.getName());
         jaxwsCustomization = (JAXWSBinding) getExtensionOfType(portType, JAXWSBinding.class);
         isAsync = (jaxwsCustomization != null) ? jaxwsCustomization.isEnableAsyncMapping() : null;
-        if (isAsync != null)
+        if (isAsync != null) {
             return isAsync;
+        }
 
         //then wsdl:definitions
         jaxwsCustomization = (JAXWSBinding) getExtensionOfType(document.getDefinitions(), JAXWSBinding.class);
         isAsync = (jaxwsCustomization != null) ? jaxwsCustomization.isEnableAsyncMapping() : null;
-        if (isAsync != null)
+        if (isAsync != null) {
             return isAsync;
+        }
         return false;
     }
 
-    protected void handleLiteralSOAPHeaders(Request request, Response response, Iterator headerParts, Set duplicateNames, List<String> definitiveParameterList, boolean processRequest) {
+    protected void handleLiteralSOAPHeaders(Request request, Response response, Iterator headerParts, Set duplicateNames, @NotNull List<String> definitiveParameterList, boolean processRequest) {
         QName headerName;
         Block headerBlock;
         JAXBType jaxbType;
         int parameterOrderPosition = definitiveParameterList.size();
         while (headerParts.hasNext()) {

@@ -1246,18 +1274,15 @@
             }
 
             Parameter parameter = ModelerUtils.createParameter(part.getName(), jaxbType, headerBlock);
             parameter.setParameterIndex(parameterOrderPosition);
             setCustomizedParameterName(info.bindingOperation, headerMessage, part, parameter, false);
-            if (processRequest && definitiveParameterList != null) {
+            if (processRequest) {
                 request.addParameter(parameter);
                 definitiveParameterList.add(parameter.getName());
             } else {
-                if (definitiveParameterList != null) {
-                    for (Iterator iterInParams = definitiveParameterList.iterator(); iterInParams.hasNext();) {
-                        String inParamName =
-                                (String) iterInParams.next();
+                for (String inParamName : definitiveParameterList) {
                         if (inParamName.equals(parameter.getName())) {
                             Parameter inParam = request.getParameterByName(inParamName);
                             parameter.setLinkedParameter(inParam);
                             inParam.setLinkedParameter(parameter);
                             //its in/out parameter, input and output parameter have the same order position.

@@ -1265,11 +1290,10 @@
                         }
                     }
                     if (!definitiveParameterList.contains(parameter.getName())) {
                         definitiveParameterList.add(parameter.getName());
                     }
-                }
                 response.addParameter(parameter);
             }
             parameterOrderPosition++;
         }
 

@@ -1309,11 +1333,10 @@
             // wsdl:fault message name is used to create the java exception name later on
             String faultName = getFaultClassName(portTypeFault);
             Fault fault = new Fault(faultName, portTypeFault);
             fault.setWsdlFaultName(portTypeFault.getName());
             setDocumentationIfPresent(fault, portTypeFault.getDocumentation());
-            String faultNamespaceURI = null;
             if (bindingFault != null) {
                 //get the soapbind:fault from wsdl:fault in the binding
                 SOAPFault soapFault = (SOAPFault) getExtensionOfType(bindingFault, SOAPFault.class);
 
                 // The WSDL document is invalid, can't have wsdl:fault without soapbind:fault

@@ -1326,14 +1349,15 @@
                     }
                 }
 
                 //the soapbind:fault must have use="literal" or no use attribute, in that case its assumed "literal"
                 if (!soapFault.isLiteral()) {
-                    if (options.isExtensionMode())
+                    if (options.isExtensionMode()) {
                         warning(soapFault, ModelerMessages.WSDLMODELER_WARNING_IGNORING_FAULT_NOT_LITERAL(bindingFault.getName(), info.bindingOperation.getName()));
-                    else
+                    } else {
                         error(soapFault, ModelerMessages.WSDLMODELER_INVALID_OPERATION_FAULT_NOT_LITERAL(bindingFault.getName(), info.bindingOperation.getName()));
+                    }
                     continue;
                 }
 
                 // the soapFault name must be present
                 if (soapFault.getName() == null) {

@@ -1342,14 +1366,10 @@
                     warning(soapFault, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_WRONG_SOAP_FAULT_NAME(soapFault.getName(), bindingFault.getName(), info.bindingOperation.getName()));
                 } else if (soapFault.getNamespace() != null) {
                     warning(soapFault, ModelerMessages.WSDLMODELER_WARNING_R_2716_R_2726("soapbind:fault", soapFault.getName()));
                 }
 
-                faultNamespaceURI = soapFault.getNamespace();
-            }
-            if (faultNamespaceURI == null) {
-                faultNamespaceURI = portTypeFault.getMessage().getNamespaceURI();
             }
 
             com.sun.tools.internal.ws.wsdl.document.Message faultMessage = portTypeFault.resolveMessage(info.document);
             Iterator iter2 = faultMessage.parts();
             if (!iter2.hasNext()) {

@@ -1369,24 +1389,29 @@
                 // the WSDL document is invalid
                 error(faultMessage, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_MESSAGE_HAS_MORE_THAN_ONE_PART(portTypeFault.getName(), faultMessage.getName()));
             }
 
             if (faultPart.getDescriptorKind() != SchemaKinds.XSD_ELEMENT) {
+                if (options.isExtensionMode()) {
+                    warning(faultPart, ModelerMessages.WSDLMODELER_INVALID_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(faultMessage.getName(), faultPart.getName()));
+                } else {
                 error(faultPart, ModelerMessages.WSDLMODELER_INVALID_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(faultMessage.getName(), faultPart.getName()));
             }
+            }
 
             JAXBType jaxbType = getJAXBType(faultPart);
 
             fault.setElementName(faultPart.getDescriptor());
             fault.setJavaMemberName(Names.getExceptionClassMemberName());
 
             Block faultBlock = new Block(faultQName, jaxbType, faultPart);
             fault.setBlock(faultBlock);
             //createParentFault(fault);
             //createSubfaults(fault);
-            if (!response.getFaultBlocksMap().containsKey(faultBlock.getName()))
+            if (!response.getFaultBlocksMap().containsKey(faultBlock.getName())) {
                 response.addFaultBlock(faultBlock);
+            }
             info.operation.addFault(fault);
         }
     }
 
     private String getFaultClassName(com.sun.tools.internal.ws.wsdl.document.Fault portTypeFault) {

@@ -1401,25 +1426,26 @@
     }
 
     protected boolean setMessagePartsBinding(StyleAndUse styleAndUse) {
         SOAPBody inBody = getSOAPRequestBody();
         Message inMessage = getInputMessage();
-        if (!setMessagePartsBinding(inBody, inMessage, styleAndUse, true))
+        if (!setMessagePartsBinding(inBody, inMessage, styleAndUse, true)) {
             return false;
+        }
 
         if (isRequestResponse()) {
             SOAPBody outBody = getSOAPResponseBody();
             Message outMessage = getOutputMessage();
-            if (!setMessagePartsBinding(outBody, outMessage, styleAndUse, false))
+            if (!setMessagePartsBinding(outBody, outMessage, styleAndUse, false)) {
                 return false;
         }
+        }
         return true;
     }
 
     //returns false if the wsdl is invalid and operation should be ignored
     protected boolean setMessagePartsBinding(SOAPBody body, Message message, StyleAndUse styleAndUse, boolean isInput) {
-        List<MessagePart> parts = new ArrayList<MessagePart>();
 
         //get Mime parts
         List<MessagePart> mimeParts;
         List<MessagePart> headerParts;
         List<MessagePart> bodyParts = getBodyParts(body, message);

@@ -1446,51 +1472,51 @@
                 //Its a safe assumption that the parts in the message not belonging to header or mime will
                 // belong to the body?
                 if (mimeParts.contains(mPart) || headerParts.contains(mPart) || boundToFault(mPart.getName())) {
                     //throw error that a part cant be bound multiple times, not ignoring operation, if there
                     //is conflict it will fail latter
-                    if (options.isExtensionMode())
+                    if (options.isExtensionMode()) {
                         warning(mPart, ModelerMessages.WSDLMODELER_WARNING_BINDING_OPERATION_MULTIPLE_PART_BINDING(info.bindingOperation.getName(), mPart.getName()));
-                    else
+                    } else {
                         error(mPart, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_MULTIPLE_PART_BINDING(info.bindingOperation.getName(), mPart.getName()));
                 }
+                }
                 bodyParts.add(mPart);
             }
         }
 
         //now build the final parts list with header, mime parts and body parts
         for (Iterator iter = message.parts(); iter.hasNext();) {
             MessagePart mPart = (MessagePart) iter.next();
             if (mimeParts.contains(mPart)) {
                 mPart.setBindingExtensibilityElementKind(MessagePart.WSDL_MIME_BINDING);
-                parts.add(mPart);
             } else if (headerParts.contains(mPart)) {
                 mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_HEADER_BINDING);
-                parts.add(mPart);
             } else if (bodyParts.contains(mPart)) {
                 mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);
-                parts.add(mPart);
             } else {
                 mPart.setBindingExtensibilityElementKind(MessagePart.PART_NOT_BOUNDED);
             }
         }
 
         if (isOperationDocumentLiteral(styleAndUse) && bodyParts.size() > 1) {
-            if (options.isExtensionMode())
+            if (options.isExtensionMode()) {
                 warning(message, ModelerMessages.WSDLMODELER_WARNING_OPERATION_MORE_THAN_ONE_PART_IN_MESSAGE(info.portTypeOperation.getName()));
-            else
+            } else {
                 error(message, ModelerMessages.WSDLMODELER_INVALID_OPERATION_MORE_THAN_ONE_PART_IN_MESSAGE(info.portTypeOperation.getName()));
+            }
             return false;
         }
         return true;
     }
 
     private boolean boundToFault(String partName) {
         for (BindingFault bindingFault : info.bindingOperation.faults()) {
-            if (partName.equals(bindingFault.getName()))
+            if (partName.equals(bindingFault.getName())) {
                 return true;
         }
+        }
         return false;
     }
 
     //get MessagePart(s) referenced by parts attribute of soap:body element
     private List<MessagePart> getBodyParts(SOAPBody body, Message message) {

@@ -1516,12 +1542,13 @@
         List<MessagePart> headerParts = new ArrayList<MessagePart>();
         List<MessagePart> parts = message.getParts();
         List<MessagePart> headers = getHeaderParts(bindingOperation, isInput);
 
         for(MessagePart part: headers){
-            if(parts.contains(part))
+            if (parts.contains(part)) {
                 continue;
+            }
             headerParts.add(part);
         }
         return headerParts;
     }
 

@@ -1540,20 +1567,23 @@
 
     private Message getHeaderMessage(MessagePart part, TWSDLExtensible ext) {
         Iterator<SOAPHeader> headers = getHeaderExtensions(ext).iterator();
         while (headers.hasNext()) {
             SOAPHeader header = headers.next();
-            if (!header.isLiteral())
+            if (!header.isLiteral()) {
                 continue;
+            }
             com.sun.tools.internal.ws.wsdl.document.Message headerMessage = findMessage(header.getMessage(), document);
-            if (headerMessage == null)
+            if (headerMessage == null) {
                 continue;
+            }
 
             MessagePart headerPart = headerMessage.getPart(header.getPart());
-            if (headerPart == part)
+            if (headerPart == part) {
                 return headerMessage;
         }
+        }
         return null;
     }
 
     private List<MessagePart> getHeaderParts(BindingOperation bindingOperation, boolean isInput) {
         TWSDLExtensible ext;

@@ -1582,12 +1612,16 @@
             MessagePart part = headerMessage.getPart(header.getPart());
             if (part == null) {
                 error(header, ModelerMessages.WSDLMODELER_INVALID_HEADER_NOT_FOUND(header.getPart(), bindingOperation.getName()));
             }
             if (part.getDescriptorKind() != SchemaKinds.XSD_ELEMENT) {
+                if (options.isExtensionMode()) {
+                    warning(part, ModelerMessages.WSDLMODELER_INVALID_HEADER_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(part.getName(), bindingOperation.getName()));
+                } else {
                 error(part, ModelerMessages.WSDLMODELER_INVALID_HEADER_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(part.getName(), bindingOperation.getName()));
             }
+            }
             part.setBindingExtensibilityElementKind(MessagePart.SOAP_HEADER_BINDING);
             parts.add(part);
         }
         return parts;
     }

@@ -1606,11 +1640,11 @@
      */
     private JAXBType getJAXBType(MessagePart part) {
         JAXBType type;
         QName name = part.getDescriptor();
         if (part.getDescriptorKind().equals(SchemaKinds.XSD_ELEMENT)) {
-            type = jaxbModelBuilder.getJAXBType(name);
+            type = getJAXBModelBuilder().getJAXBType(name);
             if(type == null){
                 error(part, ModelerMessages.WSDLMODELER_JAXB_JAVATYPE_NOTFOUND(name, part.getName()));
             }
         } else {
             S2JJAXBModel jaxbModel = getJAXBModelBuilder().getJAXBModel().getS2JJAXBModel();

@@ -1623,12 +1657,13 @@
         }
         return type;
     }
 
     private List<Parameter> getDoclitParameters(Request req, Response res, List<MessagePart> parameterList) {
-        if (parameterList.size() == 0)
+        if (parameterList.isEmpty()) {
             return new ArrayList<Parameter>();
+        }
         List<Parameter> params = new ArrayList<Parameter>();
         Message inMsg = getInputMessage();
         Message outMsg = getOutputMessage();
         boolean unwrappable = isUnwrappable();
         List<Parameter> outParams = null;

@@ -1649,19 +1684,18 @@
                     } else if (part.isINOUT()) {
                         req.addBodyBlock(block);
                         res.addBodyBlock(block);
                     }
                 } else if (ModelerUtils.isUnbound(part)) {
-                    if (part.isIN())
+                    if (part.isIN()) {
                         req.addUnboundBlock(block);
-                    else if (part.isOUT())
+                    } else if (part.isOUT()) {
                         res.addUnboundBlock(block);
-                    else if (part.isINOUT()) {
+                    } else if (part.isINOUT()) {
                         req.addUnboundBlock(block);
                         res.addUnboundBlock(block);
                     }
-
                 }
                 if (part.isIN() || part.isINOUT()) {
                     params = ModelerUtils.createUnwrappedParameters(jaxbStructType, block);
                     int index = 0;
                     Mode mode = part.isINOUT() ? Mode.INOUT : Mode.IN;

@@ -1754,14 +1788,15 @@
                     param.setParameterIndex(-1);
                 } else {
                     param.setParameterIndex(pIndex++);
                 }
 
-                if (part.isIN())
+                if (part.isIN()) {
                     setCustomizedParameterName(info.portTypeOperation, inMsg, part, param, false);
-                else if (outMsg != null)
+                } else if (outMsg != null) {
                     setCustomizedParameterName(info.portTypeOperation, outMsg, part, param, false);
+                }
 
                 params.add(param);
             }
         }
         if (unwrappable && (outParams != null)) {

@@ -1805,12 +1840,13 @@
         Message inMsg = getInputMessage();
         Message outMsg = getOutputMessage();
         S2JJAXBModel jaxbModel = ((RpcLitStructure) reqBlock.getType()).getJaxbModel().getS2JJAXBModel();
         List<Parameter> inParams = ModelerUtils.createRpcLitParameters(inMsg, reqBlock, jaxbModel, errReceiver);
         List<Parameter> outParams = null;
-        if (outMsg != null)
+        if (outMsg != null) {
             outParams = ModelerUtils.createRpcLitParameters(outMsg, resBlock, jaxbModel, errReceiver);
+        }
 
         //create parameters for header and mime parts
         int index = 0;
         for (MessagePart part : paramList) {
             Parameter param = null;

@@ -1833,16 +1869,17 @@
                     req.addHeaderBlock(headerBlock);
                     res.addHeaderBlock(headerBlock);
                 }
             } else if (ModelerUtils.isBoundToMimeContent(part)) {
                 List<MIMEContent> mimeContents;
-                if (part.isIN() || part.isINOUT())
+                if (part.isIN() || part.isINOUT()) {
                     mimeContents = getMimeContents(info.bindingOperation.getInput(),
                             getInputMessage(), part.getName());
-                else
+                } else {
                     mimeContents = getMimeContents(info.bindingOperation.getOutput(),
                             getOutputMessage(), part.getName());
+                }
 
                 JAXBType type = getAttachmentType(mimeContents, part);
                 //create Parameters in request or response
                 //Block mimeBlock = new Block(new QName(part.getName()), type);
                 Block mimeBlock = new Block(type.getName(), type, part);

@@ -1890,35 +1927,38 @@
                 param.setMode(part.getMode());
                 params.add(param);
             }
         }
         for (Parameter param : params) {
-            if (param.isIN())
+            if (param.isIN()) {
                 setCustomizedParameterName(info.portTypeOperation, inMsg, inMsg.getPart(param.getName()), param, false);
-            else if (outMsg != null)
+            } else if (outMsg != null) {
                 setCustomizedParameterName(info.portTypeOperation, outMsg, outMsg.getPart(param.getName()), param, false);
         }
+        }
         return params;
     }
 
     private List<Parameter> getRequestParameters(Request request, List<String> parameterList) {
         Message inputMessage = getInputMessage();
         //there is no input message, return zero parameters
-        if (inputMessage != null && !inputMessage.parts().hasNext())
+        if (inputMessage != null && !inputMessage.parts().hasNext()) {
             return new ArrayList<Parameter>();
+        }
 
         List<Parameter> inParameters = null;
         QName reqBodyName;
         Block reqBlock;
         JAXBType jaxbReqType;
         boolean unwrappable = isUnwrappable();
         boolean doneSOAPBody = false;
         //setup request parameters
         for (String inParamName : parameterList) {
             MessagePart part = inputMessage.getPart(inParamName);
-            if (part == null)
+            if (part == null) {
                 continue;
+            }
             reqBodyName = part.getDescriptor();
             jaxbReqType = getJAXBType(part);
             if (unwrappable) {
                 //So build body and header blocks and set to request and response
                 JAXBStructuredType jaxbRequestType = ModelerUtils.createJAXBStructureType(jaxbReqType);

@@ -1947,12 +1987,13 @@
                     reqBlock = new Block(jaxbReqType.getName(), jaxbReqType, part);
                     request.addAttachmentBlock(reqBlock);
                 } else if (ModelerUtils.isUnbound(part)) {
                     request.addUnboundBlock(reqBlock);
                 }
-                if (inParameters == null)
+                if (inParameters == null) {
                     inParameters = new ArrayList<Parameter>();
+                }
                 Parameter param = ModelerUtils.createParameter(part.getName(), jaxbReqType, reqBlock);
                 setCustomizedParameterName(info.portTypeOperation, inputMessage, part, param, false);
                 inParameters.add(param);
             }
         }

@@ -1964,29 +2005,33 @@
      * @param param
      * @param wrapperStyle TODO
      */
     private void setCustomizedParameterName(TWSDLExtensible extension, Message msg, MessagePart part, Parameter param, boolean wrapperStyle) {
         JAXWSBinding jaxwsBinding = (JAXWSBinding) getExtensionOfType(extension, JAXWSBinding.class);
-        if (jaxwsBinding == null)
+        if (jaxwsBinding == null) {
             return;
+        }
         String paramName = part.getName();
         QName elementName = part.getDescriptor();
-        if (wrapperStyle)
+        if (wrapperStyle) {
             elementName = param.getType().getName();
+        }
         String customName = jaxwsBinding.getParameterName(msg.getName(), paramName, elementName, wrapperStyle);
         if (customName != null && !customName.equals("")) {
             param.setCustomName(customName);
         }
     }
 
+    @Override
     protected boolean isConflictingPortClassName(String name) {
         return false;
     }
 
     protected boolean isUnwrappable() {
-        if (!getWrapperStyleCustomization())
+        if (!getWrapperStyleCustomization()) {
             return false;
+        }
 
         com.sun.tools.internal.ws.wsdl.document.Message inputMessage = getInputMessage();
         com.sun.tools.internal.ws.wsdl.document.Message outputMessage = getOutputMessage();
 
         // Wrapper style if the operation's input and output messages each contain

@@ -2004,18 +2049,20 @@
 
         // Wrapper style if the input message part refers to a global element declaration whose localname
         // is equal to the operation name
         // Wrapper style if the output message part refers to a global element declaration
         if ((inputPart != null && !inputPart.getDescriptor().getLocalPart().equals(operationName)) ||
-                (outputPart != null && outputPart.getDescriptorKind() != SchemaKinds.XSD_ELEMENT))
+                (outputPart != null && outputPart.getDescriptorKind() != SchemaKinds.XSD_ELEMENT)) {
             return false;
+        }
 
         //check to see if either input or output message part not bound to soapbing:body
         //in that case the operation is not wrapper style
         if (((inputPart != null) && (inputPart.getBindingExtensibilityElementKind() != MessagePart.SOAP_BODY_BINDING)) ||
-                ((outputPart != null) && (outputPart.getBindingExtensibilityElementKind() != MessagePart.SOAP_BODY_BINDING)))
+                ((outputPart != null) && (outputPart.getBindingExtensibilityElementKind() != MessagePart.SOAP_BODY_BINDING))) {
             return false;
+        }
 
         // Wrapper style if the elements referred to by the input and output message parts
         // (henceforth referred to as wrapper elements) are both complex types defined
         // using the xsd:sequence compositor
         // Wrapper style if the wrapper elements only contain child elements, they must not

@@ -2032,43 +2079,47 @@
             //if there are no output part (oneway), the operation can still be wrapper style
             if (outputPart == null) {
                 return inputWrappable;
             }
             JAXBType outputType = getJAXBType(outputPart);
-            if ((inputType != null) && (outputType != null))
+            if ((inputType != null) && (outputType != null)) {
                 return inputType.isUnwrappable() && outputType.isUnwrappable();
         }
+        }
 
         return false;
     }
 
     private boolean getWrapperStyleCustomization() {
         //first we look into wsdl:portType/wsdl:operation
         com.sun.tools.internal.ws.wsdl.document.Operation portTypeOperation = info.portTypeOperation;
         JAXWSBinding jaxwsBinding = (JAXWSBinding) getExtensionOfType(portTypeOperation, JAXWSBinding.class);
         if (jaxwsBinding != null) {
             Boolean isWrappable = jaxwsBinding.isEnableWrapperStyle();
-            if (isWrappable != null)
+            if (isWrappable != null) {
                 return isWrappable;
         }
+        }
 
         //then into wsdl:portType
         PortType portType = info.port.resolveBinding(document).resolvePortType(document);
         jaxwsBinding = (JAXWSBinding) getExtensionOfType(portType, JAXWSBinding.class);
         if (jaxwsBinding != null) {
             Boolean isWrappable = jaxwsBinding.isEnableWrapperStyle();
-            if (isWrappable != null)
+            if (isWrappable != null) {
                 return isWrappable;
         }
+        }
 
         //then wsdl:definitions
         jaxwsBinding = (JAXWSBinding) getExtensionOfType(document.getDefinitions(), JAXWSBinding.class);
         if (jaxwsBinding != null) {
             Boolean isWrappable = jaxwsBinding.isEnableWrapperStyle();
-            if (isWrappable != null)
+            if (isWrappable != null) {
                 return isWrappable;
         }
+        }
         return true;
     }
 
     /* (non-Javadoc)
      * @see WSDLModelerBase#isSingleInOutPart(Set, MessagePart)

@@ -2081,13 +2132,14 @@
                         SOAPOperation.class);
         if ((soapOperation != null) && (soapOperation.isDocument() || info.soapBinding.isDocument())) {
             Iterator iter = getInputMessage().parts();
             while (iter.hasNext()) {
                 MessagePart part = (MessagePart) iter.next();
-                if (outputPart.getName().equals(part.getName()) && outputPart.getDescriptor().equals(part.getDescriptor()))
+                if (outputPart.getName().equals(part.getName()) && outputPart.getDescriptor().equals(part.getDescriptor())) {
                     return true;
             }
+            }
         } else if (soapOperation != null && soapOperation.isRPC() || info.soapBinding.isRPC()) {
             com.sun.tools.internal.ws.wsdl.document.Message inputMessage = getInputMessage();
             if (inputParameterNames.contains(outputPart.getName())) {
                 if (inputMessage.getPart(outputPart.getName()).getDescriptor().equals(outputPart.getDescriptor())) {
                     return true;

@@ -2103,26 +2155,29 @@
         List<Parameter> parameters = ModelerUtils.createRpcLitParameters(message, block, jaxbModel, errReceiver);
 
         //create parameters for header and mime parts
         for (String paramName : parameterList) {
             MessagePart part = message.getPart(paramName);
-            if (part == null)
+            if (part == null) {
                 continue;
+            }
             if (ModelerUtils.isBoundToSOAPHeader(part)) {
-                if (parameters == null)
+                if (parameters == null) {
                     parameters = new ArrayList<Parameter>();
+                }
                 QName headerName = part.getDescriptor();
                 JAXBType jaxbType = getJAXBType(part);
                 Block headerBlock = new Block(headerName, jaxbType, part);
                 request.addHeaderBlock(headerBlock);
                 Parameter param = ModelerUtils.createParameter(part.getName(), jaxbType, headerBlock);
                 if (param != null) {
                     parameters.add(param);
                 }
             } else if (ModelerUtils.isBoundToMimeContent(part)) {
-                if (parameters == null)
+                if (parameters == null) {
                     parameters = new ArrayList<Parameter>();
+                }
                 List<MIMEContent> mimeContents = getMimeContents(info.bindingOperation.getInput(),
                         getInputMessage(), paramName);
 
                 JAXBType type = getAttachmentType(mimeContents, part);
                 //create Parameters in request or response

@@ -2132,12 +2187,13 @@
                 Parameter param = ModelerUtils.createParameter(part.getName(), type, mimeBlock);
                 if (param != null) {
                     parameters.add(param);
                 }
             } else if (ModelerUtils.isUnbound(part)) {
-                if (parameters == null)
+                if (parameters == null) {
                     parameters = new ArrayList<Parameter>();
+                }
                 QName name = part.getDescriptor();
                 JAXBType type = getJAXBType(part);
                 Block unboundBlock = new Block(name, type, part);
                 request.addUnboundBlock(unboundBlock);
                 Parameter param = ModelerUtils.createParameter(part.getName(), type, unboundBlock);

@@ -2184,14 +2240,12 @@
         } else if (part.getDescriptorKind() == SchemaKinds.XSD_ELEMENT) {
             typeAnno = getJAXBModelBuilder().getElementTypeAndAnn(desc);
             if(typeAnno == null){
                 error(part, ModelerMessages.WSDLMODELER_JAXB_JAVATYPE_NOTFOUND(part.getDescriptor(), part.getName()));
             }
-            for (Iterator mimeTypeIter = mimeTypes.iterator(); mimeTypeIter.hasNext();) {
-                String mimeType = (String) mimeTypeIter.next();
-                if ((!mimeType.equals("text/xml") &&
-                        !mimeType.equals("application/xml"))) {
+            for (String mimeType : mimeTypes) {
+                if ((!mimeType.equals("text/xml") && !mimeType.equals("application/xml"))) {
                     //According to AP 1.0,
                     //RZZZZ: In a DESCRIPTION, if a wsdl:part element refers to a
                     //global element declaration (via the element attribute of the wsdl:part
                     //element) then the value of the type attribute of a mime:content element
                     //that binds that part MUST be a content type suitable for carrying an

@@ -2208,28 +2262,28 @@
         return new JAXBType(desc, new JavaSimpleType(new JAXBTypeAndAnnotation(typeAnno, jt)),
                 null, getJAXBModelBuilder().getJAXBModel());
     }
 
     protected void buildJAXBModel(WSDLDocument wsdlDocument) {
-        JAXBModelBuilder jaxbModelBuilder = new JAXBModelBuilder(options, classNameCollector, forest, errReceiver);
+        JAXBModelBuilder tempJaxbModelBuilder = new JAXBModelBuilder(options, classNameCollector, forest, errReceiver);
         //set the java package where wsdl artifacts will be generated
         //if user provided package name  using -p switch (or package property on wsimport ant task)
         //ignore the package customization in the wsdl and schema bidnings
         //formce the -p option only in the first pass
         if (explicitDefaultPackage != null) {
-            jaxbModelBuilder.getJAXBSchemaCompiler().forcePackageName(options.defaultPackage);
+            tempJaxbModelBuilder.getJAXBSchemaCompiler().forcePackageName(options.defaultPackage);
         } else {
             options.defaultPackage = getJavaPackage();
         }
 
         //create pseudo schema for async operations(if any) response bean
         List<InputSource> schemas = PseudoSchemaBuilder.build(this, options, errReceiver);
         for (InputSource schema : schemas) {
-            jaxbModelBuilder.getJAXBSchemaCompiler().parseSchema(schema);
+            tempJaxbModelBuilder.getJAXBSchemaCompiler().parseSchema(schema);
         }
-        jaxbModelBuilder.bind();
-        this.jaxbModelBuilder = jaxbModelBuilder;
+        tempJaxbModelBuilder.bind();
+        this.jaxbModelBuilder = tempJaxbModelBuilder;
     }
 
     protected String getJavaPackage() {
         String jaxwsPackage = null;
         JAXWSBinding jaxwsCustomization = (JAXWSBinding) getExtensionOfType(document.getDefinitions(), JAXWSBinding.class);

@@ -2268,26 +2322,28 @@
                     operation,
                     intf);
 
             for (JavaParameter jParam : operation.getJavaMethod().getParametersList()) {
                 Parameter param = jParam.getParameter();
-                if (param.getCustomName() != null)
+                if (param.getCustomName() != null) {
                     jParam.setName(param.getCustomName());
             }
         }
+        }
 
         port.setJavaInterface(intf);
     }
 
     protected String getServiceInterfaceName(QName serviceQName, com.sun.tools.internal.ws.wsdl.document.Service wsdlService) {
         String serviceName = wsdlService.getName();
         JAXWSBinding jaxwsCust = (JAXWSBinding) getExtensionOfType(wsdlService, JAXWSBinding.class);
         if (jaxwsCust != null && jaxwsCust.getClassName() != null) {
             CustomName name = jaxwsCust.getClassName();
-            if (name != null && !name.getName().equals(""))
+            if (name != null && !name.getName().equals("")) {
                 return makePackageQualified(name.getName());
         }
+        }
         return makePackageQualified(BindingHelper.mangleNameToClassName(serviceName));
     }
 
     protected String getJavaNameOfSEI(Port port) {
         QName portTypeName =

@@ -2321,32 +2377,17 @@
 
     private void createJavaMethodForAsyncOperation(Port port, Operation operation,
                                                    JavaInterface intf) {
         String candidateName = getJavaNameForOperation(operation);
         JavaMethod method = new JavaMethod(candidateName, options, errReceiver);
-        Request request = operation.getRequest();
-        Iterator requestBodyBlocks = request.getBodyBlocks();
-        Block requestBlock =
-                (requestBodyBlocks.hasNext()
-                        ? request.getBodyBlocks().next()
-                        : null);
 
+        assert (operation.getRequest() != null);
         Response response = operation.getResponse();
-        Iterator responseBodyBlocks = null;
-        Block responseBlock;
-        if (response != null) {
-            responseBodyBlocks = response.getBodyBlocks();
-            responseBlock =
-                    responseBodyBlocks.hasNext()
-                            ? response.getBodyBlocks().next()
-                            : null;
-        }
 
         // build a signature of the form "opName%arg1type%arg2type%...%argntype so that we
         // detect overloading conflicts in the generated java interface/classes
-        String signature = candidateName;
-        for (Iterator iter = request.getParameters(); iter.hasNext();) {
+        for (Iterator iter = operation.getRequest().getParameters(); iter.hasNext();) {
             Parameter parameter = (Parameter) iter.next();
 
             if (parameter.getJavaParameter() != null) {
                 error(operation.getEntity(), ModelerMessages.WSDLMODELER_INVALID_OPERATION(operation.getName().getLocalPart()));
             }

@@ -2362,11 +2403,10 @@
                 javaParameter.setHolderName(javax.xml.ws.Holder.class.getName());
             }
             method.addParameter(javaParameter);
             parameter.setJavaParameter(javaParameter);
 
-            signature += "%" + parameterType.getName();
         }
 
         if (response != null) {
             String resultParameterName =
                     (String) operation.getProperty(WSDL_RESULT_PARAMETER);

@@ -2388,11 +2428,10 @@
             createJavaMethodForAsyncOperation(port, operation, intf);
             return;
         }
         String candidateName = getJavaNameForOperation(operation);
         JavaMethod method = new JavaMethod(candidateName, options, errReceiver);
-        Request request = operation.getRequest();
         Parameter returnParam = (Parameter) operation.getProperty(WSDL_RESULT_PARAMETER);
         if (returnParam != null) {
             JavaType parameterType = returnParam.getType().getJavaType();
             method.setReturnType(parameterType);
         } else {

@@ -2512,11 +2551,11 @@
 
 
     protected List<MessagePart> getParameterOrder() {
         List<MessagePart> params = new ArrayList<MessagePart>();
         String parameterOrder = info.portTypeOperation.getParameterOrder();
-        java.util.List<String> parameterList = new ArrayList<String>();
+        java.util.List<String> parameterList;
         boolean parameterOrderPresent = false;
         if ((parameterOrder != null) && !(parameterOrder.trim().equals(""))) {
             parameterList = XmlUtil.parseTokenList(parameterOrder);
             parameterOrderPresent = true;
         } else {

@@ -2634,11 +2673,10 @@
                 return params;
 
             }
             //parameterOrder attribute is not valid, we ignore it
             warning(info.operation.getEntity(), ModelerMessages.WSDLMODELER_INVALID_PARAMETER_ORDER_INVALID_PARAMETER_ORDER(info.operation.getName().getLocalPart()));
-            parameterOrderPresent = false;
             parameterList.clear();
         }
 
         List<MessagePart> outParts = new ArrayList<MessagePart>();
 

@@ -2658,12 +2696,13 @@
                 outParts.add(part);
             }
 
             //append the out parts to the parameterList
             for (MessagePart part : outParts) {
-                if (outParts.size() == 1)
+                if (outParts.size() == 1) {
                     part.setReturn(true);
+                }
                 params.add(part);
             }
         }
         return params;
     }

@@ -2676,10 +2715,11 @@
     protected String getClassName(Port port, String suffix) {
         String prefix = BindingHelper.mangleNameToClassName((port.getName().getLocalPart()));
         return options.defaultPackage + "." + prefix + suffix;
     }
 
+    @Override
     protected boolean isConflictingServiceClassName(String name) {
         return conflictsWithSEIClass(name) || conflictsWithJAXBClass(name) || conflictsWithExceptionClass(name);
     }
 
     private boolean conflictsWithSEIClass(String name) {

@@ -2695,10 +2735,11 @@
     private boolean conflictsWithExceptionClass(String name) {
         Set<String> exceptionNames = classNameCollector.getExceptionClassNames();
         return exceptionNames != null && exceptionNames.contains(name);
     }
 
+    @Override
     protected boolean isConflictingExceptionClassName(String name) {
         return conflictsWithSEIClass(name) || conflictsWithJAXBClass(name);
     }
 
     protected JAXBModelBuilder getJAXBModelBuilder() {

@@ -2708,19 +2749,21 @@
     protected boolean validateWSDLBindingStyle(Binding binding) {
         SOAPBinding soapBinding =
                 (SOAPBinding) getExtensionOfType(binding, SOAPBinding.class);
 
         //dont process the binding
-        if (soapBinding == null)
-            soapBinding =
-                    (SOAPBinding) getExtensionOfType(binding, SOAP12Binding.class);
-        if (soapBinding == null)
+        if (soapBinding == null) {
+            soapBinding = (SOAPBinding) getExtensionOfType(binding, SOAP12Binding.class);
+        }
+        if (soapBinding == null) {
             return false;
+        }
 
         //if soapbind:binding has no style attribute, the default is DOCUMENT
-        if (soapBinding.getStyle() == null)
+        if (soapBinding.getStyle() == null) {
             soapBinding.setStyle(SOAPStyle.DOCUMENT);
+        }
 
         SOAPStyle opStyle = soapBinding.getStyle();
         for (Iterator iter = binding.operations(); iter.hasNext();) {
             BindingOperation bindingOperation =
                     (BindingOperation) iter.next();

@@ -2728,14 +2771,15 @@
                     (SOAPOperation) getExtensionOfType(bindingOperation,
                             SOAPOperation.class);
             if (soapOperation != null) {
                 SOAPStyle currOpStyle = (soapOperation.getStyle() != null) ? soapOperation.getStyle() : soapBinding.getStyle();
                 //dont check for the first operation
-                if (!currOpStyle.equals(opStyle))
+                if (!currOpStyle.equals(opStyle)) {
                     return false;
             }
         }
+        }
         return true;
     }
 
     /**
      * @param port