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

Print this page


   1 /*
   2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.tools.internal.ws.processor.modeler.wsdl;
  27 
  28 import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
  29 import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
  30 import com.sun.tools.internal.ws.processor.generator.Names;
  31 import com.sun.tools.internal.ws.processor.model.Fault;
  32 import com.sun.tools.internal.ws.processor.model.Operation;
  33 import com.sun.tools.internal.ws.processor.model.Port;
  34 import com.sun.tools.internal.ws.processor.model.java.JavaException;
  35 import com.sun.tools.internal.ws.processor.modeler.JavaSimpleTypeCreator;
  36 import com.sun.tools.internal.ws.processor.modeler.Modeler;
  37 import com.sun.tools.internal.ws.resources.ModelerMessages;
  38 import com.sun.tools.internal.ws.wscompile.AbortException;
  39 import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
  40 import com.sun.tools.internal.ws.wscompile.ErrorReceiverFilter;
  41 import com.sun.tools.internal.ws.wscompile.WsimportOptions;
  42 import com.sun.tools.internal.ws.wsdl.document.*;
  43 import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBinding;
  44 import com.sun.tools.internal.ws.wsdl.document.mime.MIMEContent;
  45 import com.sun.tools.internal.ws.wsdl.document.mime.MIMEMultipartRelated;
  46 import com.sun.tools.internal.ws.wsdl.document.mime.MIMEPart;
  47 import com.sun.tools.internal.ws.wsdl.document.schema.SchemaKinds;
  48 import com.sun.tools.internal.ws.wsdl.document.soap.*;
  49 import com.sun.tools.internal.ws.wsdl.framework.Entity;
  50 import com.sun.tools.internal.ws.wsdl.framework.GloballyKnown;
  51 import com.sun.tools.internal.ws.wsdl.framework.NoSuchEntityException;
  52 import com.sun.tools.internal.ws.wsdl.parser.DOMForest;
  53 import com.sun.tools.internal.ws.wsdl.parser.WSDLParser;
  54 import com.sun.tools.internal.ws.wsdl.parser.MetadataFinder;
  55 import com.sun.xml.internal.ws.spi.db.BindingContext;
  56 import com.sun.xml.internal.ws.spi.db.BindingHelper;
  57 
  58 import org.xml.sax.helpers.LocatorImpl;
  59 
  60 import javax.xml.namespace.QName;
  61 import java.util.*;
  62 
  63 /**
  64  *
  65  * @author WS Development Team
  66  *
  67  * Base class for WSDL->Model classes.
  68  */
  69 public abstract class WSDLModelerBase implements Modeler {
  70     protected final ErrorReceiverFilter errReceiver;
  71     protected final WsimportOptions options;
  72     protected MetadataFinder forest;
  73 
  74 
  75     public WSDLModelerBase(WsimportOptions options, ErrorReceiver receiver, MetadataFinder forest) {
  76         this.options = options;
  77         this.errReceiver = new ErrorReceiverFilter(receiver);
  78         this.forest = forest;
  79     }
  80 
  81     /**
  82      *
  83      * @param port
  84      * @param wsdlPort
  85      */
  86     protected void applyPortMethodCustomization(Port port, com.sun.tools.internal.ws.wsdl.document.Port wsdlPort) {
  87         if(isProvider(wsdlPort))
  88             return;

  89         JAXWSBinding jaxwsBinding = (JAXWSBinding)getExtensionOfType(wsdlPort, JAXWSBinding.class);
  90 
  91         String portMethodName = (jaxwsBinding != null)?((jaxwsBinding.getMethodName() != null)?jaxwsBinding.getMethodName().getName():null):null;
  92         if(portMethodName != null){
  93             port.setPortGetter(portMethodName);
  94         }else{
  95             portMethodName = Names.getPortName(port);
  96             portMethodName = BindingHelper.mangleNameToClassName(portMethodName);
  97             port.setPortGetter("get"+portMethodName);
  98         }
  99 
 100     }
 101 
 102     protected boolean isProvider(com.sun.tools.internal.ws.wsdl.document.Port wsdlPort){
 103         JAXWSBinding portCustomization = (JAXWSBinding)getExtensionOfType(wsdlPort, JAXWSBinding.class);
 104         Boolean isProvider = (portCustomization != null)?portCustomization.isProvider():null;
 105         if(isProvider != null){
 106             return isProvider;
 107         }
 108 
 109         JAXWSBinding jaxwsGlobalCustomization = (JAXWSBinding)getExtensionOfType(document.getDefinitions(), JAXWSBinding.class);
 110         isProvider = (jaxwsGlobalCustomization != null)?jaxwsGlobalCustomization.isProvider():null;
 111         if(isProvider != null)
 112             return isProvider;

 113         return false;
 114     }
 115 
 116     protected SOAPBody getSOAPRequestBody() {
 117         SOAPBody requestBody =
 118             (SOAPBody)getAnyExtensionOfType(info.bindingOperation.getInput(),
 119                 SOAPBody.class);
 120         if (requestBody == null) {
 121             // the WSDL document is invalid
 122             error(info.bindingOperation.getInput(), ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_INPUT_MISSING_SOAP_BODY(info.bindingOperation.getName()));
 123         }
 124         return requestBody;
 125     }
 126 
 127     protected boolean isRequestMimeMultipart() {
 128         for (TWSDLExtension extension: info.bindingOperation.getInput().extensions()) {
 129             if (extension.getClass().equals(MIMEMultipartRelated.class)) {
 130                 return true;
 131             }
 132         }


 140             }
 141         }
 142         return false;
 143     }
 144 
 145 
 146 
 147 
 148     protected SOAPBody getSOAPResponseBody() {
 149         SOAPBody responseBody =
 150             (SOAPBody)getAnyExtensionOfType(info.bindingOperation.getOutput(),
 151                 SOAPBody.class);
 152         if (responseBody == null) {
 153             // the WSDL document is invalid
 154             error(info.bindingOperation.getOutput(),  ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_MISSING_SOAP_BODY(info.bindingOperation.getName()));
 155         }
 156         return responseBody;
 157     }
 158 
 159     protected com.sun.tools.internal.ws.wsdl.document.Message getOutputMessage() {
 160         if (info.portTypeOperation.getOutput() == null)
 161             return null;

 162         return info.portTypeOperation.getOutput().resolveMessage(info.document);
 163     }
 164 
 165     protected com.sun.tools.internal.ws.wsdl.document.Message getInputMessage() {
 166         return info.portTypeOperation.getInput().resolveMessage(info.document);
 167     }
 168 
 169     /**
 170      * @param body request or response body, represents soap:body
 171      * @param message Input or output message, equivalent to wsdl:message
 172      * @return iterator over MessagePart
 173      */
 174     protected List<MessagePart> getMessageParts(
 175         SOAPBody body,
 176         com.sun.tools.internal.ws.wsdl.document.Message message, boolean isInput) {
 177         String bodyParts = body.getParts();
 178         ArrayList<MessagePart> partsList = new ArrayList<MessagePart>();
 179         List<MessagePart> parts = new ArrayList<MessagePart>();
 180 
 181         //get Mime parts
 182         List mimeParts;
 183         if(isInput)
 184             mimeParts = getMimeContentParts(message, info.bindingOperation.getInput());
 185         else
 186             mimeParts = getMimeContentParts(message, info.bindingOperation.getOutput());

 187 
 188         if (bodyParts != null) {
 189             StringTokenizer in = new StringTokenizer(bodyParts.trim(), " ");
 190             while (in.hasMoreTokens()) {
 191                 String part = in.nextToken();
 192                 MessagePart mPart = message.getPart(part);
 193                 if (null == mPart) {
 194                     error(message,  ModelerMessages.WSDLMODELER_ERROR_PARTS_NOT_FOUND(part, message.getName()));
 195                 }
 196                 mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);
 197                 partsList.add(mPart);
 198             }
 199         } else {
 200             for (MessagePart mPart : message.getParts()) {
 201                 if (!mimeParts.contains(mPart))
 202                     mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);

 203                 partsList.add(mPart);
 204             }
 205         }
 206 
 207         for (MessagePart mPart : message.getParts()) {
 208             if(mimeParts.contains(mPart)) {
 209                 mPart.setBindingExtensibilityElementKind(MessagePart.WSDL_MIME_BINDING);
 210                 parts.add(mPart);
 211             }else if(partsList.contains(mPart)) {
 212                 mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);
 213                 parts.add(mPart);
 214             }
 215         }
 216 
 217         return parts;
 218     }
 219 
 220     /**
 221      * @param message
 222      * @return MessageParts referenced by the mime:content
 223      */
 224     protected List<MessagePart> getMimeContentParts(Message message, TWSDLExtensible ext) {
 225         ArrayList<MessagePart> mimeContentParts = new ArrayList<MessagePart>();
 226 
 227         for (MIMEPart mimePart : getMimeParts(ext)) {
 228             MessagePart part = getMimeContentPart(message, mimePart);
 229             if (part != null)
 230                 mimeContentParts.add(part);
 231         }

 232         return mimeContentParts;
 233     }
 234 
 235     /**
 236      * @param mimeParts
 237      */
 238     protected boolean validateMimeParts(Iterable<MIMEPart> mimeParts) {
 239         boolean gotRootPart = false;
 240         List<MIMEContent> mimeContents = new ArrayList<MIMEContent>();
 241         for (MIMEPart mPart : mimeParts) {
 242             for (TWSDLExtension obj : mPart.extensions()) {
 243                 if (obj instanceof SOAPBody) {
 244                     if (gotRootPart) {
 245                         warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_MORE_THAN_ONE_SOAP_BODY(info.operation.getName().getLocalPart()));
 246                         return false;
 247                     }
 248                     gotRootPart = true;
 249                 } else if (obj instanceof MIMEContent) {
 250                     mimeContents.add((MIMEContent) obj);
 251                 }
 252             }
 253             if(!validateMimeContentPartNames(mimeContents))
 254                 return false;

 255             if(mPart.getName() != null) {
 256                 warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_NAME_NOT_ALLOWED(info.portTypeOperation.getName()));
 257             }
 258         }
 259         return true;
 260 
 261     }
 262 
 263     private MessagePart getMimeContentPart(Message message, MIMEPart part) {
 264         for( MIMEContent mimeContent : getMimeContents(part) ) {
 265             String mimeContentPartName = mimeContent.getPart();
 266             MessagePart mPart = message.getPart(mimeContentPartName);
 267             //RXXXX mime:content MUST have part attribute
 268             if(null == mPart) {
 269                 error(mimeContent,  ModelerMessages.WSDLMODELER_ERROR_PARTS_NOT_FOUND(mimeContentPartName, message.getName()));
 270             }
 271             mPart.setBindingExtensibilityElementKind(MessagePart.WSDL_MIME_BINDING);
 272             return mPart;
 273         }
 274         return null;
 275     }
 276 
 277     //List of mimeTypes
 278     protected List<String> getAlternateMimeTypes(List<MIMEContent> mimeContents) {
 279         List<String> mimeTypes = new ArrayList<String>();
 280         //validateMimeContentPartNames(mimeContents.iterator());
 281 //        String mimeType = null;
 282         for(MIMEContent mimeContent:mimeContents){
 283             String mimeType = getMimeContentType(mimeContent);
 284             if(!mimeTypes.contains(mimeType))
 285                 mimeTypes.add(mimeType);
 286         }

 287         return mimeTypes;
 288     }
 289 
 290     private boolean validateMimeContentPartNames(List<MIMEContent> mimeContents) {
 291         //validate mime:content(s) in the mime:part as per R2909
 292         for (MIMEContent mimeContent : mimeContents) {
 293             String mimeContnetPart;
 294             mimeContnetPart = getMimeContentPartName(mimeContent);
 295             if(mimeContnetPart == null) {
 296                 warning(mimeContent, ModelerMessages.MIMEMODELER_INVALID_MIME_CONTENT_MISSING_PART_ATTRIBUTE(info.operation.getName().getLocalPart()));
 297                 return false;
 298             }
 299         }
 300         return true;
 301     }
 302 
 303     protected Iterable<MIMEPart> getMimeParts(TWSDLExtensible ext) {
 304         MIMEMultipartRelated multiPartRelated =
 305             (MIMEMultipartRelated) getAnyExtensionOfType(ext,
 306                     MIMEMultipartRelated.class);


 415                                 warning((Entity) obj, ModelerMessages.MIMEMODELER_WARNING_IGNORINGINVALID_HEADER_PART_NOT_DECLARED_IN_ROOT_PART(info.bindingOperation.getName()));
 416                                 return new ArrayList<SOAPHeader>();
 417                             }
 418                             headerList.add((SOAPHeader) obj);
 419                         }
 420                     }
 421                 }
 422             } else if (extension instanceof SOAPHeader) {
 423                 headerList.add((SOAPHeader) extension);
 424             }
 425         }
 426          return headerList;
 427     }
 428 
 429     /**
 430      * @param part
 431      * @return true if part is the Root part
 432      */
 433     private boolean isRootPart(MIMEPart part) {
 434         for (TWSDLExtension twsdlExtension : part.extensions()) {
 435             if (twsdlExtension instanceof SOAPBody)
 436                 return true;
 437         }

 438         return false;
 439     }
 440 
 441     protected Set getDuplicateFaultNames() {
 442         // look for fault messages with the same soap:fault name
 443         Set<QName> faultNames = new HashSet<QName>();
 444         Set<QName> duplicateNames = new HashSet<QName>();
 445         for( BindingFault bindingFault : info.bindingOperation.faults() ) {
 446             com.sun.tools.internal.ws.wsdl.document.Fault portTypeFault = null;
 447             for (com.sun.tools.internal.ws.wsdl.document.Fault aFault : info.portTypeOperation.faults()) {
 448                 if (aFault.getName().equals(bindingFault.getName())) {
 449                     if (portTypeFault != null) {
 450                         // the WSDL document is invalid
 451                         error(bindingFault, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_NOT_UNIQUE(bindingFault.getName(),
 452                             info.bindingOperation.getName()));
 453                     } else {
 454                         portTypeFault = aFault;
 455                     }
 456                 }
 457             }


 489             QName faultQName = new QName(faultNamespaceURI, faultName);
 490             if (faultNames.contains(faultQName)) {
 491                 duplicateNames.add(faultQName);
 492             } else {
 493                 faultNames.add(faultQName);
 494             }
 495         }
 496         return duplicateNames;
 497     }
 498 
 499 
 500     /**
 501      * @param operation
 502      * @return true if operation has valid body parts
 503      */
 504     protected boolean validateBodyParts(BindingOperation operation) {
 505         boolean isRequestResponse =
 506             info.portTypeOperation.getStyle()
 507             == OperationStyle.REQUEST_RESPONSE;
 508         List<MessagePart> inputParts = getMessageParts(getSOAPRequestBody(), getInputMessage(), true);
 509         if(!validateStyleAndPart(operation, inputParts))
 510             return false;

 511 
 512         if(isRequestResponse){
 513             List<MessagePart> outputParts = getMessageParts(getSOAPResponseBody(), getOutputMessage(), false);
 514             if(!validateStyleAndPart(operation, outputParts))
 515                 return false;
 516         }

 517         return true;
 518     }
 519 
 520     /**
 521      * @param operation
 522      * @return true if operation has valid style and part
 523      */
 524     private boolean validateStyleAndPart(BindingOperation operation, List<MessagePart> parts) {
 525         SOAPOperation soapOperation =
 526             (SOAPOperation) getExtensionOfType(operation, SOAPOperation.class);
 527         for (MessagePart part : parts) {
 528             if (part.getBindingExtensibilityElementKind() == MessagePart.SOAP_BODY_BINDING) {
 529                 if (!isStyleAndPartMatch(soapOperation, part))
 530                     return false;
 531             }
 532         }

 533         return true;
 534     }
 535 
 536     protected String getLiteralJavaMemberName(Fault fault) {
 537         String javaMemberName;
 538 
 539         QName memberName = fault.getElementName();
 540         javaMemberName = fault.getJavaMemberName();
 541         if (javaMemberName == null)
 542             javaMemberName = memberName.getLocalPart();

 543         return javaMemberName;
 544     }
 545 
 546     /**
 547      * @param ext
 548      * @param message
 549      * @param name
 550      * @return List of MimeContents from ext
 551      */
 552     protected List<MIMEContent> getMimeContents(TWSDLExtensible ext, Message message, String name) {
 553         for (MIMEPart mimePart : getMimeParts(ext)) {
 554             List<MIMEContent> mimeContents = getMimeContents(mimePart);
 555             for (MIMEContent mimeContent : mimeContents) {
 556                 if (mimeContent.getPart().equals(name))
 557                     return mimeContents;
 558             }
 559         }

 560         return null;
 561     }
 562 
 563     protected String makePackageQualified(String s) {
 564         if (s.indexOf(".") != -1) {
 565             // s is already package qualified
 566             return s;
 567         } else if (options.defaultPackage != null
 568                 && !options.defaultPackage.equals("")) {
 569             return options.defaultPackage + "." + s;
 570         } else {//options.defaultPackage seems to be never null, and this is never executed
 571             return s;
 572         }
 573 
 574     }
 575 
 576 
 577     protected String getUniqueName(
 578         com.sun.tools.internal.ws.wsdl.document.Operation operation,
 579         boolean hasOverloadedOperations) {


 588         return new QName(
 589             entity.getDefining().getTargetNamespaceURI(),
 590             entity.getName());
 591     }
 592 
 593     protected static TWSDLExtension getExtensionOfType(
 594             TWSDLExtensible extensible,
 595             Class type) {
 596         for (TWSDLExtension extension:extensible.extensions()) {
 597             if (extension.getClass().equals(type)) {
 598                 return extension;
 599             }
 600         }
 601 
 602         return null;
 603     }
 604 
 605     protected TWSDLExtension getAnyExtensionOfType(
 606         TWSDLExtensible extensible,
 607         Class type) {
 608         if(extensible == null)
 609             return null;

 610         for (TWSDLExtension extension:extensible.extensions()) {
 611             if(extension.getClass().equals(type)) {
 612                 return extension;
 613             }else if (extension.getClass().equals(MIMEMultipartRelated.class) &&
 614                     (type.equals(SOAPBody.class) || type.equals(MIMEContent.class)
 615                             || type.equals(MIMEPart.class))) {
 616                 for (MIMEPart part : ((MIMEMultipartRelated)extension).getParts()) {
 617                     //bug fix: 5024001
 618                     TWSDLExtension extn = getExtensionOfType(part, type);
 619                     if (extn != null)
 620                         return extn;
 621                 }
 622             }
 623         }

 624 
 625         return null;
 626     }
 627 
 628     // bug fix: 4857100
 629     protected static com.sun.tools.internal.ws.wsdl.document.Message findMessage(
 630         QName messageName,
 631         WSDLDocument document) {
 632         com.sun.tools.internal.ws.wsdl.document.Message message = null;
 633         try {
 634             message =
 635                 (com.sun.tools.internal.ws.wsdl.document.Message)document.find(
 636                     Kinds.MESSAGE,
 637                     messageName);
 638         } catch (NoSuchEntityException e) {
 639         }
 640         return message;
 641     }
 642 
 643     protected static boolean tokenListContains(
 644         String tokenList,
 645         String target) {
 646         if (tokenList == null) {
 647             return false;
 648         }
 649 
 650         StringTokenizer tokenizer = new StringTokenizer(tokenList, " ");
 651         while (tokenizer.hasMoreTokens()) {
 652             String s = tokenizer.nextToken();
 653             if (target.equals(s)) {
 654                 return true;
 655             }
 656         }
 657         return false;
 658     }
 659 
 660     protected String getUniqueClassName(String className) {
 661         int cnt = 2;
 662         String uniqueName = className;
 663         while (reqResNames.contains(uniqueName.toLowerCase())) {
 664             uniqueName = className + cnt;
 665             cnt++;
 666         }
 667         reqResNames.add(uniqueName.toLowerCase());
 668         return uniqueName;
 669     }
 670 
 671     protected boolean isConflictingClassName(String name) {
 672         if (_conflictingClassNames == null) {
 673             return false;
 674         }
 675 
 676         return _conflictingClassNames.contains(name);
 677     }
 678 
 679     protected boolean isConflictingServiceClassName(String name) {
 680         return isConflictingClassName(name);
 681     }
 682 
 683     protected boolean isConflictingStubClassName(String name) {
 684         return isConflictingClassName(name);
 685     }
 686 
 687     protected boolean isConflictingTieClassName(String name) {
 688         return isConflictingClassName(name);
 689     }
 690 
 691     protected boolean isConflictingPortClassName(String name) {
 692         return isConflictingClassName(name);
 693     }
 694 
 695     protected boolean isConflictingExceptionClassName(String name) {
 696         return isConflictingClassName(name);
 697     }
 698 
 699     int numPasses = 0;
 700 
 701     protected void warning(Entity entity, String message){
 702         //avoid duplicate warning for the second pass
 703         if(numPasses > 1)
 704             return;
 705         if(entity == null)

 706             errReceiver.warning(null, message);
 707         else
 708             errReceiver.warning(entity.getLocator(), message);
 709     }

 710 
 711     protected void error(Entity entity, String message){
 712         if(entity == null)
 713             errReceiver.error(null, message);
 714         else
 715             errReceiver.error(entity.getLocator(), message);

 716         throw new AbortException();
 717     }
 718 
 719     protected static final String OPERATION_HAS_VOID_RETURN_TYPE =
 720         "com.sun.xml.internal.ws.processor.modeler.wsdl.operationHasVoidReturnType";
 721     protected static final String WSDL_PARAMETER_ORDER =
 722         "com.sun.xml.internal.ws.processor.modeler.wsdl.parameterOrder";
 723     public static final String WSDL_RESULT_PARAMETER =
 724         "com.sun.xml.internal.ws.processor.modeler.wsdl.resultParameter";
 725     public static final String MESSAGE_HAS_MIME_MULTIPART_RELATED_BINDING =
 726         "com.sun.xml.internal.ws.processor.modeler.wsdl.mimeMultipartRelatedBinding";
 727 
 728 
 729     protected ProcessSOAPOperationInfo info;
 730 
 731     private Set _conflictingClassNames;
 732     protected Map<String,JavaException> _javaExceptions;
 733     protected Map _faultTypeToStructureMap;
 734     protected Map<QName, Port> _bindingNameToPortMap;
 735     protected boolean useWSIBasicProfile = true;
 736 
 737     private final Set<String> reqResNames = new HashSet<String>();
 738 
 739     public class ProcessSOAPOperationInfo {
 740 
 741         public ProcessSOAPOperationInfo(
 742             Port modelPort,
 743             com.sun.tools.internal.ws.wsdl.document.Port port,
 744             com.sun.tools.internal.ws.wsdl.document.Operation portTypeOperation,
 745             BindingOperation bindingOperation,
 746             SOAPBinding soapBinding,
 747             WSDLDocument document,
 748             boolean hasOverloadedOperations,
 749             Map headers) {
 750             this.modelPort = modelPort;
 751             this.port = port;
 752             this.portTypeOperation = portTypeOperation;
 753             this.bindingOperation = bindingOperation;
 754             this.soapBinding = soapBinding;
 755             this.document = document;
 756             this.hasOverloadedOperations = hasOverloadedOperations;
 757             this.headers = headers;
 758         }
 759 
 760         public Port modelPort;
 761         public com.sun.tools.internal.ws.wsdl.document.Port port;
 762         public com.sun.tools.internal.ws.wsdl.document.Operation portTypeOperation;
 763         public BindingOperation bindingOperation;
 764         public SOAPBinding soapBinding;
 765         public WSDLDocument document;
 766         public boolean hasOverloadedOperations;
 767         public Map headers;
 768 
 769         // additional data
 770         public Operation operation;
 771         public String uniqueOperationName;
 772     }
 773 
 774     public static class WSDLExceptionInfo {
 775         public String exceptionType;
 776         public QName wsdlMessage;
 777         public String wsdlMessagePartName;
 778         public HashMap constructorOrder; // mapping of element name to
 779                                              // constructor order (of type Integer)
 780     }
 781 
 782 
 783     protected WSDLParser parser;
 784     protected WSDLDocument document;
 785     protected static final LocatorImpl NULL_LOCATOR = new LocatorImpl();
 786 }
   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.tools.internal.ws.processor.modeler.wsdl;
  27 
  28 import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
  29 import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
  30 import com.sun.tools.internal.ws.processor.generator.Names;
  31 import com.sun.tools.internal.ws.processor.model.Fault;
  32 import com.sun.tools.internal.ws.processor.model.Operation;
  33 import com.sun.tools.internal.ws.processor.model.Port;
  34 import com.sun.tools.internal.ws.processor.model.java.JavaException;

  35 import com.sun.tools.internal.ws.processor.modeler.Modeler;
  36 import com.sun.tools.internal.ws.resources.ModelerMessages;
  37 import com.sun.tools.internal.ws.wscompile.AbortException;
  38 import com.sun.tools.internal.ws.wscompile.ErrorReceiver;
  39 import com.sun.tools.internal.ws.wscompile.ErrorReceiverFilter;
  40 import com.sun.tools.internal.ws.wscompile.WsimportOptions;
  41 import com.sun.tools.internal.ws.wsdl.document.*;
  42 import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBinding;
  43 import com.sun.tools.internal.ws.wsdl.document.mime.MIMEContent;
  44 import com.sun.tools.internal.ws.wsdl.document.mime.MIMEMultipartRelated;
  45 import com.sun.tools.internal.ws.wsdl.document.mime.MIMEPart;
  46 import com.sun.tools.internal.ws.wsdl.document.schema.SchemaKinds;
  47 import com.sun.tools.internal.ws.wsdl.document.soap.*;
  48 import com.sun.tools.internal.ws.wsdl.framework.Entity;
  49 import com.sun.tools.internal.ws.wsdl.framework.GloballyKnown;
  50 import com.sun.tools.internal.ws.wsdl.framework.NoSuchEntityException;

  51 import com.sun.tools.internal.ws.wsdl.parser.WSDLParser;
  52 import com.sun.tools.internal.ws.wsdl.parser.MetadataFinder;

  53 import com.sun.xml.internal.ws.spi.db.BindingHelper;
  54 
  55 import org.xml.sax.helpers.LocatorImpl;
  56 
  57 import javax.xml.namespace.QName;
  58 import java.util.*;
  59 
  60 /**
  61  *
  62  * @author WS Development Team
  63  *
  64  * Base class for WSDL->Model classes.
  65  */
  66 public abstract class WSDLModelerBase implements Modeler {
  67     protected final ErrorReceiverFilter errReceiver;
  68     protected final WsimportOptions options;
  69     protected MetadataFinder forest;
  70 
  71 
  72     public WSDLModelerBase(WsimportOptions options, ErrorReceiver receiver, MetadataFinder forest) {
  73         this.options = options;
  74         this.errReceiver = new ErrorReceiverFilter(receiver);
  75         this.forest = forest;
  76     }
  77 
  78     /**
  79      *
  80      * @param port
  81      * @param wsdlPort
  82      */
  83     protected void applyPortMethodCustomization(Port port, com.sun.tools.internal.ws.wsdl.document.Port wsdlPort) {
  84         if (isProvider(wsdlPort)) {
  85             return;
  86         }
  87         JAXWSBinding jaxwsBinding = (JAXWSBinding)getExtensionOfType(wsdlPort, JAXWSBinding.class);
  88 
  89         String portMethodName = (jaxwsBinding != null)?((jaxwsBinding.getMethodName() != null)?jaxwsBinding.getMethodName().getName():null):null;
  90         if(portMethodName != null){
  91             port.setPortGetter(portMethodName);
  92         }else{
  93             portMethodName = Names.getPortName(port);
  94             portMethodName = BindingHelper.mangleNameToClassName(portMethodName);
  95             port.setPortGetter("get"+portMethodName);
  96         }
  97 
  98     }
  99 
 100     protected boolean isProvider(com.sun.tools.internal.ws.wsdl.document.Port wsdlPort){
 101         JAXWSBinding portCustomization = (JAXWSBinding)getExtensionOfType(wsdlPort, JAXWSBinding.class);
 102         Boolean isProvider = (portCustomization != null)?portCustomization.isProvider():null;
 103         if(isProvider != null){
 104             return isProvider;
 105         }
 106 
 107         JAXWSBinding jaxwsGlobalCustomization = (JAXWSBinding)getExtensionOfType(document.getDefinitions(), JAXWSBinding.class);
 108         isProvider = (jaxwsGlobalCustomization != null)?jaxwsGlobalCustomization.isProvider():null;
 109         if (isProvider != null) {
 110             return isProvider;
 111         }
 112         return false;
 113     }
 114 
 115     protected SOAPBody getSOAPRequestBody() {
 116         SOAPBody requestBody =
 117             (SOAPBody)getAnyExtensionOfType(info.bindingOperation.getInput(),
 118                 SOAPBody.class);
 119         if (requestBody == null) {
 120             // the WSDL document is invalid
 121             error(info.bindingOperation.getInput(), ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_INPUT_MISSING_SOAP_BODY(info.bindingOperation.getName()));
 122         }
 123         return requestBody;
 124     }
 125 
 126     protected boolean isRequestMimeMultipart() {
 127         for (TWSDLExtension extension: info.bindingOperation.getInput().extensions()) {
 128             if (extension.getClass().equals(MIMEMultipartRelated.class)) {
 129                 return true;
 130             }
 131         }


 139             }
 140         }
 141         return false;
 142     }
 143 
 144 
 145 
 146 
 147     protected SOAPBody getSOAPResponseBody() {
 148         SOAPBody responseBody =
 149             (SOAPBody)getAnyExtensionOfType(info.bindingOperation.getOutput(),
 150                 SOAPBody.class);
 151         if (responseBody == null) {
 152             // the WSDL document is invalid
 153             error(info.bindingOperation.getOutput(),  ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_MISSING_SOAP_BODY(info.bindingOperation.getName()));
 154         }
 155         return responseBody;
 156     }
 157 
 158     protected com.sun.tools.internal.ws.wsdl.document.Message getOutputMessage() {
 159         if (info.portTypeOperation.getOutput() == null) {
 160             return null;
 161         }
 162         return info.portTypeOperation.getOutput().resolveMessage(info.document);
 163     }
 164 
 165     protected com.sun.tools.internal.ws.wsdl.document.Message getInputMessage() {
 166         return info.portTypeOperation.getInput().resolveMessage(info.document);
 167     }
 168 
 169     /**
 170      * @param body request or response body, represents soap:body
 171      * @param message Input or output message, equivalent to wsdl:message
 172      * @return iterator over MessagePart
 173      */
 174     protected List<MessagePart> getMessageParts(
 175         SOAPBody body,
 176         com.sun.tools.internal.ws.wsdl.document.Message message, boolean isInput) {
 177         String bodyParts = body.getParts();
 178         ArrayList<MessagePart> partsList = new ArrayList<MessagePart>();
 179         List<MessagePart> parts = new ArrayList<MessagePart>();
 180 
 181         //get Mime parts
 182         List mimeParts;
 183         if (isInput) {
 184             mimeParts = getMimeContentParts(message, info.bindingOperation.getInput());
 185         } else {
 186             mimeParts = getMimeContentParts(message, info.bindingOperation.getOutput());
 187         }
 188 
 189         if (bodyParts != null) {
 190             StringTokenizer in = new StringTokenizer(bodyParts.trim(), " ");
 191             while (in.hasMoreTokens()) {
 192                 String part = in.nextToken();
 193                 MessagePart mPart = message.getPart(part);
 194                 if (null == mPart) {
 195                     error(message,  ModelerMessages.WSDLMODELER_ERROR_PARTS_NOT_FOUND(part, message.getName()));
 196                 }
 197                 mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);
 198                 partsList.add(mPart);
 199             }
 200         } else {
 201             for (MessagePart mPart : message.getParts()) {
 202                 if (!mimeParts.contains(mPart)) {
 203                     mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);
 204                 }
 205                 partsList.add(mPart);
 206             }
 207         }
 208 
 209         for (MessagePart mPart : message.getParts()) {
 210             if (mimeParts.contains(mPart)) {
 211                 mPart.setBindingExtensibilityElementKind(MessagePart.WSDL_MIME_BINDING);
 212                 parts.add(mPart);
 213             } else if(partsList.contains(mPart)) {
 214                 mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);
 215                 parts.add(mPart);
 216             }
 217         }
 218 
 219         return parts;
 220     }
 221 
 222     /**
 223      * @param message
 224      * @return MessageParts referenced by the mime:content
 225      */
 226     protected List<MessagePart> getMimeContentParts(Message message, TWSDLExtensible ext) {
 227         ArrayList<MessagePart> mimeContentParts = new ArrayList<MessagePart>();
 228 
 229         for (MIMEPart mimePart : getMimeParts(ext)) {
 230             MessagePart part = getMimeContentPart(message, mimePart);
 231             if (part != null) {
 232                 mimeContentParts.add(part);
 233             }
 234         }
 235         return mimeContentParts;
 236     }
 237 
 238     /**
 239      * @param mimeParts
 240      */
 241     protected boolean validateMimeParts(Iterable<MIMEPart> mimeParts) {
 242         boolean gotRootPart = false;
 243         List<MIMEContent> mimeContents = new ArrayList<MIMEContent>();
 244         for (MIMEPart mPart : mimeParts) {
 245             for (TWSDLExtension obj : mPart.extensions()) {
 246                 if (obj instanceof SOAPBody) {
 247                     if (gotRootPart) {
 248                         warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_MORE_THAN_ONE_SOAP_BODY(info.operation.getName().getLocalPart()));
 249                         return false;
 250                     }
 251                     gotRootPart = true;
 252                 } else if (obj instanceof MIMEContent) {
 253                     mimeContents.add((MIMEContent) obj);
 254                 }
 255             }
 256             if (!validateMimeContentPartNames(mimeContents)) {
 257                 return false;
 258             }
 259             if(mPart.getName() != null) {
 260                 warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_NAME_NOT_ALLOWED(info.portTypeOperation.getName()));
 261             }
 262         }
 263         return true;
 264 
 265     }
 266 
 267     private MessagePart getMimeContentPart(Message message, MIMEPart part) {
 268         for( MIMEContent mimeContent : getMimeContents(part) ) {
 269             String mimeContentPartName = mimeContent.getPart();
 270             MessagePart mPart = message.getPart(mimeContentPartName);
 271             //RXXXX mime:content MUST have part attribute
 272             if(null == mPart) {
 273                 error(mimeContent,  ModelerMessages.WSDLMODELER_ERROR_PARTS_NOT_FOUND(mimeContentPartName, message.getName()));
 274             }
 275             mPart.setBindingExtensibilityElementKind(MessagePart.WSDL_MIME_BINDING);
 276             return mPart;
 277         }
 278         return null;
 279     }
 280 
 281     //List of mimeTypes
 282     protected List<String> getAlternateMimeTypes(List<MIMEContent> mimeContents) {
 283         List<String> mimeTypes = new ArrayList<String>();
 284         //validateMimeContentPartNames(mimeContents.iterator());
 285 //        String mimeType = null;
 286         for(MIMEContent mimeContent:mimeContents){
 287             String mimeType = getMimeContentType(mimeContent);
 288             if (!mimeTypes.contains(mimeType)) {
 289                 mimeTypes.add(mimeType);
 290             }
 291         }
 292         return mimeTypes;
 293     }
 294 
 295     private boolean validateMimeContentPartNames(List<MIMEContent> mimeContents) {
 296         //validate mime:content(s) in the mime:part as per R2909
 297         for (MIMEContent mimeContent : mimeContents) {
 298             String mimeContnetPart;
 299             mimeContnetPart = getMimeContentPartName(mimeContent);
 300             if(mimeContnetPart == null) {
 301                 warning(mimeContent, ModelerMessages.MIMEMODELER_INVALID_MIME_CONTENT_MISSING_PART_ATTRIBUTE(info.operation.getName().getLocalPart()));
 302                 return false;
 303             }
 304         }
 305         return true;
 306     }
 307 
 308     protected Iterable<MIMEPart> getMimeParts(TWSDLExtensible ext) {
 309         MIMEMultipartRelated multiPartRelated =
 310             (MIMEMultipartRelated) getAnyExtensionOfType(ext,
 311                     MIMEMultipartRelated.class);


 420                                 warning((Entity) obj, ModelerMessages.MIMEMODELER_WARNING_IGNORINGINVALID_HEADER_PART_NOT_DECLARED_IN_ROOT_PART(info.bindingOperation.getName()));
 421                                 return new ArrayList<SOAPHeader>();
 422                             }
 423                             headerList.add((SOAPHeader) obj);
 424                         }
 425                     }
 426                 }
 427             } else if (extension instanceof SOAPHeader) {
 428                 headerList.add((SOAPHeader) extension);
 429             }
 430         }
 431          return headerList;
 432     }
 433 
 434     /**
 435      * @param part
 436      * @return true if part is the Root part
 437      */
 438     private boolean isRootPart(MIMEPart part) {
 439         for (TWSDLExtension twsdlExtension : part.extensions()) {
 440             if (twsdlExtension instanceof SOAPBody) {
 441                 return true;
 442             }
 443         }
 444         return false;
 445     }
 446 
 447     protected Set getDuplicateFaultNames() {
 448         // look for fault messages with the same soap:fault name
 449         Set<QName> faultNames = new HashSet<QName>();
 450         Set<QName> duplicateNames = new HashSet<QName>();
 451         for( BindingFault bindingFault : info.bindingOperation.faults() ) {
 452             com.sun.tools.internal.ws.wsdl.document.Fault portTypeFault = null;
 453             for (com.sun.tools.internal.ws.wsdl.document.Fault aFault : info.portTypeOperation.faults()) {
 454                 if (aFault.getName().equals(bindingFault.getName())) {
 455                     if (portTypeFault != null) {
 456                         // the WSDL document is invalid
 457                         error(bindingFault, ModelerMessages.WSDLMODELER_INVALID_BINDING_FAULT_NOT_UNIQUE(bindingFault.getName(),
 458                             info.bindingOperation.getName()));
 459                     } else {
 460                         portTypeFault = aFault;
 461                     }
 462                 }
 463             }


 495             QName faultQName = new QName(faultNamespaceURI, faultName);
 496             if (faultNames.contains(faultQName)) {
 497                 duplicateNames.add(faultQName);
 498             } else {
 499                 faultNames.add(faultQName);
 500             }
 501         }
 502         return duplicateNames;
 503     }
 504 
 505 
 506     /**
 507      * @param operation
 508      * @return true if operation has valid body parts
 509      */
 510     protected boolean validateBodyParts(BindingOperation operation) {
 511         boolean isRequestResponse =
 512             info.portTypeOperation.getStyle()
 513             == OperationStyle.REQUEST_RESPONSE;
 514         List<MessagePart> inputParts = getMessageParts(getSOAPRequestBody(), getInputMessage(), true);
 515         if (!validateStyleAndPart(operation, inputParts)) {
 516             return false;
 517         }
 518 
 519         if(isRequestResponse){
 520             List<MessagePart> outputParts = getMessageParts(getSOAPResponseBody(), getOutputMessage(), false);
 521             if (!validateStyleAndPart(operation, outputParts)) {
 522                 return false;
 523             }
 524         }
 525         return true;
 526     }
 527 
 528     /**
 529      * @param operation
 530      * @return true if operation has valid style and part
 531      */
 532     private boolean validateStyleAndPart(BindingOperation operation, List<MessagePart> parts) {
 533         SOAPOperation soapOperation =
 534             (SOAPOperation) getExtensionOfType(operation, SOAPOperation.class);
 535         for (MessagePart part : parts) {
 536             if (part.getBindingExtensibilityElementKind() == MessagePart.SOAP_BODY_BINDING) {
 537                 if (!isStyleAndPartMatch(soapOperation, part)) {
 538                     return false;
 539                 }
 540             }
 541         }
 542         return true;
 543     }
 544 
 545     protected String getLiteralJavaMemberName(Fault fault) {
 546         String javaMemberName;
 547 
 548         QName memberName = fault.getElementName();
 549         javaMemberName = fault.getJavaMemberName();
 550         if (javaMemberName == null) {
 551             javaMemberName = memberName.getLocalPart();
 552         }
 553         return javaMemberName;
 554     }
 555 
 556     /**
 557      * @param ext
 558      * @param message
 559      * @param name
 560      * @return List of MimeContents from ext
 561      */
 562     protected List<MIMEContent> getMimeContents(TWSDLExtensible ext, Message message, String name) {
 563         for (MIMEPart mimePart : getMimeParts(ext)) {
 564             List<MIMEContent> mimeContents = getMimeContents(mimePart);
 565             for (MIMEContent mimeContent : mimeContents) {
 566                 if (mimeContent.getPart().equals(name)) {
 567                     return mimeContents;
 568                 }
 569             }
 570         }
 571         return null;
 572     }
 573 
 574     protected String makePackageQualified(String s) {
 575         if (s.indexOf(".") != -1) {
 576             // s is already package qualified
 577             return s;
 578         } else if (options.defaultPackage != null
 579                 && !options.defaultPackage.equals("")) {
 580             return options.defaultPackage + "." + s;
 581         } else {//options.defaultPackage seems to be never null, and this is never executed
 582             return s;
 583         }
 584 
 585     }
 586 
 587 
 588     protected String getUniqueName(
 589         com.sun.tools.internal.ws.wsdl.document.Operation operation,
 590         boolean hasOverloadedOperations) {


 599         return new QName(
 600             entity.getDefining().getTargetNamespaceURI(),
 601             entity.getName());
 602     }
 603 
 604     protected static TWSDLExtension getExtensionOfType(
 605             TWSDLExtensible extensible,
 606             Class type) {
 607         for (TWSDLExtension extension:extensible.extensions()) {
 608             if (extension.getClass().equals(type)) {
 609                 return extension;
 610             }
 611         }
 612 
 613         return null;
 614     }
 615 
 616     protected TWSDLExtension getAnyExtensionOfType(
 617         TWSDLExtensible extensible,
 618         Class type) {
 619         if (extensible == null) {
 620             return null;
 621         }
 622         for (TWSDLExtension extension:extensible.extensions()) {
 623             if(extension.getClass().equals(type)) {
 624                 return extension;
 625             }else if (extension.getClass().equals(MIMEMultipartRelated.class) &&
 626                     (type.equals(SOAPBody.class) || type.equals(MIMEContent.class)
 627                             || type.equals(MIMEPart.class))) {
 628                 for (MIMEPart part : ((MIMEMultipartRelated)extension).getParts()) {
 629                     //bug fix: 5024001
 630                     TWSDLExtension extn = getExtensionOfType(part, type);
 631                     if (extn != null) {
 632                         return extn;
 633                     }
 634                 }
 635             }
 636         }
 637 
 638         return null;
 639     }
 640 
 641     // bug fix: 4857100
 642     protected static com.sun.tools.internal.ws.wsdl.document.Message findMessage(
 643         QName messageName,
 644         WSDLDocument document) {
 645         com.sun.tools.internal.ws.wsdl.document.Message message = null;
 646         try {
 647             message =
 648                 (com.sun.tools.internal.ws.wsdl.document.Message)document.find(
 649                     Kinds.MESSAGE,
 650                     messageName);
 651         } catch (NoSuchEntityException e) {
 652         }
 653         return message;
 654     }
 655 
 656     protected static boolean tokenListContains(
 657         String tokenList,
 658         String target) {
 659         if (tokenList == null) {
 660             return false;
 661         }
 662 
 663         StringTokenizer tokenizer = new StringTokenizer(tokenList, " ");
 664         while (tokenizer.hasMoreTokens()) {
 665             String s = tokenizer.nextToken();
 666             if (target.equals(s)) {
 667                 return true;
 668             }
 669         }
 670         return false;
 671     }
 672 
 673     protected String getUniqueClassName(String className) {
 674         int cnt = 2;
 675         String uniqueName = className;
 676         while (reqResNames.contains(uniqueName.toLowerCase(Locale.ENGLISH))) {
 677             uniqueName = className + cnt;
 678             cnt++;
 679         }
 680         reqResNames.add(uniqueName.toLowerCase(Locale.ENGLISH));
 681         return uniqueName;
 682     }
 683 
 684     protected boolean isConflictingClassName(String name) {
 685         if (_conflictingClassNames == null) {
 686             return false;
 687         }
 688 
 689         return _conflictingClassNames.contains(name);
 690     }
 691 
 692     protected boolean isConflictingServiceClassName(String name) {
 693         return isConflictingClassName(name);
 694     }
 695 
 696     protected boolean isConflictingStubClassName(String name) {
 697         return isConflictingClassName(name);
 698     }
 699 
 700     protected boolean isConflictingTieClassName(String name) {
 701         return isConflictingClassName(name);
 702     }
 703 
 704     protected boolean isConflictingPortClassName(String name) {
 705         return isConflictingClassName(name);
 706     }
 707 
 708     protected boolean isConflictingExceptionClassName(String name) {
 709         return isConflictingClassName(name);
 710     }
 711 
 712     int numPasses = 0;
 713 
 714     protected void warning(Entity entity, String message){
 715         //avoid duplicate warning for the second pass
 716         if (numPasses > 1) {
 717             return;
 718         }
 719         if (entity == null) {
 720             errReceiver.warning(null, message);
 721         } else {
 722             errReceiver.warning(entity.getLocator(), message);
 723         }
 724     }
 725 
 726     protected void error(Entity entity, String message){
 727         if (entity == null) {
 728             errReceiver.error(null, message);
 729         } else {
 730             errReceiver.error(entity.getLocator(), message);
 731         }
 732         throw new AbortException();
 733     }
 734 
 735     protected static final String OPERATION_HAS_VOID_RETURN_TYPE =
 736         "com.sun.xml.internal.ws.processor.modeler.wsdl.operationHasVoidReturnType";
 737     protected static final String WSDL_PARAMETER_ORDER =
 738         "com.sun.xml.internal.ws.processor.modeler.wsdl.parameterOrder";
 739     public static final String WSDL_RESULT_PARAMETER =
 740         "com.sun.xml.internal.ws.processor.modeler.wsdl.resultParameter";
 741     public static final String MESSAGE_HAS_MIME_MULTIPART_RELATED_BINDING =
 742         "com.sun.xml.internal.ws.processor.modeler.wsdl.mimeMultipartRelatedBinding";
 743 
 744 
 745     protected ProcessSOAPOperationInfo info;
 746 
 747     private Set _conflictingClassNames;
 748     protected Map<String,JavaException> _javaExceptions;
 749     protected Map _faultTypeToStructureMap;
 750     protected Map<QName, Port> _bindingNameToPortMap;

 751 
 752     private final Set<String> reqResNames = new HashSet<String>();
 753 
 754     public static class ProcessSOAPOperationInfo {
 755 
 756         public ProcessSOAPOperationInfo(
 757             Port modelPort,
 758             com.sun.tools.internal.ws.wsdl.document.Port port,
 759             com.sun.tools.internal.ws.wsdl.document.Operation portTypeOperation,
 760             BindingOperation bindingOperation,
 761             SOAPBinding soapBinding,
 762             WSDLDocument document,
 763             boolean hasOverloadedOperations,
 764             Map headers) {
 765             this.modelPort = modelPort;
 766             this.port = port;
 767             this.portTypeOperation = portTypeOperation;
 768             this.bindingOperation = bindingOperation;
 769             this.soapBinding = soapBinding;
 770             this.document = document;
 771             this.hasOverloadedOperations = hasOverloadedOperations;
 772             this.headers = headers;
 773         }
 774 
 775         public Port modelPort;
 776         public com.sun.tools.internal.ws.wsdl.document.Port port;
 777         public com.sun.tools.internal.ws.wsdl.document.Operation portTypeOperation;
 778         public BindingOperation bindingOperation;
 779         public SOAPBinding soapBinding;
 780         public WSDLDocument document;
 781         public boolean hasOverloadedOperations;
 782         public Map headers;
 783 
 784         // additional data
 785         public Operation operation;

 786     }









 787 
 788     protected WSDLParser parser;
 789     protected WSDLDocument document;
 790     protected static final LocatorImpl NULL_LOCATOR = new LocatorImpl();
 791 }