src/share/jaxws_classes/com/sun/tools/internal/ws/processor/modeler/wsdl/PseudoSchemaBuilder.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


 111             is.setSystemId(sysId+(++i +1));
 112             b.schemas.add(is);
 113         }
 114 
 115 
 116         //TODO: uncomment after JAXB fixes the issue related to passing multiples of such bindings
 117         //add member submission EPR binding
 118 //        InputSource is1 = new InputSource(new ByteArrayInputStream(memberSubmissionEPR.getBytes()));
 119 //        is1.setSystemId(sysId+(++i + 1));
 120 //        b.schemas.add(is1);
 121 
 122         return b.schemas;
 123     }
 124 
 125 
 126     private PseudoSchemaBuilder(WSDLDocument _wsdl) {
 127         this.wsdlDocument = _wsdl;
 128     }
 129 
 130     private void build() {
 131         for(Iterator<Service> itr=wsdlDocument.getDefinitions().services(); itr.hasNext(); )
 132             build(itr.next());
 133     }

 134 
 135     private void build(Service service) {
 136         for( Iterator<Port> itr=service.ports(); itr.hasNext(); )
 137             build(itr.next() );
 138     }

 139 
 140     private void build(Port port) {
 141         if(wsdlModeler.isProvider(port))
 142             return;
 143         Binding binding = port.resolveBinding(wsdlDocument);
 144 
 145         SOAPBinding soapBinding =
 146                     (SOAPBinding)getExtensionOfType(binding, SOAPBinding.class);
 147         //lets try and see if its SOAP 1.2. dont worry about extension flag, its
 148         // handled much earlier
 149         if (soapBinding == null) {
 150                     soapBinding =
 151                             (SOAPBinding)getExtensionOfType(binding, SOAP12Binding.class);
 152         }
 153         if(soapBinding == null)
 154             return;
 155         PortType portType = binding.resolvePortType(wsdlDocument);
 156 
 157         QName bindingName = WSDLModelerBase.getQNameOf(binding);
 158 


 176             if(wsdlModeler.isAsync(portType, operation)){
 177                 buildAsync(portType, operation, bindingOperation);
 178             }
 179         }
 180     }
 181 
 182     /**
 183      * @param portType
 184      * @param operation
 185      * @param bindingOperation
 186      */
 187     private void buildAsync(PortType portType, Operation operation, BindingOperation bindingOperation) {
 188         String operationName = getCustomizedOperationName(operation);//operation.getName();
 189         if(operationName == null)
 190             return;
 191         Message outputMessage = null;
 192         if(operation.getOutput() != null)
 193             outputMessage = operation.getOutput().resolveMessage(wsdlDocument);
 194         if(outputMessage != null){
 195             List<MessagePart> allParts = new ArrayList<MessagePart>(outputMessage.getParts());
 196             if(options.additionalHeaders) {
 197                 List<MessagePart> addtionalHeaderParts = wsdlModeler.getAdditionHeaderParts(bindingOperation, outputMessage, false);
 198                 allParts.addAll(addtionalHeaderParts);
 199             }
 200             if(allParts.size() > 1)
 201                 build(getOperationName(operationName), allParts);
 202         }
 203 
 204     }
 205 
 206     private String getCustomizedOperationName(Operation operation) {
 207         JAXWSBinding jaxwsCustomization = (JAXWSBinding)getExtensionOfType(operation, JAXWSBinding.class);
 208         String operationName = (jaxwsCustomization != null)?((jaxwsCustomization.getMethodName() != null)?jaxwsCustomization.getMethodName().getName():null):null;
 209         if(operationName != null){
 210             if(Names.isJavaReservedWord(operationName)){
 211                 return null;
 212             }
 213 
 214             return operationName;
 215         }
 216         return operation.getName();


   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


 111             is.setSystemId(sysId+(++i +1));
 112             b.schemas.add(is);
 113         }
 114 
 115 
 116         //TODO: uncomment after JAXB fixes the issue related to passing multiples of such bindings
 117         //add member submission EPR binding
 118 //        InputSource is1 = new InputSource(new ByteArrayInputStream(memberSubmissionEPR.getBytes()));
 119 //        is1.setSystemId(sysId+(++i + 1));
 120 //        b.schemas.add(is1);
 121 
 122         return b.schemas;
 123     }
 124 
 125 
 126     private PseudoSchemaBuilder(WSDLDocument _wsdl) {
 127         this.wsdlDocument = _wsdl;
 128     }
 129 
 130     private void build() {
 131         for(Iterator<Service> itr=wsdlDocument.getDefinitions().services(); itr.hasNext(); ) {
 132             build(itr.next());
 133         }
 134     }
 135 
 136     private void build(Service service) {
 137         for( Iterator<Port> itr=service.ports(); itr.hasNext(); ) {
 138             build(itr.next() );
 139         }
 140     }
 141 
 142     private void build(Port port) {
 143         if(wsdlModeler.isProvider(port))
 144             return;
 145         Binding binding = port.resolveBinding(wsdlDocument);
 146 
 147         SOAPBinding soapBinding =
 148                     (SOAPBinding)getExtensionOfType(binding, SOAPBinding.class);
 149         //lets try and see if its SOAP 1.2. dont worry about extension flag, its
 150         // handled much earlier
 151         if (soapBinding == null) {
 152                     soapBinding =
 153                             (SOAPBinding)getExtensionOfType(binding, SOAP12Binding.class);
 154         }
 155         if(soapBinding == null)
 156             return;
 157         PortType portType = binding.resolvePortType(wsdlDocument);
 158 
 159         QName bindingName = WSDLModelerBase.getQNameOf(binding);
 160 


 178             if(wsdlModeler.isAsync(portType, operation)){
 179                 buildAsync(portType, operation, bindingOperation);
 180             }
 181         }
 182     }
 183 
 184     /**
 185      * @param portType
 186      * @param operation
 187      * @param bindingOperation
 188      */
 189     private void buildAsync(PortType portType, Operation operation, BindingOperation bindingOperation) {
 190         String operationName = getCustomizedOperationName(operation);//operation.getName();
 191         if(operationName == null)
 192             return;
 193         Message outputMessage = null;
 194         if(operation.getOutput() != null)
 195             outputMessage = operation.getOutput().resolveMessage(wsdlDocument);
 196         if(outputMessage != null){
 197             List<MessagePart> allParts = new ArrayList<MessagePart>(outputMessage.getParts());
 198             if(options != null && options.additionalHeaders) {
 199                 List<MessagePart> addtionalHeaderParts = wsdlModeler.getAdditionHeaderParts(bindingOperation, outputMessage, false);
 200                 allParts.addAll(addtionalHeaderParts);
 201             }
 202             if(allParts.size() > 1)
 203                 build(getOperationName(operationName), allParts);
 204         }
 205 
 206     }
 207 
 208     private String getCustomizedOperationName(Operation operation) {
 209         JAXWSBinding jaxwsCustomization = (JAXWSBinding)getExtensionOfType(operation, JAXWSBinding.class);
 210         String operationName = (jaxwsCustomization != null)?((jaxwsCustomization.getMethodName() != null)?jaxwsCustomization.getMethodName().getName():null):null;
 211         if(operationName != null){
 212             if(Names.isJavaReservedWord(operationName)){
 213                 return null;
 214             }
 215 
 216             return operationName;
 217         }
 218         return operation.getName();