|
Apache CXF example source code file (WSDLHelper.java)
The Apache CXF WSDLHelper.java source code
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.cxf.helpers;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.wsdl.Binding;
import javax.wsdl.BindingOperation;
import javax.wsdl.Definition;
import javax.wsdl.Input;
import javax.wsdl.Message;
import javax.wsdl.Operation;
import javax.wsdl.Output;
import javax.wsdl.Part;
import javax.wsdl.PortType;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
public class WSDLHelper {
public BindingOperation getBindingOperation(Definition def, String operationName) {
if (operationName == null) {
return null;
}
Iterator ite = def.getBindings().values().iterator();
while (ite.hasNext()) {
Binding binding = (Binding)ite.next();
Iterator ite1 = binding.getBindingOperations().iterator();
while (ite1.hasNext()) {
BindingOperation bop = (BindingOperation)ite1.next();
if (bop.getName().equals(operationName)) {
return bop;
}
}
}
return null;
}
public static String writeQName(Definition def, QName qname) {
return def.getPrefix(qname.getNamespaceURI()) + ":" + qname.getLocalPart();
}
public BindingOperation getBindingOperation(Binding binding, String operationName) {
if (operationName == null) {
return null;
}
List bindingOperations = binding.getBindingOperations();
for (Iterator iter = bindingOperations.iterator(); iter.hasNext();) {
BindingOperation bindingOperation = (BindingOperation)iter.next();
if (operationName.equals(bindingOperation.getName())) {
return bindingOperation;
}
}
return null;
}
public Map getParts(Operation operation, boolean out) {
Message message = null;
if (out) {
Output output = operation.getOutput();
message = output.getMessage();
} else {
Input input = operation.getInput();
message = input.getMessage();
}
return message.getParts() == null ? new HashMap() : message.getParts();
}
public List<PortType> getPortTypes(Definition def) {
List<PortType> portTypes = new ArrayList
Other Apache CXF examples (source code examples)Here is a short list of links related to this Apache CXF WSDLHelper.java source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.