index
int64
0
0
repo_id
stringlengths
9
205
file_path
stringlengths
31
246
content
stringlengths
1
12.2M
__index_level_0__
int64
0
10k
0
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/arrays3/AddrBookServiceImpl.java
package test.wsdl.arrays3; public class AddrBookServiceImpl implements AddrBookService { AddressBookImpl addressBook; public AddrBookServiceImpl() { addressBook = new AddressBookImpl(); } public void addEntry(String name, Address address) { addressBook.addEntry(name, address); } public Address[] getAddressFromNames(String[] name) { return addressBook.getAddressFromNames(name); } public Address getAddressFromName(String name) { return addressBook.getAddressFromName(name); } public Address[] echoAddresses(Address[] addrs) { return addrs; } }
6,700
0
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/arrays3/StateType.java
package test.wsdl.arrays3; public class StateType implements java.io.Serializable { private java.lang.String state; public StateType() { } public StateType( java.lang.String state) { this.state = state; } /** * Gets the state value for this StateType. * * @return state */ public java.lang.String getState() { return state; } /** * Sets the state value for this StateType. * * @param state */ public void setState(java.lang.String state) { this.state = state; } }
6,701
0
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/arrays3/AddressBookImpl.java
package test.wsdl.arrays3; import java.util.Hashtable; import java.util.Map; public class AddressBookImpl { private static Map addresses = new Hashtable(); public void addEntry(String name, Address address) { this.addresses.put(name, address); } public Address getAddressFromName(String name) { return (Address) this.addresses.get(name); } public Address[] getAddressFromNames(String[] name) { if (name == null) return null; Address[] result = new Address[name.length]; for(int i=0; i< name.length; i++) { result[i] = getAddressFromName(name[i]); } return result; } }
6,702
0
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/arrays3/Address.java
package test.wsdl.arrays3; public class Address implements java.io.Serializable { private String city; private Phone phoneNumber; private StateType state; private String streetName; private int streetNum; private int zip; private Phone[] otherPhones; public Address() { } /** * Gets the city value for this Address. * * @return city */ public java.lang.String getCity() { return city; } /** * Sets the city value for this Address. * * @param city */ public void setCity(java.lang.String city) { this.city = city; } /** * Gets the phoneNumber value for this Address. * * @return phoneNumber */ public Phone getPhoneNumber() { return phoneNumber; } /** * Sets the phoneNumber value for this Address. * * @param phoneNumber */ public void setPhoneNumber(Phone phoneNumber) { this.phoneNumber = phoneNumber; } /** * Gets the state value for this Address. * * @return state */ public StateType getState() { return state; } /** * Sets the state value for this Address. * * @param state */ public void setState(StateType state) { this.state = state; } /** * Gets the streetName value for this Address. * * @return streetName */ public java.lang.String getStreetName() { return streetName; } /** * Sets the streetName value for this Address. * * @param streetName */ public void setStreetName(java.lang.String streetName) { this.streetName = streetName; } /** * Gets the streetNum value for this Address. * * @return streetNum */ public int getStreetNum() { return streetNum; } /** * Sets the streetNum value for this Address. * * @param streetNum */ public void setStreetNum(int streetNum) { this.streetNum = streetNum; } /** * Gets the zip value for this Address. * * @return zip */ public int getZip() { return zip; } /** * Sets the zip value for this Address. * * @param zip */ public void setZip(int zip) { this.zip = zip; } public void setOtherPhones(Phone[] phones) { otherPhones = phones; } public Phone[] getOtherPhones() { return otherPhones; } }
6,703
0
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/arrays3/AddrBookService.java
package test.wsdl.arrays3; public interface AddrBookService extends java.rmi.Remote { public void addEntry(String name, Address address) throws java.rmi.RemoteException; public Address[] getAddressFromNames(String[] names) throws java.rmi.RemoteException; public Address getAddressFromName(String name) throws java.rmi.RemoteException; public Address[] echoAddresses(Address[] addrs) throws java.rmi.RemoteException; }
6,704
0
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/map
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/map/org/MapService.java
/* * Copyright 2002-2004 The Apache Software Foundation. * * Licensed 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 test.wsdl.map.org; import java.util.Map; /** * Test service for testing Map Schema in WSDL */ public class MapService { /** * echo the input Map */ public java.util.Map echoMap(Map in) { return in; } }
6,705
0
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/query
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/query/org/QueryTest.java
/** * QueryTestImpl.java * * Service that echos a ColdFusion MX query object. * */ package test.wsdl.query.org; public class QueryTest { /* echo query */ public QueryBean echoQuery(QueryBean argQuery) throws java.rmi.RemoteException { return argQuery; } }
6,706
0
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/query
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/query/org/QueryBean.java
/* * This is a ColdFusion QueryBean object, including meta data. */ package test.wsdl.query.org; import java.io.Serializable; /** * Representation of a ColdFusion qeury object for web services. */ public class QueryBean implements Serializable { public void setColumnList(String[] column_list) { this.column_list = column_list; } public String[] getColumnList() { return column_list; } public void setData(Object[][] data) { this.data = data; } public Object[][] getData() { return data; } private String[] column_list; private Object[][] data; // Type metadatae private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(QueryBean.class, true); // Axis 1.2.1 with a document/literal WSDL static { typeDesc.setXmlType(new javax.xml.namespace.QName("http://rpc.xml.coldfusion", "QueryBean")); org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("columnList"); elemField.setXmlName(new javax.xml.namespace.QName("http://rpc.xml.coldfusion", "columnList")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setNillable(true); elemField.setItemQName(new javax.xml.namespace.QName("urn:QueryTest", "item")); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("data"); elemField.setXmlName(new javax.xml.namespace.QName("http://rpc.xml.coldfusion", "data")); elemField.setXmlType(new javax.xml.namespace.QName("urn:QueryTest", "ArrayOf_xsd_anyType")); elemField.setNillable(true); elemField.setItemQName(new javax.xml.namespace.QName("urn:QueryTest", "item")); typeDesc.addFieldDesc(elemField); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } }
6,707
0
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/gateway
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/gateway/org/OutClass.java
package test.wsdl.gateway.org; public class OutClass { public String text; public int val; }
6,708
0
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/gateway
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/gateway/org/MyClass.java
package test.wsdl.gateway.org; /** * Test for Bug 14033 - bean property multi-dimensional arrays don't deserialize */ public class MyClass { public String[][] Values; }
6,709
0
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/gateway
Create_ds/axis-axis1-java/integration/src/main/java/test/wsdl/gateway/org/Gateway.java
package test.wsdl.gateway.org; public interface Gateway { public String test1(MyClass myClass); public MyClass test2(); public String[][] test3(); public String test4(String[][] param); }
6,710
0
Create_ds/axis-axis1-java/maven/java2wsdl-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/java2wsdl-maven-plugin/src/main/java/org/apache/axis/tools/maven/java2wsdl/GenerateWsdlMojo.java
/* * 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.axis.tools.maven.java2wsdl; import java.io.File; import org.apache.axis.wsdl.fromJava.Emitter; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; /** * Generates a WSDL description from a Java class. * * @goal generate-wsdl * @requiresDependencyResolution compile */ public class GenerateWsdlMojo extends AbstractGenerateWsdlMojo { protected void postProcess(Emitter emitter, File wsdlFile) throws MojoExecutionException, MojoFailureException { } }
6,711
0
Create_ds/axis-axis1-java/maven/java2wsdl-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/java2wsdl-maven-plugin/src/main/java/org/apache/axis/tools/maven/java2wsdl/AbstractGenerateWsdlMojo.java
/* * 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.axis.tools.maven.java2wsdl; import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.List; import org.apache.axis.tools.maven.shared.nsmap.Mapping; import org.apache.axis.tools.maven.shared.nsmap.MappingUtil; import org.apache.axis.wsdl.fromJava.Emitter; import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.project.MavenProject; import com.github.veithen.ulog.PlexusLoggerInjector; public abstract class AbstractGenerateWsdlMojo extends AbstractMojo { /** * @component */ // This is necessary to set up logging such that all messages logged by the Axis // libraries through commons logging are redirected to Plexus logs. PlexusLoggerInjector loggerInjector; /** * The maven project. * * @parameter expression="${project}" * @required * @readonly */ private MavenProject project; /** * The name of the class to generate a WSDL for. The class must be on the classpath. * * @parameter * @required */ private String className; /** * A list of classes to include in the schema generation. * * @parameter */ private String[] extraClasses; /** * The target namespace for the interface. * * @parameter * @required */ private String namespace; /** * Mappings of packages to namespaces. * * @parameter */ private Mapping[] mappings; /** * The style of the WSDL document: RPC, DOCUMENT or WRAPPED. * If RPC, a rpc/encoded wsdl is generated. If DOCUMENT, a * document/literal wsdl is generated. If WRAPPED, a * document/literal wsdl is generated using the wrapped approach. * * @parameter */ private String style; /** * Set the use option * * @parameter */ private String use; /** * The url of the location of the service. The name after the last slash or * backslash is the name of the service port (unless overridden by the -s * option). The service port address location attribute is assigned the * specified value. * * @parameter * @required */ private String location; /** * Indicates the name to use use for the portType element. If not specified, the * class-of-portType name is used. * * @parameter */ private String portTypeName; /** * The name of the output WSDL file. * * @parameter * @required */ private File output; protected MavenProject getProject() { return project; } public final void execute() throws MojoExecutionException, MojoFailureException { List classpath; try { classpath = project.getCompileClasspathElements(); } catch (DependencyResolutionRequiredException ex) { throw new MojoExecutionException("Unexpected exception", ex); } URL[] urls = new URL[classpath.size()]; for (int i=0; i<classpath.size(); i++) { try { urls[i] = new File((String)classpath.get(i)).toURL(); } catch (MalformedURLException ex) { throw new MojoExecutionException("Unexpected exception", ex); } } ClassLoader cl = new URLClassLoader(urls); Emitter emitter = new Emitter(); if (mappings != null && mappings.length > 0) { emitter.setNamespaceMap(MappingUtil.getPackageToNamespaceMap(mappings)); } try { emitter.setCls(cl.loadClass(className)); } catch (ClassNotFoundException ex) { throw new MojoFailureException("Class " + className + " not found"); } if (extraClasses != null) { Class[] loadedExtraClasses = new Class[extraClasses.length]; for (int i=0; i<extraClasses.length; i++) { try { loadedExtraClasses[i] = cl.loadClass(extraClasses[i]); } catch (ClassNotFoundException ex) { throw new MojoExecutionException("Extra class not found: " + extraClasses[i]); } } emitter.setExtraClasses(loadedExtraClasses); } if (style != null) { emitter.setStyle(style); } if (use != null) { emitter.setUse(use); } emitter.setIntfNamespace(namespace); emitter.setLocationUrl(location); if (portTypeName != null) { emitter.setPortTypeName(portTypeName); } output.getParentFile().mkdirs(); try { emitter.emit(output.getAbsolutePath(), Emitter.MODE_ALL); } catch (Exception ex) { throw new MojoFailureException("java2wsdl failed", ex); } postProcess(emitter, output); } protected abstract void postProcess(Emitter emitter, File wsdlFile) throws MojoExecutionException, MojoFailureException; }
6,712
0
Create_ds/axis-axis1-java/maven/java2wsdl-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/java2wsdl-maven-plugin/src/main/java/org/apache/axis/tools/maven/java2wsdl/DeployMojo.java
/* * 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.axis.tools.maven.java2wsdl; import java.io.File; import java.util.Collections; import java.util.Iterator; import java.util.Map; import org.apache.axis.wsdl.fromJava.Emitter; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.codehaus.plexus.compiler.Compiler; import org.codehaus.plexus.compiler.CompilerConfiguration; import org.codehaus.plexus.compiler.CompilerException; import org.codehaus.plexus.compiler.manager.CompilerManager; import org.codehaus.plexus.compiler.manager.NoSuchCompilerException; /** * Generate deployment artifacts (WSDD files and helper classes) for a code first Web service. The * goal will also compile the generated classes so that it can be used on a service that is built in * the same project. * * @goal deploy * @phase process-classes * @requiresDependencyResolution compile */ public class DeployMojo extends AbstractGenerateWsdlMojo { /** * @component */ private CompilerManager compilerManager; /** * @parameter expression="${project.build.outputDirectory}" * @required * @readonly */ private File outputDirectory; /** * The directory where the source code of the generated Java artifacts (helper classes) is * placed. * * @parameter default-value="${project.build.directory}/generated-sources/deploy" * @required */ private File sourceOutputDirectory; protected void postProcess(Emitter j2w, File wsdlFile) throws MojoExecutionException, MojoFailureException { // Generate the server side artifacts from the generated WSDL org.apache.axis.wsdl.toJava.Emitter w2j = new org.apache.axis.wsdl.toJava.Emitter(); w2j.setServiceDesc(j2w.getServiceDesc()); w2j.setQName2ClassMap(j2w.getQName2ClassMap()); w2j.setOutputDir(sourceOutputDirectory.getAbsolutePath()); w2j.setServerSide(true); w2j.setDeploy(true); w2j.setHelperWanted(true); // setup namespace-to-package mapping String ns = j2w.getIntfNamespace(); String clsName = j2w.getCls().getName(); int idx = clsName.lastIndexOf("."); String pkg = null; if (idx > 0) { pkg = clsName.substring(0, idx); w2j.getNamespaceMap().put(ns, pkg); } Map nsmap = j2w.getNamespaceMap(); if (nsmap != null) { for (Iterator i = nsmap.keySet().iterator(); i.hasNext(); ) { pkg = (String) i.next(); ns = (String) nsmap.get(pkg); w2j.getNamespaceMap().put(ns, pkg); } } // set 'deploy' mode w2j.setDeploy(true); if (j2w.getImplCls() != null) { w2j.setImplementationClassName(j2w.getImplCls().getName()); } else { if (!j2w.getCls().isInterface()) { w2j.setImplementationClassName(j2w.getCls().getName()); } else { throw new MojoFailureException("implementation class is not specified."); } } try { w2j.run(wsdlFile.getAbsolutePath()); } catch (Exception ex) { throw new MojoFailureException("Failed to generate deployment code", ex); } // We add the directory with the generated sources to the compile source roots even // if we compile the code ourselves. That is important when using eclipse:eclipse. getProject().addCompileSourceRoot(sourceOutputDirectory.getPath()); CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); compilerConfiguration.setOutputLocation(outputDirectory.getAbsolutePath()); compilerConfiguration.setSourceLocations(Collections.singletonList(sourceOutputDirectory.getAbsolutePath())); compilerConfiguration.setSourceVersion("1.4"); compilerConfiguration.setTargetVersion("1.4"); Compiler compiler; try { compiler = compilerManager.getCompiler("javac"); } catch (NoSuchCompilerException ex) { throw new MojoExecutionException("No such compiler '" + ex.getCompilerId() + "'."); } try { compiler.compile(compilerConfiguration); } catch (CompilerException ex) { throw new MojoExecutionException("Compilation failed.", ex); } } }
6,713
0
Create_ds/axis-axis1-java/maven/wsdd-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdd-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdd/GenerateWSDDMojo.java
/* * 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.axis.tools.maven.wsdd; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.Enumeration; import java.util.List; import org.apache.axis.model.wsdd.Deployment; import org.apache.axis.model.wsdd.WSDDUtil; import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.project.MavenProject; import org.xml.sax.InputSource; import com.github.veithen.ulog.PlexusLoggerInjector; /** * * * @goal generate-wsdd * @requiresDependencyResolution compile */ public class GenerateWSDDMojo extends AbstractMojo { /** * @component */ // This is necessary to set up logging such that all messages logged by the Axis // libraries through commons logging are redirected to Plexus logs. PlexusLoggerInjector loggerInjector; /** * The maven project. * * @parameter expression="${project}" * @required * @readonly */ private MavenProject project; /** * * * @parameter * @required */ private String type; /** * A set of WSDD files (typically generated by wsdl2java-maven-plugin) to be merged into the * output WSDD. If this parameter is not set, then the plug-in will just generate a default * configuration file. * * @parameter */ private File[] files; /** * * @parameter * @required */ private File output; public void execute() throws MojoExecutionException, MojoFailureException { // TODO: copy & paste from AbstractGenerateWsdlMojo List classpath; try { classpath = project.getCompileClasspathElements(); } catch (DependencyResolutionRequiredException ex) { throw new MojoExecutionException("Unexpected exception", ex); } URL[] urls = new URL[classpath.size()]; for (int i=0; i<classpath.size(); i++) { try { urls[i] = new File((String)classpath.get(i)).toURL(); } catch (MalformedURLException ex) { throw new MojoExecutionException("Unexpected exception", ex); } } ClassLoader cl = new URLClassLoader(urls); Deployment deployment; getLog().info("Loading default configuration"); try { deployment = WSDDUtil.buildDefaultConfiguration(cl, type); } catch (IOException ex) { throw new MojoFailureException("Unable to build default configuration", ex); } if (files != null) { // Load WSDD files from plug-in configuration for (int i=0; i<files.length; i++) { File file = files[i]; getLog().info("Loading " + file); try { deployment.merge(WSDDUtil.load(new InputSource(file.toURL().toString()))); } catch (Exception ex) { throw new MojoFailureException("Failed to process " + file, ex); } } } getLog().info("Writing " + output); output.getParentFile().mkdirs(); try { FileOutputStream out = new FileOutputStream(output); try { WSDDUtil.save(deployment, out); } finally { out.close(); } } catch (Exception ex) { throw new MojoFailureException("Failed to write " + output, ex); } } }
6,714
0
Create_ds/axis-axis1-java/maven/nsmap/src/main/java/org/apache/axis/tools/maven/shared
Create_ds/axis-axis1-java/maven/nsmap/src/main/java/org/apache/axis/tools/maven/shared/nsmap/MappingUtil.java
/* * 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.axis.tools.maven.shared.nsmap; import java.util.HashMap; import java.util.Map; /** * @author Andreas Veithen */ public final class MappingUtil { private MappingUtil() {} // TODO: this returns a HashMap because the toJava emitter expects a HashMap (bad!) public static HashMap getNamespaceToPackageMap(Mapping[] mappings) { HashMap namespaceMap = new HashMap(); for (int i=0; i<mappings.length; i++) { namespaceMap.put(mappings[i].getNamespace(), mappings[i].getPackage()); } return namespaceMap; } public static Map getPackageToNamespaceMap(Mapping[] mappings) { HashMap namespaceMap = new HashMap(); for (int i=0; i<mappings.length; i++) { namespaceMap.put(mappings[i].getPackage(), mappings[i].getNamespace()); } return namespaceMap; } }
6,715
0
Create_ds/axis-axis1-java/maven/nsmap/src/main/java/org/apache/axis/tools/maven/shared
Create_ds/axis-axis1-java/maven/nsmap/src/main/java/org/apache/axis/tools/maven/shared/nsmap/Mapping.java
/* * 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.axis.tools.maven.shared.nsmap; public class Mapping { private String namespace; private String packageName; public String getNamespace() { return namespace; } public void setNamespace(String namespace) { this.namespace = namespace; } public String getPackage() { return packageName; } public void setPackage(String packageName) { this.packageName = packageName; } public String toString() { return "(" + namespace + "|" + packageName + ")"; } }
6,716
0
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven/server/RemoteDaemon.java
/* * 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.axis.tools.maven.server; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.Writer; import java.net.InetAddress; import java.net.Socket; import org.codehaus.plexus.logging.Logger; public class RemoteDaemon { private final Process process; private final String description; private final int controlPort; private BufferedReader controlIn; private Writer controlOut; public RemoteDaemon(Process process, String description, int controlPort) { this.process = process; this.description = description; this.controlPort = controlPort; } public Process getProcess() { return process; } public String getDescription() { return description; } public void startDaemon(Logger logger) throws Exception { logger.debug("Attempting to establish control connection on port " + controlPort); Socket controlSocket; while (true) { try { controlSocket = new Socket(InetAddress.getByName("localhost"), controlPort); break; } catch (IOException ex) { try { int exitValue = process.exitValue(); throw new IllegalStateException("Process terminated prematurely with exit code " + exitValue); } catch (IllegalThreadStateException ex2) { // Process is still running; continue } Thread.sleep(100); } } logger.debug("Control connection established"); controlIn = new BufferedReader(new InputStreamReader(controlSocket.getInputStream(), "ASCII")); controlOut = new OutputStreamWriter(controlSocket.getOutputStream(), "ASCII"); logger.debug("Waiting for daemon to become ready"); expectStatus("READY"); logger.debug("Daemon is ready"); } public void stopDaemon(Logger logger) throws Exception { controlOut.write("STOP\r\n"); controlOut.flush(); expectStatus("STOPPED"); } private void expectStatus(String expectedStatus) throws IOException { String status = controlIn.readLine(); if (status == null) { throw new IllegalStateException("Control connection unexpectedly closed"); } else if (!status.equals(expectedStatus)) { throw new IllegalStateException("Unexpected status: " + status); } } }
6,717
0
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven/server/FileSet.java
/* * 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.axis.tools.maven.server; import java.io.File; import org.codehaus.plexus.util.DirectoryScanner; public class FileSet { private File directory; private String[] includes; private String[] excludes; public File getDirectory() { return directory; } public void setDirectory(File directory) { this.directory = directory; } public String[] getIncludes() { return includes; } public void setIncludes(String[] includes) { this.includes = includes; } public String[] getExcludes() { return excludes; } public void setExcludes(String[] excludes) { this.excludes = excludes; } public DirectoryScanner createScanner() { DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir(directory); scanner.setIncludes(includes); scanner.setExcludes(excludes); return scanner; } }
6,718
0
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven/server/AbstractStartDaemonMojo.java
/* * 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.axis.tools.maven.server; import java.io.File; import java.io.IOException; import java.net.ServerSocket; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.resolver.ArtifactCollector; import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.ArtifactResolver; import org.apache.maven.artifact.resolver.DebugResolutionListener; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.project.artifact.InvalidDependencyVersionException; import org.apache.maven.toolchain.Toolchain; import org.apache.maven.toolchain.ToolchainManager; import org.codehaus.plexus.logging.LogEnabled; import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.util.StringUtils; public abstract class AbstractStartDaemonMojo extends AbstractDaemonControlMojo implements LogEnabled { /** * The maven project. * * @parameter expression="${project}" * @required * @readonly */ private MavenProject project; /** * The current build session instance. This is used for toolchain manager API calls. * * @parameter default-value="${session}" * @required * @readonly */ private MavenSession session; /** * @component */ private MavenProjectBuilder projectBuilder; /** * Local maven repository. * * @parameter expression="${localRepository}" * @required * @readonly */ private ArtifactRepository localRepository; /** * Remote repositories. * * @parameter expression="${project.remoteArtifactRepositories}" * @required * @readonly */ private List remoteArtifactRepositories; /** * @component */ private ArtifactFactory artifactFactory; /** * @component */ private ArtifactResolver artifactResolver; /** * @component */ private ArtifactCollector artifactCollector; /** * @component */ private ArtifactMetadataSource artifactMetadataSource; /** * @component */ private ToolchainManager toolchainManager; /** * The arguments to pass to the JVM when debug mode is enabled. * * @parameter default-value="-Xdebug -Xrunjdwp:transport=dt_socket,address=8899,server=y,suspend=y" */ private String debugArgs; /** * Indicates whether the Java process should be started in debug mode. This flag should only be * set from the command line. * * @parameter expression="${axis.server.debug}" default-value="false" */ private boolean debug; /** * The arguments to pass to the JVM when JMX is enabled. * * @parameter default-value="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" */ private String jmxArgs; /** * Indicates whether the Java process should be started with remote JMX enabled. This flag * should only be set from the command line. * * @parameter expression="${axis.server.jmx}" default-value="false" */ private boolean jmx; /** * Arbitrary JVM options to set on the command line. Note that this parameter uses the same * expression as the Surefire and Failsafe plugins. By setting the <code>argLine</code> * property, it is therefore possible to easily pass a common set of JVM options to all * processes involved in the tests. Since the JaCoCo Maven plugin also sets this property, code * coverage generated on the server-side will be automatically included in the analysis. * * @parameter expression="${argLine}" */ private String argLine; /** * @parameter default-value="${plugin.version}" * @required * @readonly */ private String axisVersion; private final Set/*<Artifact>*/ additionalDependencies = new HashSet(); private List/*<File>*/ classpath; private Logger logger; public final void enableLogging(Logger logger) { this.logger = logger; } protected final void addDependency(String groupId, String artifactId, String version) { additionalDependencies.add(artifactFactory.createArtifact(groupId, artifactId, version, Artifact.SCOPE_TEST, "jar")); classpath = null; } protected final void addAxisDependency(String artifactId) { addDependency("org.apache.axis", artifactId, axisVersion); } protected final List/*<File>*/ getClasspath() throws ProjectBuildingException, InvalidDependencyVersionException, ArtifactResolutionException, ArtifactNotFoundException { if (classpath == null) { final Log log = getLog(); // We need dependencies in scope test. Since this is the largest scope, we don't need // to do any additional filtering based on dependency scope. Set projectDependencies = project.getArtifacts(); final Set artifacts = new HashSet(projectDependencies); if (additionalDependencies != null) { for (Iterator it = additionalDependencies.iterator(); it.hasNext(); ) { Artifact a = (Artifact)it.next(); if (log.isDebugEnabled()) { log.debug("Resolving artifact to be added to classpath: " + a); } ArtifactFilter filter = new ArtifactFilter() { public boolean include(Artifact artifact) { String id = artifact.getDependencyConflictId(); for (Iterator it = artifacts.iterator(); it.hasNext(); ) { if (id.equals(((Artifact)it.next()).getDependencyConflictId())) { return false; } } return true; } }; MavenProject p = projectBuilder.buildFromRepository(a, remoteArtifactRepositories, localRepository); if (filter.include(p.getArtifact())) { Set s = p.createArtifacts(artifactFactory, Artifact.SCOPE_RUNTIME, filter); artifacts.addAll(artifactCollector.collect(s, p.getArtifact(), p.getManagedVersionMap(), localRepository, remoteArtifactRepositories, artifactMetadataSource, filter, Collections.singletonList(new DebugResolutionListener(logger))).getArtifacts()); artifacts.add(p.getArtifact()); } } } classpath = new ArrayList(); classpath.add(new File(project.getBuild().getTestOutputDirectory())); classpath.add(new File(project.getBuild().getOutputDirectory())); for (Iterator it = artifacts.iterator(); it.hasNext(); ) { Artifact a = (Artifact)it.next(); if (a.getArtifactHandler().isAddedToClasspath()) { if (a.getFile() == null) { artifactResolver.resolve(a, remoteArtifactRepositories, localRepository); } classpath.add(a.getFile()); } } } return classpath; } private int allocatePort() throws MojoFailureException { try { ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); return port; } catch (IOException ex) { throw new MojoFailureException("Failed to allocate port number", ex); } } protected final void startDaemon(String description, String daemonClass, String[] args, File workDir) throws MojoExecutionException, MojoFailureException { Log log = getLog(); // Locate java executable to use String jvm; Toolchain tc = toolchainManager.getToolchainFromBuildContext("jdk", session); if (tc != null) { jvm = tc.findTool("java"); } else { jvm = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; } if (log.isDebugEnabled()) { log.debug("Java executable: " + jvm); } int controlPort = allocatePort(); // Get class path List classpath; try { classpath = getClasspath(); } catch (Exception ex) { throw new MojoExecutionException("Failed to build classpath", ex); } if (log.isDebugEnabled()) { log.debug("Class path elements: " + classpath); } // Compute JVM arguments List vmArgs = new ArrayList(); if (debug) { processVMArgs(vmArgs, debugArgs); } if (jmx) { processVMArgs(vmArgs, jmxArgs); } if (argLine != null) { processVMArgs(vmArgs, argLine); } if (log.isDebugEnabled()) { log.debug("Additional VM args: " + vmArgs); } List cmdline = new ArrayList(); cmdline.add(jvm); cmdline.add("-cp"); cmdline.add(StringUtils.join(classpath.iterator(), File.pathSeparator)); cmdline.addAll(vmArgs); cmdline.add("org.apache.axis.tools.daemon.Launcher"); cmdline.add(daemonClass); cmdline.add(String.valueOf(controlPort)); cmdline.addAll(Arrays.asList(args)); try { getDaemonManager().startDaemon( description, (String[])cmdline.toArray(new String[cmdline.size()]), workDir, controlPort); } catch (Exception ex) { throw new MojoFailureException("Failed to start server", ex); } } private static void processVMArgs(List vmArgs, String args) { vmArgs.addAll(Arrays.asList(args.split(" "))); } protected final void doExecute() throws MojoExecutionException, MojoFailureException { addAxisDependency("daemon-launcher"); doStartDaemon(); } protected abstract void doStartDaemon() throws MojoExecutionException, MojoFailureException; }
6,719
0
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven/server/AbstractDaemonControlMojo.java
/* * 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.axis.tools.maven.server; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import com.github.veithen.ulog.PlexusLoggerInjector; public abstract class AbstractDaemonControlMojo extends AbstractMojo { /** * @component */ // This is necessary to set up logging such that all messages logged by the Axis // libraries through commons logging are redirected to Plexus logs. PlexusLoggerInjector loggerInjector; /** * @component */ private DaemonManager daemonManager; /** * Set this to <code>true</code> to skip running tests, but still compile them. This is the same * flag that is also used by the Surefire and Failsafe plugins. * * @parameter expression="${skipTests}" default-value="false" */ private boolean skipTests; public final DaemonManager getDaemonManager() { return daemonManager; } public final void execute() throws MojoExecutionException, MojoFailureException { if (skipTests) { getLog().info("Tests are skipped."); } else { doExecute(); } } protected abstract void doExecute() throws MojoExecutionException, MojoFailureException; }
6,720
0
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven/server/DaemonManager.java
/* * 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.axis.tools.maven.server; import java.io.File; public interface DaemonManager { void startDaemon(String description, String[] cmdline, File workDir, int controlPort) throws Exception; void stopAll() throws Exception; }
6,721
0
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven/server/DefaultDaemonManager.java
/* * 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.axis.tools.maven.server; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import org.codehaus.plexus.logging.LogEnabled; import org.codehaus.plexus.logging.Logger; public class DefaultDaemonManager implements DaemonManager, LogEnabled { private final List daemons = new ArrayList(); private Logger logger; public void enableLogging(Logger logger) { this.logger = logger; } public void startDaemon(String description, String[] cmdline, File workDir, int controlPort) throws Exception { if (logger.isDebugEnabled()) { logger.debug("Starting process with command line: " + Arrays.asList(cmdline)); } Process process = Runtime.getRuntime().exec(cmdline, null, workDir); RemoteDaemon daemon = new RemoteDaemon(process, description, controlPort); daemons.add(daemon); new Thread(new StreamPump(process.getInputStream(), System.out)).start(); new Thread(new StreamPump(process.getErrorStream(), System.err)).start(); daemon.startDaemon(logger); } public void stopAll() throws Exception { Exception savedException = null; for (Iterator it = daemons.iterator(); it.hasNext(); ) { RemoteDaemon daemon = (RemoteDaemon)it.next(); if (logger.isDebugEnabled()) { logger.debug("Stopping " + daemon.getDescription()); } boolean success; try { daemon.stopDaemon(logger); success = true; } catch (Exception ex) { if (savedException == null) { savedException = ex; } success = false; } if (logger.isDebugEnabled()) { logger.debug("success = " + success); } if (success) { daemon.getProcess().waitFor(); } else { daemon.getProcess().destroy(); } logger.info(daemon.getDescription() + " stopped"); } // TODO: need to clear the collection because the same ServerManager instance may be used by multiple projects in a reactor build; // note that this means that the plugin is not thread safe (i.e. doesn't support parallel builds in Maven 3) daemons.clear(); if (savedException != null) { throw savedException; } } }
6,722
0
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven/server/StreamPump.java
/* * 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.axis.tools.maven.server; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class StreamPump implements Runnable { private final InputStream in; private final OutputStream out; public StreamPump(InputStream in, OutputStream out) { this.in = in; this.out = out; } public void run() { try { byte[] buffer = new byte[4096]; int c; while ((c = in.read(buffer)) != -1) { out.write(buffer, 0, c); } } catch (IOException ex) { ex.printStackTrace(); } } }
6,723
0
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven/server/StartServerMojo.java
/* * 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.axis.tools.maven.server; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.List; import org.apache.axis.model.wsdd.Deployment; import org.apache.axis.model.wsdd.WSDDUtil; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.codehaus.plexus.util.DirectoryScanner; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.StringUtils; import org.xml.sax.InputSource; /** * Start a <code>org.apache.axis.server.standalone.StandaloneAxisServer</code> instance in a separate * JVM. * * @goal start-server * @phase pre-integration-test * @requiresDependencyResolution test */ public class StartServerMojo extends AbstractStartWebServerMojo { /** * @parameter default-value="${project.build.directory}/axis-server" * @required * @readonly */ private File workDirBase; /** * The maximum number of concurrently active sessions. * * @parameter default-value="100" */ private int maxSessions; /** * A set of WSDD files for services to deploy. * * @parameter */ private FileSet[] wsdds; /** * A set of directories to look up JWS files from. * * @parameter */ private File[] jwsDirs; /** * A set of config files to copy to the <tt>WEB-INF</tt> dir. An example of a config file * would be <tt>users.lst</tt> used by <code>SimpleSecurityProvider</code>. * * @parameter */ private FileSet[] configs; protected void doStartDaemon(int port) throws MojoExecutionException, MojoFailureException { // Need to setup additional dependencies before building the default configuration! addAxisDependency("axis-standalone-server"); if (jwsDirs != null && jwsDirs.length > 0) { addAxisDependency("axis-rt-jws"); } // Prepare a work directory where we can place the server-config.wsdd file File workDir = new File(workDirBase, String.valueOf(port)); if (workDir.exists()) { try { FileUtils.deleteDirectory(workDir); } catch (IOException ex) { throw new MojoFailureException("Failed to clean the work directory", ex); } } File webInfDir = new File(workDir, "WEB-INF"); webInfDir.mkdirs(); // Start with the default configuration (which depends on the JARs in the classpath) Deployment deployment; try { deployment = WSDDUtil.buildDefaultConfiguration(buildClassLoader(), "server"); } catch (IOException ex) { throw new MojoExecutionException("Failed to build default server configuration", ex); } // Select WSDD files if (wsdds != null) { for (int i=0; i<wsdds.length; i++) { FileSet wsdd = wsdds[i]; DirectoryScanner scanner = wsdd.createScanner(); scanner.scan(); String[] includedFiles = scanner.getIncludedFiles(); for (int j=0; j<includedFiles.length; j++) { File wsddFile = new File(wsdd.getDirectory(), includedFiles[j]); try { deployment.merge(WSDDUtil.load(new InputSource(wsddFile.toURI().toString()))); } catch (IOException ex) { throw new MojoExecutionException("Failed to load " + wsddFile, ex); } getLog().info("Processed " + wsddFile); } } } // Write the server-config.wsdd file File serverConfigWsdd = new File(webInfDir, "server-config.wsdd"); try { FileOutputStream out = new FileOutputStream(serverConfigWsdd); try { WSDDUtil.save(deployment, out); } finally { out.close(); } } catch (IOException ex) { throw new MojoExecutionException("Failed to write " + serverConfigWsdd, ex); } if (configs != null && configs.length > 0) { for (int i=0; i<configs.length; i++) { FileSet config = configs[i]; DirectoryScanner scanner = config.createScanner(); scanner.scan(); String[] includedFiles = scanner.getIncludedFiles(); for (int j=0; j<includedFiles.length; j++) { String includedFile = includedFiles[j]; File source = new File(config.getDirectory(), includedFile); try { FileUtils.copyFile(source, new File(webInfDir, includedFile)); } catch (IOException ex) { throw new MojoFailureException("Unable to copy " + source, ex); } } } } // Start the server List args = new ArrayList(); args.add("-p"); args.add(String.valueOf(port)); args.add("-w"); args.add(workDir.getAbsolutePath()); if (jwsDirs != null && jwsDirs.length > 0) { args.add("-j"); args.add(StringUtils.join(jwsDirs, File.pathSeparator)); } args.add("-m"); args.add(String.valueOf(maxSessions)); try { startDaemon( "Server on port " + port, "org.apache.axis.server.standalone.daemon.AxisServerDaemon", (String[])args.toArray(new String[args.size()]), workDir); } catch (Exception ex) { throw new MojoFailureException("Failed to start server", ex); } } private ClassLoader buildClassLoader() throws MojoExecutionException { List classpath; try { classpath = getClasspath(); } catch (Exception ex) { throw new MojoExecutionException("Failed to build classpath", ex); } URL[] urls = new URL[classpath.size()]; for (int i=0; i<classpath.size(); i++) { try { urls[i] = ((File)classpath.get(i)).toURI().toURL(); } catch (MalformedURLException ex) { throw new MojoExecutionException("Unexpected exception", ex); } } return new URLClassLoader(urls); } }
6,724
0
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven/server/StopAllMojo.java
/* * 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.axis.tools.maven.server; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; /** * Stop all processes created by {@link StartServerMojo}. * * @goal stop-all * @phase post-integration-test */ public class StopAllMojo extends AbstractDaemonControlMojo { protected void doExecute() throws MojoExecutionException, MojoFailureException { try { getDaemonManager().stopAll(); } catch (Exception ex) { throw new MojoFailureException("Errors occurred while attempting to stop processes", ex); } } }
6,725
0
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven/server/AbstractStartWebServerMojo.java
/* * 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.axis.tools.maven.server; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.logging.Log; public abstract class AbstractStartWebServerMojo extends AbstractStartDaemonMojo { /** * The HTTP port. * * @parameter default-value="8080" * @required */ private int port; /** * If this flag is set to <code>true</code>, then the execution of the goal will block after the * server has been started. This is useful if one wants to manually test some services deployed * on the server or if one wants to run the integration tests from an IDE. The flag should only * be set using the command line, but not in the POM. * * @parameter expression="${axis.server.foreground}" default-value="false" */ // Note: this feature is implemented using a flag (instead of a distinct goal) to make sure that // the server is configured in exactly the same way as in a normal integration test execution. private boolean foreground; /** * Specifies an alternate port number that will override {@link #port} if {@link #foreground} is * set to <code>true</code>. This parameter should be used if the port number configured with * the {@link #port} parameter is allocated dynamically. This makes it easier to run integration * tests from an IDE. For more information, see the <a href="usage.html">usage * documentation</a>. * * @parameter */ private int foregroundPort = -1; protected final void doStartDaemon() throws MojoExecutionException, MojoFailureException { Log log = getLog(); doStartDaemon(foreground && foregroundPort != -1 ? foregroundPort : port); if (foreground) { log.info("Server started in foreground mode. Press CRTL-C to stop."); Object lock = new Object(); synchronized (lock) { try { lock.wait(); } catch (InterruptedException ex) { // Set interrupt flag and continue Thread.currentThread().interrupt(); } } } } protected abstract void doStartDaemon(int port) throws MojoExecutionException, MojoFailureException; }
6,726
0
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven/server/StartDaemonMojo.java
/* * 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.axis.tools.maven.server; import java.io.File; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; /** * Start a daemon. * * @goal start-daemon * @phase pre-integration-test * @requiresDependencyResolution test */ public class StartDaemonMojo extends AbstractStartDaemonMojo { /** * The daemon class. * * @parameter * @required */ private String daemonClass; /** * The arguments to be passed to the main class. * * @parameter */ private String[] args; /** * The working directory for the process. * * @parameter default-value="${project.build.directory}/work" * @required */ private File workDir; protected void doStartDaemon() throws MojoExecutionException, MojoFailureException { workDir.mkdirs(); startDaemon(daemonClass, daemonClass, args, workDir); } }
6,727
0
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/axis-server-maven-plugin/src/main/java/org/apache/axis/tools/maven/server/StartWebAppMojo.java
/* * 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.axis.tools.maven.server; import java.io.File; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.codehaus.plexus.util.StringUtils; /** * * * @goal start-webapp * @phase pre-integration-test * @requiresDependencyResolution test */ public class StartWebAppMojo extends AbstractStartWebServerMojo { /** * * * @parameter * @required */ private File[] resourceBases; protected void doStartDaemon(int port) throws MojoExecutionException, MojoFailureException { addAxisDependency("jetty-daemon"); startDaemon("HTTP server on port " + port, "org.apache.axis.tools.daemon.jetty.WebAppDaemon", new String[] { "-p", String.valueOf(port), "-r", StringUtils.join(resourceBases, File.pathSeparator) }, new File(".")); } }
6,728
0
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/AbstractWsdl2JavaMojo.java
/* * 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.axis.tools.maven.wsdl2java; import java.io.File; import java.net.MalformedURLException; import javax.xml.namespace.QName; import javax.xml.rpc.ServiceFactory; import org.apache.axis.constants.Scope; import org.apache.axis.tools.maven.shared.nsmap.Mapping; import org.apache.axis.tools.maven.shared.nsmap.MappingUtil; import org.apache.axis.wsdl.gen.GeneratorFactory; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.project.MavenProject; import org.apache.xml.resolver.CatalogManager; import org.apache.xml.resolver.tools.CatalogResolver; import com.github.veithen.ulog.PlexusLoggerInjector; public abstract class AbstractWsdl2JavaMojo extends AbstractMojo { /** * @component */ // This is necessary to set up logging such that all messages logged by the Axis // libraries through commons logging are redirected to Plexus logs. PlexusLoggerInjector loggerInjector; /** * The maven project. * * @parameter expression="${project}" * @required * @readonly */ private MavenProject project; /** * The WSDL file to process. * * @parameter */ private File file; /** * The URL of the WSDL to process. This should only be used for remote WSDLs. For local files, * use the <code>file</code> parameter. * * @parameter */ private String url; /** * The catalog file to resolve external entity references. This can be any type of catalog * supported by <a * href="http://xerces.apache.org/xml-commons/components/resolver/">xml-resolver</a>. * * @parameter */ private File catalog; /** * Determines the scope that will be specified for the service in the deployment WSDD. Valid * values are <code>application</code>, <code>request</code> and <code>session</code>. This * parameter has no effect if {@link #generate} is set to <code>client</code> or if * {@link #deployWsdd} is not specified. If this parameter is not specified, then no explicit * scope will be configured in the deployment WSDD, in which case the scope defaults to * <code>request</code>. * <br> * Note that these semantics (in particular the default scope <code>request</code>) are * compatible with the <code>deployScope</code> parameter of the wsdl2java Ant task. This * simplifies the migration of Ant builds to Maven. However, for most services, * <code>application</code> is a more reasonable setting. * * @parameter */ private String deployScope; /** * Mappings of namespaces to packages. * * @parameter */ private Mapping[] mappings; /** * The default type mapping registry to use. Either 1.1 or 1.2. * * @parameter default-value="1.2" */ private String typeMappingVersion; /** * Specifies what artifacts should be generated. Valid values are: * <ul> * <li><code>client</code>: generate client stubs * <li><code>server</code>: generate server side artifacts * <li><code>both</code>: generate all artifacts * </ul> * The <code>server</code> mode can also be used for clients that rely on dynamic proxies * created using the JAX-RPC {@link ServiceFactory} API, because they don't need client stubs. * <br> * Also note that the <code>both</code> mode is only really meaningful if {@link #skeleton} is * set to <code>true</code> or if {@link #deployWsdd} is specified. If none of these conditions * is satisfied, then <code>client</code> and <code>both</code> will generate the same set of * artifacts. * * @parameter * @required */ private String generate; /** * Set the name of the class implementing the web service. This parameter is ignored if * {@link #generate} is set to <code>client</code>. If this parameter is not specified, then a * default class name will be chosen if necessary. * * @parameter */ private String implementationClassName; /** * Specifies whether a skeleton should be generated. If this parameter is set to * <code>false</code>, a skeleton will not be generated. Instead, the generated deployment WSDD * will indicate that the implementation class is deployed directly. In such cases, the WSDD * contains extra meta data describing the operations and parameters of the implementation * class. This parameter is ignored if {@link #generate} is set to <code>client</code>. * * @parameter default-value="false" */ private boolean skeleton; /** * flag to generate code for all elements, even unreferenced ones * * @parameter default-value="false" */ private boolean all; /** * Set the wrap arrays flag - if true this will make new classes * like "ArrayOfString" for literal "wrapped" arrays. Otherwise it * will use "String []" and generate appropriate metadata. * * @parameter default-value="false" */ private boolean wrapArrays; /** * Set the noWrapped flag. * * @parameter default-value="false" */ private boolean noWrapped; /** * Turn on/off Helper class generation. * * @parameter default-value="false" */ private boolean helperGen; /** * * * @parameter default-value="false" */ private boolean allowInvalidURL; /** * The location of the deployment WSDD file to be generated. This parameter is ignored if * {@link #generate} is set to <code>client</code>. If this parameter is not specified, then no * deployment WSDD will be generated. * * @parameter */ private File deployWsdd; /** * The location of the undeployment WSDD file to be generated. This parameter is ignored if * {@link #generate} is set to <code>client</code>. If this parameter is not specified, then no * undeployment WSDD will be generated. Note that (in contrast to {@link #deployWsdd}) this * parameter is rarely used: in general, no undeployment WSDD is required. * * @parameter */ private File undeployWsdd; /** * A set of Java to XML type mappings that override the default mappings. This can be used to * <a href="java-xml-type-mappings.html">change the Java class associated with an XML type</a>. * * @parameter */ private JavaXmlTypeMapping[] javaXmlTypeMappings; public void execute() throws MojoExecutionException, MojoFailureException { String wsdlUrl; if (file != null && url != null) { throw new MojoFailureException("Invalid plugin configuration: either use file or url, but not both!"); } else if (file != null) { try { wsdlUrl = file.toURL().toExternalForm(); } catch (MalformedURLException ex) { throw new MojoExecutionException("Unexpected exception", ex); } } else if (url != null) { wsdlUrl = url; } else { throw new MojoFailureException("Invalid plugin configuration: file or url must be given!"); } // Instantiate the emitter EmitterEx emitter = new EmitterEx(); if (generate.equals("client")) { emitter.setClientSide(true); emitter.setServerSide(false); } else if (generate.equals("server")) { emitter.setClientSide(false); emitter.setServerSide(true); } else if (generate.equals("both")) { emitter.setClientSide(true); emitter.setServerSide(true); } else { throw new MojoExecutionException("Invalid value '" + generate + "' for the 'generate' parameter"); } if (deployWsdd != null) { emitter.setDeployWsdd(deployWsdd.getAbsolutePath()); } if (undeployWsdd != null) { emitter.setUndeployWsdd(undeployWsdd.getAbsolutePath()); } emitter.setFactory(new JavaGeneratorFactoryEx(emitter)); //extract the scope Scope scope = Scope.getScope(deployScope, null); if (scope != null) { emitter.setScope(scope); } else if (deployScope != null) { getLog().warn("Unrecognized scope: " + deployScope + ". Ignoring it."); } //do the mappings, with namespaces mapped as the key if (mappings != null && mappings.length > 0) { emitter.setNamespaceMap(MappingUtil.getNamespaceToPackageMap(mappings)); } // emitter.setTestCaseWanted(testCase); emitter.setHelperWanted(helperGen); // emitter.setNamespaceIncludes(nsIncludes); // emitter.setNamespaceExcludes(nsExcludes); // emitter.setProperties(properties); // emitter.setImports(!noImports); emitter.setAllWanted(all); emitter.setSkeletonWanted(skeleton); // emitter.setVerbose(verbose); // emitter.setDebug(debug); // emitter.setQuiet(quiet); emitter.setTypeMappingVersion(typeMappingVersion); emitter.setNowrap(noWrapped); emitter.setAllowInvalidURL(allowInvalidURL); emitter.setWrapArrays(wrapArrays); // if (namespaceMappingFile != null) { // emitter.setNStoPkg(namespaceMappingFile.toString()); // } // emitter.setTimeout(timeout); emitter.setImplementationClassName(implementationClassName); // Authenticator.setDefault(new DefaultAuthenticator(username, password)); // if (classpath != null) { // AntClassLoader cl = new AntClassLoader( // getClass().getClassLoader(), // getProject(), // classpath, // false); // log("Using CLASSPATH " + cl.getClasspath(), // Project.MSG_VERBOSE); // ClassUtils.setDefaultClassLoader(cl); // } if (javaXmlTypeMappings != null && javaXmlTypeMappings.length > 0) { GeneratorFactory factory = emitter.getFactory(); CustomizableBaseTypeMapping btm = new CustomizableBaseTypeMapping(factory.getBaseTypeMapping()); for (int i=0; i<javaXmlTypeMappings.length; i++) { String xmlTypeName = javaXmlTypeMappings[i].getXmlType(); if (xmlTypeName.length() == 0 || xmlTypeName.charAt(0) != '{') { throw new MojoFailureException("Invalid XML type '" + xmlTypeName + "'"); } int idx = xmlTypeName.indexOf('}', 1); if (idx == -1) { throw new MojoFailureException("Invalid XML type '" + xmlTypeName + "'"); } btm.addMapping(new QName(xmlTypeName.substring(1, idx), xmlTypeName.substring(idx+1)), javaXmlTypeMappings[i].getJavaType()); } factory.setBaseTypeMapping(btm); } configureEmitter(emitter); if (catalog != null) { CatalogManager catalogManager = new CatalogManager(); catalogManager.setCatalogFiles(catalog.getAbsolutePath()); emitter.setEntityResolver(new CatalogResolver(catalogManager)); } getLog().info("Processing " + wsdlUrl); try { emitter.run(wsdlUrl); } catch (Exception ex) { throw new MojoFailureException("wsdl2java failed", ex); } addSourceRoot(project); } protected abstract void configureEmitter(EmitterEx emitter); protected abstract void addSourceRoot(MavenProject project); }
6,729
0
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/EmitterEx.java
/* * 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.axis.tools.maven.wsdl2java; import org.apache.axis.wsdl.toJava.Emitter; public class EmitterEx extends Emitter { private boolean clientSide; private boolean generateImplementation; private String clientOutputDirectory; private String deployWsdd; private String undeployWsdd; private String testHttpPortSystemProperty; private int testDefaultHttpPort = -1; public boolean isClientSide() { return clientSide; } public void setClientSide(boolean clientSide) { this.clientSide = clientSide; } public boolean isGenerateImplementation() { return generateImplementation; } public void setGenerateImplementation(boolean generateImplementation) { this.generateImplementation = generateImplementation; } public String getClientOutputDirectory() { return clientOutputDirectory; } public void setClientOutputDirectory(String clientOutputDirectory) { this.clientOutputDirectory = clientOutputDirectory; } public String getDeployWsdd() { return deployWsdd; } public void setDeployWsdd(String deployWsdd) { this.deployWsdd = deployWsdd; } public String getUndeployWsdd() { return undeployWsdd; } public void setUndeployWsdd(String undeployWsdd) { this.undeployWsdd = undeployWsdd; } public String getTestHttpPortSystemProperty() { return testHttpPortSystemProperty; } public void setTestHttpPortSystemProperty(String testHttpPortSystemProperty) { this.testHttpPortSystemProperty = testHttpPortSystemProperty; } public int getTestDefaultHttpPort() { return testDefaultHttpPort; } public void setTestDefaultHttpPort(int testDefaultHttpPort) { this.testDefaultHttpPort = testDefaultHttpPort; } }
6,730
0
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/JavaServiceWriterEx.java
/* * 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.axis.tools.maven.wsdl2java; import javax.wsdl.Service; import org.apache.axis.wsdl.symbolTable.ServiceEntry; import org.apache.axis.wsdl.symbolTable.SymbolTable; import org.apache.axis.wsdl.toJava.Emitter; import org.apache.axis.wsdl.toJava.JavaServiceWriter; public class JavaServiceWriterEx extends JavaServiceWriter { public JavaServiceWriterEx(Emitter emitter, Service service, SymbolTable symbolTable) { super(emitter, service, symbolTable); } protected void setGenerators() { ServiceEntry sEntry = symbolTable.getServiceEntry(service.getQName()); if (sEntry.isReferenced()) { serviceIfaceWriter = new JavaServiceIfaceWriterEx(emitter, sEntry, symbolTable); serviceImplWriter = new JavaServiceImplWriterEx(emitter, sEntry, symbolTable); if (emitter.isTestCaseWanted()) { testCaseWriter = new JavaTestCaseWriterEx(emitter, sEntry, symbolTable); } } } }
6,731
0
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/JavaServiceImplWriterEx.java
/* * 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.axis.tools.maven.wsdl2java; import java.io.File; import org.apache.axis.wsdl.symbolTable.ServiceEntry; import org.apache.axis.wsdl.symbolTable.SymbolTable; import org.apache.axis.wsdl.toJava.Emitter; import org.apache.axis.wsdl.toJava.JavaServiceImplWriter; public class JavaServiceImplWriterEx extends JavaServiceImplWriter { public JavaServiceImplWriterEx(Emitter emitter, ServiceEntry sEntry, SymbolTable symbolTable) { super(emitter, sEntry, symbolTable); } protected String getFileName() { String clientOutputDirectory = ((EmitterEx)emitter).getClientOutputDirectory(); if (clientOutputDirectory == null) { return super.getFileName(); } else { return clientOutputDirectory + File.separator + packageName.replace('.', File.separatorChar) + File.separator + className + ".java"; } } }
6,732
0
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/JavaDeployWriterEx.java
/* * 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.axis.tools.maven.wsdl2java; import javax.wsdl.Definition; import org.apache.axis.wsdl.symbolTable.SymbolTable; import org.apache.axis.wsdl.toJava.Emitter; import org.apache.axis.wsdl.toJava.JavaDeployWriter; public class JavaDeployWriterEx extends JavaDeployWriter { public JavaDeployWriterEx(Emitter emitter, Definition definition, SymbolTable symbolTable) { super(emitter, definition, symbolTable); } protected String getFileName() { return ((EmitterEx)emitter).getDeployWsdd(); } }
6,733
0
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/JavaGeneratorFactoryEx.java
/* * 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.axis.tools.maven.wsdl2java; import javax.wsdl.Binding; import javax.wsdl.Definition; import javax.wsdl.Service; import org.apache.axis.wsdl.gen.Generator; import org.apache.axis.wsdl.gen.NoopGenerator; import org.apache.axis.wsdl.symbolTable.BindingEntry; import org.apache.axis.wsdl.symbolTable.ServiceEntry; import org.apache.axis.wsdl.symbolTable.SymbolTable; import org.apache.axis.wsdl.toJava.Emitter; import org.apache.axis.wsdl.toJava.JavaDefinitionWriter; import org.apache.axis.wsdl.toJava.JavaGeneratorFactory; public class JavaGeneratorFactoryEx extends JavaGeneratorFactory { public JavaGeneratorFactoryEx(Emitter emitter) { super(emitter); } protected void addDefinitionGenerators() { addGenerator(Definition.class, JavaDefinitionWriter.class); if (((EmitterEx)emitter).getDeployWsdd() != null) { addGenerator(Definition.class, JavaDeployWriterEx.class); } if (((EmitterEx)emitter).getUndeployWsdd() != null) { addGenerator(Definition.class, JavaUndeployWriterEx.class); } } public Generator getGenerator(Service service, SymbolTable symbolTable) { if (((EmitterEx)emitter).isClientSide() && include(service.getQName())) { Generator writer = new JavaServiceWriterEx(emitter, service, symbolTable); ServiceEntry sEntry = symbolTable.getServiceEntry(service.getQName()); serviceWriters.addStuff(writer, sEntry, symbolTable); return serviceWriters; } else { return new NoopGenerator(); } } public Generator getGenerator(Binding binding, SymbolTable symbolTable) { if (include(binding.getQName())) { Generator writer = new JavaBindingWriterEx(emitter, binding, symbolTable); BindingEntry bEntry = symbolTable.getBindingEntry(binding.getQName()); bindingWriters.addStuff(writer, bEntry, symbolTable); return bindingWriters; } else { return new NoopGenerator(); } } }
6,734
0
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/GenerateTestSourcesMojo.java
/* * 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.axis.tools.maven.wsdl2java; import java.io.File; import org.apache.maven.project.MavenProject; /** * Create Java classes from local or remote WSDL for usage in test cases. * * @goal generate-test-sources * @phase generate-test-sources */ public class GenerateTestSourcesMojo extends AbstractWsdl2JavaMojo { /** * Output directory for generated Java files. * * @parameter default-value="${project.build.directory}/generated-test-sources/wsdl2java" */ private File testSourceOutputDirectory; /** * Flag indicating whether a default (empty) implementation should be generated. * * @parameter default-value="false" */ private boolean implementation; /** * Flag indicating whether a basic unit test should be generated. * * @parameter default-value="false" */ private boolean testCase; /** * * @parameter */ private String testHttpPortSystemProperty; /** * * @parameter */ private int testDefaultHttpPort = -1; protected void configureEmitter(EmitterEx emitter) { emitter.setOutputDir(testSourceOutputDirectory.getAbsolutePath()); emitter.setGenerateImplementation(implementation); emitter.setTestCaseWanted(testCase); emitter.setTestHttpPortSystemProperty(testHttpPortSystemProperty); emitter.setTestDefaultHttpPort(testDefaultHttpPort); } protected void addSourceRoot(MavenProject project) { project.addTestCompileSourceRoot(testSourceOutputDirectory.getAbsolutePath()); } }
6,735
0
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/JavaServiceIfaceWriterEx.java
/* * 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.axis.tools.maven.wsdl2java; import java.io.File; import org.apache.axis.wsdl.symbolTable.ServiceEntry; import org.apache.axis.wsdl.symbolTable.SymbolTable; import org.apache.axis.wsdl.toJava.Emitter; import org.apache.axis.wsdl.toJava.JavaServiceIfaceWriter; public class JavaServiceIfaceWriterEx extends JavaServiceIfaceWriter { public JavaServiceIfaceWriterEx(Emitter emitter, ServiceEntry sEntry, SymbolTable symbolTable) { super(emitter, sEntry, symbolTable); } protected String getFileName() { String clientOutputDirectory = ((EmitterEx)emitter).getClientOutputDirectory(); if (clientOutputDirectory == null) { return super.getFileName(); } else { return clientOutputDirectory + File.separator + packageName.replace('.', File.separatorChar) + File.separator + className + ".java"; } } }
6,736
0
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/JavaUndeployWriterEx.java
/* * 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.axis.tools.maven.wsdl2java; import javax.wsdl.Definition; import org.apache.axis.wsdl.symbolTable.SymbolTable; import org.apache.axis.wsdl.toJava.Emitter; import org.apache.axis.wsdl.toJava.JavaUndeployWriter; public class JavaUndeployWriterEx extends JavaUndeployWriter { public JavaUndeployWriterEx(Emitter emitter, Definition definition, SymbolTable notUsed) { super(emitter, definition, notUsed); } protected String getFileName() { return ((EmitterEx)emitter).getUndeployWsdd(); } }
6,737
0
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/GenerateSourcesMojo.java
/* * 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.axis.tools.maven.wsdl2java; import java.io.File; import org.apache.maven.project.MavenProject; /** * Create Java classes from local or remote WSDL. * * @goal generate-sources * @phase generate-sources */ public class GenerateSourcesMojo extends AbstractWsdl2JavaMojo { /** * Output directory for generated Java files. * * @parameter default-value="${project.build.directory}/generated-sources/wsdl2java" */ private File sourceOutputDirectory; /** * Flag indicating whether the stub and locator should be written to * {@link #sourceOutputDirectory} (<code>false</code>) or to {@link #testSourceOutputDirectory} * (<code>true</code>). Set this parameter to <code>true</code> if the main artifact of your * project should not contain client-side code, but you need it in your test cases. Note that * this parameter is only meaningful if <code>generate</code> is set to <code>both</code>. * * @parameter default-value="false" */ private boolean writeStubToTestSources; /** * Output directory used for the stub and locator if {@link #writeStubToTestSources} is * <code>true</code>. * * @parameter default-value="${project.build.directory}/generated-test-sources/wsdl2java" */ private File testSourceOutputDirectory; protected void configureEmitter(EmitterEx emitter) { emitter.setOutputDir(sourceOutputDirectory.getAbsolutePath()); if (writeStubToTestSources) { emitter.setClientOutputDirectory(testSourceOutputDirectory.getAbsolutePath()); } // In a Maven build, generated sources are always written to a directory other than // the source directory. By default, the emitter would generate an empty implementation // because it doesn't see the implementation provided by the developer. We don't want this // because these two classes would collide. Therefore implementationWanted is hardcoded // to false: emitter.setGenerateImplementation(false); } protected void addSourceRoot(MavenProject project) { project.addCompileSourceRoot(sourceOutputDirectory.getAbsolutePath()); if (writeStubToTestSources) { project.addTestCompileSourceRoot(testSourceOutputDirectory.getAbsolutePath()); } } }
6,738
0
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/JavaStubWriterEx.java
/* * 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.axis.tools.maven.wsdl2java; import java.io.File; import org.apache.axis.wsdl.symbolTable.BindingEntry; import org.apache.axis.wsdl.symbolTable.SymbolTable; import org.apache.axis.wsdl.toJava.Emitter; import org.apache.axis.wsdl.toJava.JavaStubWriter; public class JavaStubWriterEx extends JavaStubWriter { public JavaStubWriterEx(Emitter emitter, BindingEntry bEntry, SymbolTable symbolTable) { super(emitter, bEntry, symbolTable); } protected String getFileName() { String clientOutputDirectory = ((EmitterEx)emitter).getClientOutputDirectory(); if (clientOutputDirectory == null) { return super.getFileName(); } else { return clientOutputDirectory + File.separator + packageName.replace('.', File.separatorChar) + File.separator + className + ".java"; } } }
6,739
0
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/JavaXmlTypeMapping.java
/* * 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.axis.tools.maven.wsdl2java; public class JavaXmlTypeMapping { private String javaType; private String xmlType; public String getJavaType() { return javaType; } public void setJavaType(String javaType) { this.javaType = javaType; } public String getXmlType() { return xmlType; } public void setXmlType(String xmlType) { this.xmlType = xmlType; } }
6,740
0
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/JavaTestCaseWriterEx.java
/* * 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.axis.tools.maven.wsdl2java; import java.io.IOException; import java.io.PrintWriter; import javax.wsdl.PortType; import org.apache.axis.utils.Messages; import org.apache.axis.wsdl.symbolTable.BindingEntry; import org.apache.axis.wsdl.symbolTable.ServiceEntry; import org.apache.axis.wsdl.symbolTable.SymbolTable; import org.apache.axis.wsdl.toJava.Emitter; import org.apache.axis.wsdl.toJava.JavaTestCaseWriter; public class JavaTestCaseWriterEx extends JavaTestCaseWriter { public JavaTestCaseWriterEx(Emitter emitter, ServiceEntry sEntry, SymbolTable symbolTable) { super(emitter, sEntry, symbolTable); } protected void writeFileBody(PrintWriter pw) throws IOException { super.writeFileBody(pw); String httpPortSystemProperty = ((EmitterEx)emitter).getTestHttpPortSystemProperty(); if (httpPortSystemProperty != null) { int defaultHttpPort = ((EmitterEx)emitter).getTestDefaultHttpPort(); pw.println(" private static String getEndpoint(String portName) throws Exception {"); pw.print(" String httpPort = System.getProperty(\"" + httpPortSystemProperty + "\""); if (defaultHttpPort != -1) { pw.print(", \"" + defaultHttpPort + "\""); } pw.println(");"); if (defaultHttpPort == -1) { pw.println(" if (httpPort == null) {"); pw.println(" fail(\"Required system property " + httpPortSystemProperty + " not set\");"); pw.println(" }"); } pw.println(" return \"http://localhost:\" + httpPort + \"/axis/services/\" + portName;"); pw.println("}"); } } protected void writeWSDLTestCode(PrintWriter pw, String portName) { String httpPortSystemProperty = ((EmitterEx)emitter).getTestHttpPortSystemProperty(); if (httpPortSystemProperty != null) { pw.println(" javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();"); pw.println(" javax.xml.rpc.Service service = serviceFactory.createService(new java.net.URL(getEndpoint(\"" + portName + "\") + \"?WSDL\"), new " + sEntry.getName() + "Locator().getServiceName());"); pw.println(" assertTrue(service != null);"); } else { super.writeWSDLTestCode(pw, portName); } } protected void writeServiceTestCode(PrintWriter pw, String portName, PortType portType, BindingEntry bEntry) { String httpPortSystemProperty = ((EmitterEx)emitter).getTestHttpPortSystemProperty(); if (httpPortSystemProperty != null) { String bindingType = bEntry.getName() + "Stub"; pw.println(" private static " + bindingType + " get" + portName + "() throws Exception {"); pw.println(" " + bindingType + " binding"); pw.println(" = (" + bindingType + ")"); pw.print(" new " + sEntry.getName()); pw.println("Locator" + "().get" + portName + "(new java.net.URL(getEndpoint(\"" + portName + "\")));"); pw.println(" assertNotNull(\"" + Messages.getMessage("null00", "binding") + "\", binding);"); pw.println(); pw.println(" // Time out after a minute"); pw.println(" binding.setTimeout(60000);"); pw.println(); pw.println(" return binding;"); pw.println(" }"); pw.println(); } super.writeServiceTestCode(pw, portName, portType, bEntry); } public void writeBindingAssignment(PrintWriter pw, String bindingType, String portName) { String httpPortSystemProperty = ((EmitterEx)emitter).getTestHttpPortSystemProperty(); if (httpPortSystemProperty != null) { pw.println(" " + bindingType + " binding = get" + portName + "();"); pw.println(); } else { super.writeBindingAssignment(pw, bindingType, portName); } } }
6,741
0
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/JavaBindingWriterEx.java
/* * 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.axis.tools.maven.wsdl2java; import javax.wsdl.Binding; import org.apache.axis.wsdl.gen.Generator; import org.apache.axis.wsdl.gen.NoopGenerator; import org.apache.axis.wsdl.symbolTable.BindingEntry; import org.apache.axis.wsdl.symbolTable.SymbolTable; import org.apache.axis.wsdl.toJava.Emitter; import org.apache.axis.wsdl.toJava.JavaBindingWriter; public class JavaBindingWriterEx extends JavaBindingWriter { public JavaBindingWriterEx(Emitter emitter, Binding binding, SymbolTable symbolTable) { super(emitter, binding, symbolTable); } protected Generator getJavaStubWriter(Emitter emitter, BindingEntry bEntry, SymbolTable st) { if (((EmitterEx)emitter).isClientSide()) { return new JavaStubWriterEx(emitter, bEntry, st); } else { return new NoopGenerator(); } } protected Generator getJavaImplWriter(Emitter emitter, BindingEntry bEntry, SymbolTable st) { if (((EmitterEx)emitter).isGenerateImplementation()) { return super.getJavaImplWriter(emitter, bEntry, st); } else { return new NoopGenerator(); } } }
6,742
0
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven
Create_ds/axis-axis1-java/maven/wsdl2java-maven-plugin/src/main/java/org/apache/axis/tools/maven/wsdl2java/CustomizableBaseTypeMapping.java
/* * 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.axis.tools.maven.wsdl2java; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import org.apache.axis.wsdl.symbolTable.BaseTypeMapping; public class CustomizableBaseTypeMapping extends BaseTypeMapping { private final BaseTypeMapping parent; private final Map/*<QName,String>*/ mappings = new HashMap(); public CustomizableBaseTypeMapping(BaseTypeMapping parent) { this.parent = parent; } public void addMapping(QName xmlType, String javaType) { mappings.put(xmlType, javaType); } public String getBaseName(QName qName) { String javaType = (String)mappings.get(qName); return javaType != null ? javaType : parent.getBaseName(qName); } }
6,743
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/MessageFactory.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; import java.io.IOException; import java.io.InputStream; /** * <P>A factory for creating <CODE>SOAPMessage</CODE> objects.</P> * * <P>A JAXM client performs the following steps to create a * message.</P> * * <UL> * <LI> * Creates a <CODE>MessageFactory</CODE> object from a <CODE> * ProviderConnection</CODE> object (<CODE>con</CODE> in the * following line of code). The <CODE>String</CODE> passed to * the <CODE>createMessageFactory</CODE> method is the name of * of a messaging profile, which must be the URL for the * schema. * <PRE> * MessageFactory mf = con.createMessageFactory(schemaURL); * </PRE> * </LI> * * <LI> * Calls the method <CODE>createMessage</CODE> on the <CODE> * MessageFactory</CODE> object. All messages produced by this * <CODE>MessageFactory</CODE> object will have the header * information appropriate for the messaging profile that was * specified when the <CODE>MessageFactory</CODE> object was * created. * <PRE> * SOAPMessage m = mf.createMessage(); * </PRE> * </LI> * </UL> * It is also possible to create a <CODE>MessageFactory</CODE> * object using the method <CODE>newInstance</CODE>, as shown in * the following line of code. * <PRE> * MessageFactory mf = MessageFactory.newInstance(); * </PRE> * A standalone client (a client that is not running in a * container) can use the <CODE>newInstance</CODE> method to * create a <CODE>MessageFactory</CODE> object. * * <P>All <CODE>MessageFactory</CODE> objects, regardless of how * they are created, will produce <CODE>SOAPMessage</CODE> objects * that have the following elements by default:</P> * * <UL> * <LI>A <CODE>SOAPPart</CODE> object</LI> * * <LI>A <CODE>SOAPEnvelope</CODE> object</LI> * * <LI>A <CODE>SOAPBody</CODE> object</LI> * * <LI>A <CODE>SOAPHeader</CODE> object</LI> * </UL> * If a <CODE>MessageFactory</CODE> object was created using a * <CODE>ProviderConnection</CODE> object, which means that it was * initialized with a specified profile, it will produce messages * that also come prepopulated with additional entries in the * <CODE>SOAPHeader</CODE> object and the <CODE>SOAPBody</CODE> * object. The content of a new <CODE>SOAPMessage</CODE> object * depends on which of the two <CODE>MessageFactory</CODE> methods * is used to create it. * * <UL> * <LI><CODE>createMessage()</CODE> -- message has no * content<BR> * This is the method clients would normally use to create a * request message.</LI> * * <LI><CODE>createMessage(MimeHeaders, * java.io.InputStream)</CODE> -- message has content from the * <CODE>InputStream</CODE> object and headers from the <CODE> * MimeHeaders</CODE> object<BR> * This method can be used internally by a service * implementation to create a message that is a response to a * request.</LI> * </UL> */ public abstract class MessageFactory { // fixme: this should be protected as the class is abstract. /** Create a new MessageFactory. */ public MessageFactory() {} /** * Creates a new <CODE>MessageFactory</CODE> object that is * an instance of the default implementation. * @return a new <CODE>MessageFactory</CODE> object * @throws SOAPException if there was an error in * creating the default implementation of the <CODE> * MessageFactory</CODE> */ public static MessageFactory newInstance() throws SOAPException { try { return (MessageFactory) FactoryFinder.find(MESSAGE_FACTORY_PROPERTY, DEFAULT_MESSAGE_FACTORY); } catch (Exception exception) { throw new SOAPException( "Unable to create message factory for SOAP: " + exception.getMessage()); } } /** * Creates a new <CODE>SOAPMessage</CODE> object with the * default <CODE>SOAPPart</CODE>, <CODE>SOAPEnvelope</CODE>, * <CODE>SOAPBody</CODE>, and <CODE>SOAPHeader</CODE> objects. * Profile-specific message factories can choose to * prepopulate the <CODE>SOAPMessage</CODE> object with * profile-specific headers. * * <P>Content can be added to this message's <CODE> * SOAPPart</CODE> object, and the message can be sent "as is" * when a message containing only a SOAP part is sufficient. * Otherwise, the <CODE>SOAPMessage</CODE> object needs to * create one or more <CODE>AttachmentPart</CODE> objects and * add them to itself. Any content that is not in XML format * must be in an <CODE>AttachmentPart</CODE> object.</P> * @return a new <CODE>SOAPMessage</CODE> object * @throws SOAPException if a SOAP error occurs */ public abstract SOAPMessage createMessage() throws SOAPException; /** * Internalizes the contents of the given <CODE> * InputStream</CODE> object into a new <CODE>SOAPMessage</CODE> * object and returns the <CODE>SOAPMessage</CODE> object. * @param mimeheaders the transport-specific headers * passed to the message in a transport-independent fashion * for creation of the message * @param inputstream the <CODE>InputStream</CODE> object * that contains the data for a message * @return a new <CODE>SOAPMessage</CODE> object containing the * data from the given <CODE>InputStream</CODE> object * @throws IOException if there is a * problem in reading data from the input stream * @throws SOAPException if the message is invalid */ public abstract SOAPMessage createMessage( MimeHeaders mimeheaders, InputStream inputstream) throws IOException, SOAPException; private static final String DEFAULT_MESSAGE_FACTORY = "org.apache.axis.soap.MessageFactoryImpl"; private static final String MESSAGE_FACTORY_PROPERTY = "javax.xml.soap.MessageFactory"; }
6,744
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/Text.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; /** * A representation of a node whose value is text. A <CODE> * Text</CODE> object may represent text that is content or text * that is a comment. */ public interface Text extends Node, org.w3c.dom.Text { /** * Retrieves whether this <CODE>Text</CODE> object * represents a comment. * @return <CODE>true</CODE> if this <CODE>Text</CODE> object is * a comment; <CODE>false</CODE> otherwise */ public abstract boolean isComment(); }
6,745
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/Node.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; /** * A representation of a node (element) in a DOM representation of an XML document * that provides some tree manipulation methods. * This interface provides methods for getting the value of a node, for * getting and setting the parent of a node, and for removing a node. */ public interface Node extends org.w3c.dom.Node { /** * Returns the the value of the immediate child of this <code>Node</code> * object if a child exists and its value is text. * @return a <code>String</code> with the text of the immediate child of * this <code>Node</code> object if (1) there is a child and * (2) the child is a <code>Text</code> object; * <code>null</code> otherwise */ public abstract String getValue(); /** * Sets the parent of this <code>Node</code> object to the given * <code>SOAPElement</code> object. * @param parent the <code>SOAPElement</code> object to be set as * the parent of this <code>Node</code> object * @throws SOAPException if there is a problem in setting the * parent to the given element * @see #getParentElement() getParentElement() */ public abstract void setParentElement(SOAPElement parent) throws SOAPException; /** * Returns the parent element of this <code>Node</code> object. * This method can throw an <code>UnsupportedOperationException</code> * if the tree is not kept in memory. * @return the <code>SOAPElement</code> object that is the parent of * this <code>Node</code> object or <code>null</code> if this * <code>Node</code> object is root * @throws java.lang.UnsupportedOperationException if the whole tree is not kept in memory * @see #setParentElement(javax.xml.soap.SOAPElement) setParentElement(javax.xml.soap.SOAPElement) */ public abstract SOAPElement getParentElement(); /** * Removes this <code>Node</code> object from the tree. Once * removed, this node can be garbage collected if there are no * application references to it. */ public abstract void detachNode(); /** * Notifies the implementation that this <code>Node</code> * object is no longer being used by the application and that the * implementation is free to reuse this object for nodes that may * be created later. * <P> * Calling the method <code>recycleNode</code> implies that the method * <code>detachNode</code> has been called previously. */ public abstract void recycleNode(); /** * If this is a Text node then this method will set its value, otherwise it * sets the value of the immediate (Text) child of this node. The value of * the immediate child of this node can be set only if, there is one child * node and that node is a Text node, or if there are no children in which * case a child Text node will be created. * * @param value the text to set * @throws IllegalStateException if the node is not a Text node and * either has more than one child node or has a child node that * is not a Text node */ public abstract void setValue(String value); }
6,746
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPFault.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; import java.util.Locale; /** * An element in the <CODE>SOAPBody</CODE> object that contains * error and/or status information. This information may relate to * errors in the <CODE>SOAPMessage</CODE> object or to problems * that are not related to the content in the message itself. * Problems not related to the message itself are generally errors * in processing, such as the inability to communicate with an * upstream server. * <P> * The <CODE>SOAPFault</CODE> interface provides methods for * retrieving the information contained in a <CODE> * SOAPFault</CODE> object and for setting the fault code, the * fault actor, and a string describing the fault. A fault code is * one of the codes defined in the SOAP 1.1 specification that * describe the fault. An actor is an intermediate recipient to * whom a message was routed. The message path may include one or * more actors, or, if no actors are specified, the message goes * only to the default actor, which is the final intended * recipient. */ public interface SOAPFault extends SOAPBodyElement { /** * Sets this <CODE>SOAPFault</CODE> object with the given * fault code. * * <P>Fault codes, which given information about the fault, * are defined in the SOAP 1.1 specification.</P> * @param faultCode a <CODE>String</CODE> giving * the fault code to be set; must be one of the fault codes * defined in the SOAP 1.1 specification * @throws SOAPException if there was an error in * adding the <CODE>faultCode</CODE> to the underlying XML * tree. * @see #getFaultCode() getFaultCode() */ public abstract void setFaultCode(String faultCode) throws SOAPException; /** * Gets the fault code for this <CODE>SOAPFault</CODE> * object. * @return a <CODE>String</CODE> with the fault code * @see #setFaultCode(java.lang.String) setFaultCode(java.lang.String) */ public abstract String getFaultCode(); /** * Sets this <CODE>SOAPFault</CODE> object with the given * fault actor. * * <P>The fault actor is the recipient in the message path who * caused the fault to happen.</P> * @param faultActor a <CODE>String</CODE> * identifying the actor that caused this <CODE> * SOAPFault</CODE> object * @throws SOAPException if there was an error in * adding the <CODE>faultActor</CODE> to the underlying XML * tree. * @see #getFaultActor() getFaultActor() */ public abstract void setFaultActor(String faultActor) throws SOAPException; /** * Gets the fault actor for this <CODE>SOAPFault</CODE> * object. * @return a <CODE>String</CODE> giving the actor in the message * path that caused this <CODE>SOAPFault</CODE> object * @see #setFaultActor(java.lang.String) setFaultActor(java.lang.String) */ public abstract String getFaultActor(); /** * Sets the fault string for this <CODE>SOAPFault</CODE> * object to the given string. * * @param faultString a <CODE>String</CODE> * giving an explanation of the fault * @throws SOAPException if there was an error in * adding the <CODE>faultString</CODE> to the underlying XML * tree. * @see #getFaultString() getFaultString() */ public abstract void setFaultString(String faultString) throws SOAPException; /** * Gets the fault string for this <CODE>SOAPFault</CODE> * object. * @return a <CODE>String</CODE> giving an explanation of the * fault */ public abstract String getFaultString(); /** * Returns the detail element for this <CODE>SOAPFault</CODE> * object. * * <P>A <CODE>Detail</CODE> object carries * application-specific error information related to <CODE> * SOAPBodyElement</CODE> objects.</P> * @return a <CODE>Detail</CODE> object with * application-specific error information */ public abstract Detail getDetail(); /** * Creates a <CODE>Detail</CODE> object and sets it as the * <CODE>Detail</CODE> object for this <CODE>SOAPFault</CODE> * object. * * <P>It is illegal to add a detail when the fault already * contains a detail. Therefore, this method should be called * only after the existing detail has been removed.</P> * @return the new <CODE>Detail</CODE> object * @throws SOAPException if this * <CODE>SOAPFault</CODE> object already contains a valid * <CODE>Detail</CODE> object */ public abstract Detail addDetail() throws SOAPException; /** * Sets this <code>SOAPFault</code> object with the given fault code. * * Fault codes, which give information about the fault, are defined in the * SOAP 1.1 specification. A fault code is mandatory and must be of type * <code>QName</code>. This method provides a convenient way to set a fault * code. For example, * * <pre> SOAPEnvelope se = ...; // Create a qualified name in the SOAP namespace with a localName // of "Client". Note that prefix parameter is optional and is null // here which causes the implementation to use an appropriate prefix. Name qname = se.createName("Client", null, SOAPConstants.URI_NS_SOAP_ENVELOPE); SOAPFault fault = ...; fault.setFaultCode(qname); </pre> * * It is preferable to use this method over setFaultCode(String). * * @param name a <code>Name</code> object giving the fault code to be set. * It must be namespace qualified. * @throws SOAPException if there was an error in adding the * <code>faultcode</code> element to the underlying XML tree */ public abstract void setFaultCode(Name name) throws SOAPException; /** * Gets the mandatory SOAP 1.1 fault code for this <code>SOAPFault</code> * object as a SAAJ <code>Name</code> object. The SOAP 1.1 specification * requires the value of the "faultcode" element to be of type QName. This * method returns the content of the element as a QName in the form of a * SAAJ <code>Name</code> object. This method should be used instead of the * <code>getFaultCode()</code> method since it allows applications to easily * access the namespace name without additional parsing. * <p> * In the future, a QName object version of this method may also be added. * @return a <code>Name</code> representing the faultcode */ public abstract Name getFaultCodeAsName(); /** * Sets the fault string for this <code>SOAPFault</code> object to the given * string and localized to the given locale. * * @param faultString a <code>String</code> giving an explanation of * the fault * @param locale a <code>Locale</code> object indicating the * native language of the <code>faultString</code> * @throws SOAPException if there was an error in adding the * <code>faultString</code> to the underlying XML tree */ public abstract void setFaultString(String faultString, Locale locale) throws SOAPException; /** * Returns the optional detail element for this <code>SOAPFault</code> * object. * * @return a <code>Locale</code> object indicating the native language of * the fault string or <code>null</code> if no locale was * specified */ public abstract Locale getFaultStringLocale(); }
6,747
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPConnectionFactory.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; /** * A factory for creating <code>SOAPConnection</code> objects. Implementation of * this class is optional. If <code>SOAPConnectionFactory.newInstance()</code> * throws an <code>UnsupportedOperationException</code> then the implementation * does not support the SAAJ communication infrastructure. Otherwise * <code>SOAPConnection</code> objects can be created by calling * <code>createConnection()</code> on the newly created * <code>SOAPConnectionFactory</code> object. */ public abstract class SOAPConnectionFactory { public SOAPConnectionFactory() {} /** * Creates an instance of the default <CODE> * SOAPConnectionFactory</CODE> object. * @return a new instance of a default <CODE> * SOAPConnectionFactory</CODE> object * @throws SOAPException if there was an error creating * the <CODE>SOAPConnectionFactory</CODE> * @throws UnsupportedOperationException if newInstance is not supported. */ public static SOAPConnectionFactory newInstance() throws SOAPException, UnsupportedOperationException { try { return (SOAPConnectionFactory) FactoryFinder.find(SF_PROPERTY, DEFAULT_SOAP_CONNECTION_FACTORY); } catch (Exception exception) { throw new SOAPException("Unable to create SOAP connection factory: " + exception.getMessage()); } } /** * Create a new <CODE>SOAPConnection</CODE>. * @return the new <CODE>SOAPConnection</CODE> object. * @throws SOAPException if there was an exception * creating the <CODE>SOAPConnection</CODE> object. */ public abstract SOAPConnection createConnection() throws SOAPException; private static final String DEFAULT_SOAP_CONNECTION_FACTORY = "org.apache.axis.soap.SOAPConnectionFactoryImpl"; private static final String SF_PROPERTY = "javax.xml.soap.SOAPConnectionFactory"; }
6,748
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/FactoryFinder.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Properties; /** * This class is used to locate factory classes for javax.xml.soap. * It has package scope since it is not part of JAXM and should not * be accessed from other packages. */ class FactoryFinder { /** * instantiates an object go the given classname. * * @param factoryClassName * @return a factory object * @throws SOAPException */ private static Object newInstance(String factoryClassName) throws SOAPException { ClassLoader classloader = null; try { classloader = Thread.currentThread().getContextClassLoader(); } catch (Exception exception) { throw new SOAPException(exception.toString(), exception); } try { Class factory = null; if (classloader == null) { factory = Class.forName(factoryClassName); } else { try { factory = classloader.loadClass(factoryClassName); } catch (ClassNotFoundException cnfe) {} } if (factory == null) { classloader = FactoryFinder.class.getClassLoader(); factory = classloader.loadClass(factoryClassName); } return factory.newInstance(); } catch (ClassNotFoundException classnotfoundexception) { throw new SOAPException("Provider " + factoryClassName + " not found", classnotfoundexception); } catch (Exception exception) { throw new SOAPException("Provider " + factoryClassName + " could not be instantiated: " + exception, exception); } } /** * Instantiates a factory object given the factory's property name and the * default class name. * * @param factoryPropertyName * @param defaultFactoryClassName * @return a factory object * @throws SOAPException */ static Object find(String factoryPropertyName, String defaultFactoryClassName) throws SOAPException { try { String factoryClassName = System.getProperty(factoryPropertyName); if (factoryClassName != null) { return newInstance(factoryClassName); } } catch (SecurityException securityexception) {} try { String propertiesFileName = System.getProperty("java.home") + File.separator + "lib" + File.separator + "jaxm.properties"; File file = new File(propertiesFileName); if (file.exists()) { FileInputStream fileInput = new FileInputStream(file); Properties properties = new Properties(); properties.load(fileInput); fileInput.close(); String factoryClassName = properties.getProperty(factoryPropertyName); return newInstance(factoryClassName); } } catch (Exception exception1) {} String factoryResource = "META-INF/services/" + factoryPropertyName; try { InputStream inputstream = getResource(factoryResource); if (inputstream != null) { BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(inputstream, "UTF-8")); String factoryClassName = bufferedreader.readLine(); bufferedreader.close(); if ((factoryClassName != null) && !"".equals(factoryClassName)) { return newInstance(factoryClassName); } } } catch (Exception exception2) {} if (defaultFactoryClassName == null) { throw new SOAPException("Provider for " + factoryPropertyName + " cannot be found", null); } else { return newInstance(defaultFactoryClassName); } } /** * Returns an input stream for the specified resource. * * <p>This method will firstly try * <code>ClassLoader.getSystemResourceAsStream()</code> then * the class loader of the current thread with * <code>getResourceAsStream()</code> and finally attempt * <code>getResourceAsStream()</code> on * <code>FactoryFinder.class.getClassLoader()</code>. * * @param factoryResource the resource name * @return an InputStream that can be used to read that resource, or * <code>null</code> if the resource could not be resolved */ private static InputStream getResource(String factoryResource) { ClassLoader classloader = null; try { classloader = Thread.currentThread().getContextClassLoader(); } catch (SecurityException securityexception) {} InputStream inputstream; if (classloader == null) { inputstream = ClassLoader.getSystemResourceAsStream(factoryResource); } else { inputstream = classloader.getResourceAsStream(factoryResource); } if (inputstream == null) { inputstream = FactoryFinder.class.getClassLoader().getResourceAsStream(factoryResource); } return inputstream; } }
6,749
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPEnvelope.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; /** * The container for the SOAPHeader and SOAPBody portions of a * <CODE>SOAPPart</CODE> object. By default, a <CODE> * SOAPMessage</CODE> object is created with a <CODE> * SOAPPart</CODE> object that has a <CODE>SOAPEnvelope</CODE> * object. The <CODE>SOAPEnvelope</CODE> object by default has an * empty <CODE>SOAPBody</CODE> object and an empty <CODE> * SOAPHeader</CODE> object. The <CODE>SOAPBody</CODE> object is * required, and the <CODE>SOAPHeader</CODE> object, though * optional, is used in the majority of cases. If the <CODE> * SOAPHeader</CODE> object is not needed, it can be deleted, * which is shown later. * * <P>A client can access the <CODE>SOAPHeader</CODE> and <CODE> * SOAPBody</CODE> objects by calling the methods <CODE> * SOAPEnvelope.getHeader</CODE> and <CODE> * SOAPEnvelope.getBody</CODE>. The following lines of code use * these two methods after starting with the <CODE> * SOAPMessage</CODE> object <I>message</I> to get the <CODE> * SOAPPart</CODE> object <I>sp</I>, which is then used to get the * <CODE>SOAPEnvelope</CODE> object <I>se</I>. * <PRE> * SOAPPart sp = message.getSOAPPart(); * SOAPEnvelope se = sp.getEnvelope(); * SOAPHeader sh = se.getHeader(); * SOAPBody sb = se.getBody(); * </PRE> * * <P>It is possible to change the body or header of a <CODE> * SOAPEnvelope</CODE> object by retrieving the current one, * deleting it, and then adding a new body or header. The <CODE> * javax.xml.soap.Node</CODE> method <CODE>detachNode</CODE> * detaches the XML element (node) on which it is called. For * example, the following line of code deletes the <CODE> * SOAPBody</CODE> object that is retrieved by the method <CODE> * getBody</CODE>. * <PRE> * se.getBody().detachNode(); * </PRE> * To create a <CODE>SOAPHeader</CODE> object to replace the one * that was removed, a client uses the method <CODE> * SOAPEnvelope.addHeader</CODE>, which creates a new header and * adds it to the <CODE>SOAPEnvelope</CODE> object. Similarly, the * method <CODE>addBody</CODE> creates a new <CODE>SOAPBody</CODE> * object and adds it to the <CODE>SOAPEnvelope</CODE> object. The * following code fragment retrieves the current header, removes * it, and adds a new one. Then it retrieves the current body, * removes it, and adds a new one. * <PRE> * SOAPPart sp = message.getSOAPPart(); * SOAPEnvelope se = sp.getEnvelope(); * se.getHeader().detachNode(); * SOAPHeader sh = se.addHeader(); * se.getBody().detachNode(); * SOAPBody sb = se.addBody(); * </PRE> * It is an error to add a <CODE>SOAPBody</CODE> or <CODE> * SOAPHeader</CODE> object if one already exists. * * <P>The <CODE>SOAPEnvelope</CODE> interface provides three * methods for creating <CODE>Name</CODE> objects. One method * creates <CODE>Name</CODE> objects with a local name, a * namespace prefix, and a namesapce URI. The second method * creates <CODE>Name</CODE> objects with a local name and a * namespace prefix, and the third creates <CODE>Name</CODE> * objects with just a local name. The following line of code, in * which <I>se</I> is a <CODE>SOAPEnvelope</CODE> object, creates * a new <CODE>Name</CODE> object with all three. * <PRE> * Name name = se.createName("GetLastTradePrice", "WOMBAT", * "http://www.wombat.org/trader"); * </PRE> */ public interface SOAPEnvelope extends SOAPElement { /** * Creates a new <CODE>Name</CODE> object initialized with the * given local name, namespace prefix, and namespace URI. * * <P>This factory method creates <CODE>Name</CODE> objects * for use in the SOAP/XML document. * @param localName a <CODE>String</CODE> giving * the local name * @param prefix a <CODE>String</CODE> giving * the prefix of the namespace * @param uri a <CODE>String</CODE> giving the * URI of the namespace * @return a <CODE>Name</CODE> object initialized with the given * local name, namespace prefix, and namespace URI * @throws SOAPException if there is a SOAP error */ public abstract Name createName(String localName, String prefix, String uri) throws SOAPException; /** * Creates a new <CODE>Name</CODE> object initialized with the * given local name. * * <P>This factory method creates <CODE>Name</CODE> objects * for use in the SOAP/XML document. * * @param localName a <CODE>String</CODE> giving * the local name * @return a <CODE>Name</CODE> object initialized with the given * local name * @throws SOAPException if there is a SOAP error */ public abstract Name createName(String localName) throws SOAPException; /** * Returns the <CODE>SOAPHeader</CODE> object for this <CODE> * SOAPEnvelope</CODE> object. * * <P>A new <CODE>SOAPMessage</CODE> object is by default * created with a <CODE>SOAPEnvelope</CODE> object that * contains an empty <CODE>SOAPHeader</CODE> object. As a * result, the method <CODE>getHeader</CODE> will always * return a <CODE>SOAPHeader</CODE> object unless the header * has been removed and a new one has not been added. * @return the <CODE>SOAPHeader</CODE> object or <CODE> * null</CODE> if there is none * @throws SOAPException if there is a problem * obtaining the <CODE>SOAPHeader</CODE> object */ public abstract SOAPHeader getHeader() throws SOAPException; /** * Returns the <CODE>SOAPBody</CODE> object associated with * this <CODE>SOAPEnvelope</CODE> object. * * <P>A new <CODE>SOAPMessage</CODE> object is by default * created with a <CODE>SOAPEnvelope</CODE> object that * contains an empty <CODE>SOAPBody</CODE> object. As a * result, the method <CODE>getBody</CODE> will always return * a <CODE>SOAPBody</CODE> object unless the body has been * removed and a new one has not been added. * @return the <CODE>SOAPBody</CODE> object for this <CODE> * SOAPEnvelope</CODE> object or <CODE>null</CODE> if there * is none * @throws SOAPException if there is a problem * obtaining the <CODE>SOAPBody</CODE> object */ public abstract SOAPBody getBody() throws SOAPException; /** * Creates a <CODE>SOAPHeader</CODE> object and sets it as the * <CODE>SOAPHeader</CODE> object for this <CODE> * SOAPEnvelope</CODE> object. * * <P>It is illegal to add a header when the envelope already * contains a header. Therefore, this method should be called * only after the existing header has been removed. * @return the new <CODE>SOAPHeader</CODE> object * @throws SOAPException if this <CODE> * SOAPEnvelope</CODE> object already contains a valid * <CODE>SOAPHeader</CODE> object */ public abstract SOAPHeader addHeader() throws SOAPException; /** * Creates a <CODE>SOAPBody</CODE> object and sets it as the * <CODE>SOAPBody</CODE> object for this <CODE> * SOAPEnvelope</CODE> object. * * <P>It is illegal to add a body when the envelope already * contains a body. Therefore, this method should be called * only after the existing body has been removed. * @return the new <CODE>SOAPBody</CODE> object * @throws SOAPException if this <CODE> * SOAPEnvelope</CODE> object already contains a valid * <CODE>SOAPBody</CODE> object */ public abstract SOAPBody addBody() throws SOAPException; }
6,750
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPException.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; /** * An exception that signals that a SOAP exception has * occurred. A <CODE>SOAPException</CODE> object may contain a * <CODE>String</CODE> that gives the reason for the exception, an * embedded <CODE>Throwable</CODE> object, or both. This class * provides methods for retrieving reason messages and for * retrieving the embedded <CODE>Throwable</CODE> object. * * <P>Typical reasons for throwing a <CODE>SOAPException</CODE> * object are problems such as difficulty setting a header, not * being able to send a message, and not being able to get a * connection with the provider. Reasons for embedding a <CODE> * Throwable</CODE> object include problems such as input/output * errors or a parsing problem, such as an error in parsing a * header. */ public class SOAPException extends Exception { /** * Constructs a <CODE>SOAPException</CODE> object with no * reason or embedded <CODE>Throwable</CODE> object. */ public SOAPException() { cause = null; } /** * Constructs a <CODE>SOAPException</CODE> object with the * given <CODE>String</CODE> as the reason for the exception * being thrown. * @param reason a description of what caused * the exception */ public SOAPException(String reason) { super(reason); cause = null; } /** * Constructs a <CODE>SOAPException</CODE> object with the * given <CODE>String</CODE> as the reason for the exception * being thrown and the given <CODE>Throwable</CODE> object as * an embedded exception. * @param reason a description of what caused * the exception * @param cause a <CODE>Throwable</CODE> object * that is to be embedded in this <CODE>SOAPException</CODE> * object */ public SOAPException(String reason, Throwable cause) { super(reason); initCause(cause); } /** * Constructs a <CODE>SOAPException</CODE> object * initialized with the given <CODE>Throwable</CODE> * object. * @param cause a <CODE>Throwable</CODE> object * that is to be embedded in this <CODE>SOAPException</CODE> * object */ public SOAPException(Throwable cause) { super(cause.toString()); initCause(cause); } /** * Returns the detail message for this <CODE> * SOAPException</CODE> object. * * <P>If there is an embedded <CODE>Throwable</CODE> object, * and if the <CODE>SOAPException</CODE> object has no detail * message of its own, this method will return the detail * message from the embedded <CODE>Throwable</CODE> * object.</P> * @return the error or warning message for this <CODE> * SOAPException</CODE> or, if it has none, the message of * the embedded <CODE>Throwable</CODE> object, if there is * one */ public String getMessage() { String s = super.getMessage(); if ((s == null) && (cause != null)) { return cause.getMessage(); } else { return s; } } /** * Returns the <CODE>Throwable</CODE> object embedded in * this <CODE>SOAPException</CODE> if there is one. Otherwise, * this method returns <CODE>null</CODE>. * @return the embedded <CODE>Throwable</CODE> object or <CODE> * null</CODE> if there is none */ public Throwable getCause() { return cause; } /** * Initializes the <CODE>cause</CODE> field of this <CODE> * SOAPException</CODE> object with the given <CODE> * Throwable</CODE> object. * * <P>This method can be called at most once. It is generally * called from within the constructor or immediately after the * constructor has returned a new <CODE>SOAPException</CODE> * object. If this <CODE>SOAPException</CODE> object was * created with the constructor {@link #SOAPException(java.lang.Throwable) SOAPException(java.lang.Throwable)} * or {@link #SOAPException(java.lang.String, java.lang.Throwable) SOAPException(java.lang.String, java.lang.Throwable)}, meaning * that its <CODE>cause</CODE> field already has a value, this * method cannot be called even once. * * @param cause the <CODE>Throwable</CODE> * object that caused this <CODE>SOAPException</CODE> object * to be thrown. The value of this parameter is saved for * later retrieval by the <A href= * "../../../javax/xml/soap/SOAPException.html#getCause()"> * <CODE>getCause()</CODE></A> method. A <TT>null</TT> value * is permitted and indicates that the cause is nonexistent * or unknown. * @return a reference to this <CODE>SOAPException</CODE> * instance * @throws java.lang.IllegalArgumentException if * <CODE>cause</CODE> is this <CODE>Throwable</CODE> object. * (A <CODE>Throwable</CODE> object cannot be its own * cause.) * @throws java.lang.IllegalStateException if this <CODE> * SOAPException</CODE> object was created with {@link #SOAPException(java.lang.Throwable) SOAPException(java.lang.Throwable)} * or {@link #SOAPException(java.lang.String, java.lang.Throwable) SOAPException(java.lang.String, java.lang.Throwable)}, or this * method has already been called on this <CODE> * SOAPException</CODE> object */ public synchronized Throwable initCause(Throwable cause) { if (this.cause != null) { throw new IllegalStateException("Can't override cause"); } if (cause == this) { throw new IllegalArgumentException("Self-causation not permitted"); } else { this.cause = cause; return this; } } private Throwable cause; }
6,751
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPHeaderElement.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; /** * <P>An object representing the contents in the SOAP header part * of the SOAP envelope. The immediate children of a <CODE> * SOAPHeader</CODE> object can be represented only as <CODE> * SOAPHeaderElement</CODE> objects.</P> * * <P>A <CODE>SOAPHeaderElement</CODE> object can have other * <CODE>SOAPElement</CODE> objects as its children.</P> */ public interface SOAPHeaderElement extends SOAPElement { /** * Sets the actor associated with this <CODE> * SOAPHeaderElement</CODE> object to the specified actor. The * default value of an actor is: <CODE> * SOAPConstants.URI_SOAP_ACTOR_NEXT</CODE> * @param actorURI a <CODE>String</CODE> giving * the URI of the actor to set * @see #getActor() getActor() * @throws java.lang.IllegalArgumentException if * there is a problem in setting the actor. */ public abstract void setActor(String actorURI); /** * Returns the uri of the actor associated with this <CODE> * SOAPHeaderElement</CODE> object. * @return a <CODE>String</CODE> giving the URI of the * actor * @see #setActor(java.lang.String) setActor(java.lang.String) */ public abstract String getActor(); /** * Sets the mustUnderstand attribute for this <CODE> * SOAPHeaderElement</CODE> object to be on or off. * * <P>If the mustUnderstand attribute is on, the actor who * receives the <CODE>SOAPHeaderElement</CODE> must process it * correctly. This ensures, for example, that if the <CODE> * SOAPHeaderElement</CODE> object modifies the message, that * the message is being modified correctly.</P> * @param mustUnderstand <CODE>true</CODE> to * set the mustUnderstand attribute on; <CODE>false</CODE> * to turn if off * @throws java.lang.IllegalArgumentException if * there is a problem in setting the actor. * @see #getMustUnderstand() getMustUnderstand() */ public abstract void setMustUnderstand(boolean mustUnderstand); /** * Returns whether the mustUnderstand attribute for this * <CODE>SOAPHeaderElement</CODE> object is turned on. * @return <CODE>true</CODE> if the mustUnderstand attribute of * this <CODE>SOAPHeaderElement</CODE> object is turned on; * <CODE>false</CODE> otherwise */ public abstract boolean getMustUnderstand(); }
6,752
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPBody.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; import org.w3c.dom.Document; import java.util.Locale; /** * An object that represents the contents of the SOAP body * element in a SOAP message. A SOAP body element consists of XML data * that affects the way the application-specific content is processed. * <P> * A <code>SOAPBody</code> object contains <code>SOAPBodyElement</code> * objects, which have the content for the SOAP body. * A <code>SOAPFault</code> object, which carries status and/or * error information, is an example of a <code>SOAPBodyElement</code> object. * @see SOAPFault SOAPFault */ public interface SOAPBody extends SOAPElement { /** * Creates a new <code>SOAPFault</code> object and adds it to * this <code>SOAPBody</code> object. * @return the new <code>SOAPFault</code> object * @throws SOAPException if there is a SOAP error */ public abstract SOAPFault addFault() throws SOAPException; /** * Indicates whether a <code>SOAPFault</code> object exists in * this <code>SOAPBody</code> object. * @return <code>true</code> if a <code>SOAPFault</code> object exists in * this <code>SOAPBody</code> object; <code>false</code> * otherwise */ public abstract boolean hasFault(); /** * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code> * object. * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code> * object */ public abstract SOAPFault getFault(); /** * Creates a new <code>SOAPBodyElement</code> object with the * specified name and adds it to this <code>SOAPBody</code> object. * @param name a <code>Name</code> object with the name for the new * <code>SOAPBodyElement</code> object * @return the new <code>SOAPBodyElement</code> object * @throws SOAPException if a SOAP error occurs */ public abstract SOAPBodyElement addBodyElement(Name name) throws SOAPException; /** * Creates a new <code>SOAPFault</code> object and adds it to this * <code>SOAPBody</code> object. The new <code>SOAPFault</code> will have a * <code>faultcode</code> element that is set to the <code>faultCode</code> * parameter and a <code>faultstring</code> set to <code>faultstring</code> * and localized to <code>locale</code>. * * @param faultCode a <code>Name</code> object giving the fault code to be * set; must be one of the fault codes defined in the SOAP 1.1 * specification and of type QName * @param faultString a <code>String</code> giving an explanation of the * fault * @param locale a <code>Locale</code> object indicating the native language * of the <code>faultString</code> * @return the new <code>SOAPFault</code> object * @throws SOAPException if there is a SOAP error */ public abstract SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException; /** * Creates a new <code>SOAPFault</code> object and adds it to this * <code>SOAPBody</code> object. The new <code>SOAPFault</code> will have a * <code>faultcode</code> element that is set to the <code>faultCode</code> * parameter and a <code>faultstring</code> set to <code>faultstring</code>. * * @param faultCode a <code>Name</code> object giving the fault code to be * set; must be one of the fault codes defined in the SOAP 1.1 * specification and of type QName * @param faultString a <code>String</code> giving an explanation of the * fault * @return the new <code>SOAPFault</code> object * @throws SOAPException if there is a SOAP error */ public abstract SOAPFault addFault(Name faultCode, String faultString) throws SOAPException; /** * Adds the root node of the DOM <code>Document</code> to this * <code>SOAPBody</code> object. * <p> * Calling this method invalidates the <code>document</code> parameter. The * client application should discard all references to this * <code>Document</code> and its contents upon calling * <code>addDocument</code>. The behavior of an application that continues * to use such references is undefined. * * @param document the <code>Document</code> object whose root node will be * added to this <code>SOAPBody</code> * @return the <code>SOAPBodyElement</code> that represents the root node * that was added * @throws SOAPException if the <code>Document</code> cannot be added */ public abstract SOAPBodyElement addDocument(Document document) throws SOAPException; }
6,753
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPConnection.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; /** * A point-to-point connection that a client can use for sending messages * directly to a remote party (represented by a URL, for instance). * <p> * A client can obtain a <code>SOAPConnection</code> object simply by * calling the following static method. * <pre> * * SOAPConnection con = SOAPConnection.newInstance(); * </pre> * A <code>SOAPConnection</code> object can be used to send messages * directly to a URL following the request/response paradigm. That is, * messages are sent using the method <code>call</code>, which sends the * message and then waits until it gets a reply. */ public abstract class SOAPConnection { public SOAPConnection() {} /** * Sends the given message to the specified endpoint and * blocks until it has returned the response. * @param request the <CODE>SOAPMessage</CODE> * object to be sent * @param endpoint an <code>Object</code> that identifies * where the message should be sent. It is required to * support Objects of type * <code>java.lang.String</code>, * <code>java.net.URL</code>, and when JAXM is present * <code>javax.xml.messaging.URLEndpoint</code> * @return the <CODE>SOAPMessage</CODE> object that is the * response to the message that was sent * @throws SOAPException if there is a SOAP error */ public abstract SOAPMessage call(SOAPMessage request, Object endpoint) throws SOAPException; /** * Closes this <CODE>SOAPConnection</CODE> object. * @throws SOAPException if there is a SOAP error */ public abstract void close() throws SOAPException; }
6,754
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPConstants.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; /** The definition of constants pertaining to the SOAP 1.1 protocol. */ public interface SOAPConstants { /** The namespace identifier for the SOAP envelope. */ public static final String URI_NS_SOAP_ENVELOPE = "http://schemas.xmlsoap.org/soap/envelope/"; /** * The namespace identifier for the SOAP encoding (see section 5 of * the SOAP 1.1 specification). */ public static final String URI_NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/"; /** * The URI identifying the first application processing a SOAP request as the intended * actor for a SOAP header entry (see section 4.2.2 of the SOAP 1.1 specification). */ public static final String URI_SOAP_ACTOR_NEXT = "http://schemas.xmlsoap.org/soap/actor/next"; }
6,755
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPHeader.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; import java.util.Iterator; /** * <P>A representation of the SOAP header element. A SOAP header * element consists of XML data that affects the way the * application-specific content is processed by the message * provider. For example, transaction semantics, authentication * information, and so on, can be specified as the content of a * <CODE>SOAPHeader</CODE> object.</P> * * <P>A <CODE>SOAPEnvelope</CODE> object contains an empty <CODE> * SOAPHeader</CODE> object by default. If the <CODE> * SOAPHeader</CODE> object, which is optional, is not needed, it * can be retrieved and deleted with the following line of code. * The variable <I>se</I> is a <CODE>SOAPEnvelope</CODE> * object.</P> * <PRE> * se.getHeader().detachNode(); * </PRE> * A <CODE>SOAPHeader</CODE> object is created with the <CODE> * SOAPEnvelope</CODE> method <CODE>addHeader</CODE>. This method, * which creates a new header and adds it to the envelope, may be * called only after the existing header has been removed. * <PRE> * se.getHeader().detachNode(); * SOAPHeader sh = se.addHeader(); * </PRE> * * <P>A <CODE>SOAPHeader</CODE> object can have only <CODE> * SOAPHeaderElement</CODE> objects as its immediate children. The * method <CODE>addHeaderElement</CODE> creates a new <CODE> * HeaderElement</CODE> object and adds it to the <CODE> * SOAPHeader</CODE> object. In the following line of code, the * argument to the method <CODE>addHeaderElement</CODE> is a * <CODE>Name</CODE> object that is the name for the new <CODE> * HeaderElement</CODE> object.</P> * <PRE> * SOAPHeaderElement shElement = sh.addHeaderElement(name); * </PRE> * @see SOAPHeaderElement SOAPHeaderElement */ public interface SOAPHeader extends SOAPElement { /** * Creates a new <CODE>SOAPHeaderElement</CODE> object * initialized with the specified name and adds it to this * <CODE>SOAPHeader</CODE> object. * @param name a <CODE>Name</CODE> object with * the name of the new <CODE>SOAPHeaderElement</CODE> * object * @return the new <CODE>SOAPHeaderElement</CODE> object that * was inserted into this <CODE>SOAPHeader</CODE> * object * @throws SOAPException if a SOAP error occurs */ public abstract SOAPHeaderElement addHeaderElement(Name name) throws SOAPException; /** * Returns a list of all the <CODE>SOAPHeaderElement</CODE> * objects in this <CODE>SOAPHeader</CODE> object that have the * the specified actor. An actor is a global attribute that * indicates the intermediate parties to whom the message should * be sent. An actor receives the message and then sends it to * the next actor. The default actor is the ultimate intended * recipient for the message, so if no actor attribute is * included in a <CODE>SOAPHeader</CODE> object, the message is * sent to its ultimate destination. * @param actor a <CODE>String</CODE> giving the * URI of the actor for which to search * @return an <CODE>Iterator</CODE> object over all the <CODE> * SOAPHeaderElement</CODE> objects that contain the * specified actor * @see #extractHeaderElements(java.lang.String) extractHeaderElements(java.lang.String) */ public abstract Iterator examineHeaderElements(String actor); /** * Returns a list of all the <CODE>SOAPHeaderElement</CODE> * objects in this <CODE>SOAPHeader</CODE> object that have * the the specified actor and detaches them from this <CODE> * SOAPHeader</CODE> object. * * <P>This method allows an actor to process only the parts of * the <CODE>SOAPHeader</CODE> object that apply to it and to * remove them before passing the message on to the next * actor. * @param actor a <CODE>String</CODE> giving the * URI of the actor for which to search * @return an <CODE>Iterator</CODE> object over all the <CODE> * SOAPHeaderElement</CODE> objects that contain the * specified actor * @see #examineHeaderElements(java.lang.String) examineHeaderElements(java.lang.String) */ public abstract Iterator extractHeaderElements(String actor); /** * Returns an <code>Iterator</code> over all the * <code>SOAPHeaderElement</code> objects in this <code>SOAPHeader</code> * object that have the specified actor and that have a MustUnderstand * attribute whose value is equivalent to <code>true</code>. * * @param actor a <code>String</code> giving the URI of the actor for which * to search * @return an <code>Iterator</code> object over all the * <code>SOAPHeaderElement</code> objects that contain the * specified actor and are marked as MustUnderstand */ public abstract Iterator examineMustUnderstandHeaderElements(String actor); /** * Returns an <code>Iterator</code> over all the * <code>SOAPHeaderElement</code> objects in this <code>SOAPHeader</code> * object. * * @return an <code>Iterator</code> object over all the * <code>SOAPHeaderElement</code> objects contained by this * <code>SOAPHeader</code> */ public abstract Iterator examineAllHeaderElements(); /** * Returns an <code>Iterator</code> over all the * <code>SOAPHeaderElement</code> objects in this <code>SOAPHeader </code> * object and detaches them from this <code>SOAPHeader</code> object. * * @return an <code>Iterator</code> object over all the * <code>SOAPHeaderElement</code> objects contained by this * <code>SOAPHeader</code> */ public abstract Iterator extractAllHeaderElements(); }
6,756
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPFactory.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; /** * <code>SOAPFactory</code> is a factory for creating various objects * that exist in the SOAP XML tree. * * <code>SOAPFactory</code> can be * used to create XML fragments that will eventually end up in the * SOAP part. These fragments can be inserted as children of the * <code>SOAPHeaderElement</code> or <code>SOAPBodyElement</code> or * <code>SOAPEnvelope</code>. * * <code>SOAPFactory</code> also has methods to create * <code>javax.xml.soap.Detail</code> objects as well as * <code>java.xml.soap.Name</code> objects. * */ public abstract class SOAPFactory { public SOAPFactory() {} /** * Create a <code>SOAPElement</code> object initialized with the * given <code>Name</code> object. * * @param name a <code>Name</code> object with the XML name for * the new element * @return the new <code>SOAPElement</code> object that was * created * @throws SOAPException if there is an error in creating the * <code>SOAPElement</code> object */ public abstract SOAPElement createElement(Name name) throws SOAPException; /** * Create a <code>SOAPElement</code> object initialized with the * given local name. * * @param localName a <code>String</code> giving the local name for * the new element * @return the new <code>SOAPElement</code> object that was * created * @throws SOAPException if there is an error in creating the * <code>SOAPElement</code> object */ public abstract SOAPElement createElement(String localName) throws SOAPException; /** * Create a new <code>SOAPElement</code> object with the given * local name, prefix and uri. * * @param localName a <code>String</code> giving the local name * for the new element * @param prefix the prefix for this <code>SOAPElement</code> * @param uri a <code>String</code> giving the URI of the * namespace to which the new element belongs * @return the new <code>SOAPElement</code> object that was * created * @throws SOAPException if there is an error in creating the * <code>SOAPElement</code> object */ public abstract SOAPElement createElement(String localName, String prefix, String uri) throws SOAPException; /** * Creates a new <code>Detail</code> object which serves as a container * for <code>DetailEntry</code> objects. * <p> * This factory method creates <code>Detail</code> objects for use in * situations where it is not practical to use the <code>SOAPFault</code> * abstraction. * * @return a <code>Detail</code> object * @throws SOAPException if there is a SOAP error */ public abstract Detail createDetail() throws SOAPException; /** * Creates a new <code>Name</code> object initialized with the * given local name, namespace prefix, and namespace URI. * <p> * This factory method creates <code>Name</code> objects for use in * situations where it is not practical to use the <code>SOAPEnvelope</code> * abstraction. * * @param localName a <code>String</code> giving the local name * @param prefix a <code>String</code> giving the prefix of the namespace * @param uri a <code>String</code> giving the URI of the namespace * @return a <code>Name</code> object initialized with the given * local name, namespace prefix, and namespace URI * @throws SOAPException if there is a SOAP error */ public abstract Name createName(String localName, String prefix, String uri) throws SOAPException; /** * Creates a new <code>Name</code> object initialized with the * given local name. * <p> * This factory method creates <code>Name</code> objects for use in * situations where it is not practical to use the <code>SOAPEnvelope</code> * abstraction. * * @param localName a <code>String</code> giving the local name * @return a <code>Name</code> object initialized with the given * local name * @throws SOAPException if there is a SOAP error */ public abstract Name createName(String localName) throws SOAPException; /** * Creates a new instance of <code>SOAPFactory</code>. * * @return a new instance of a <code>SOAPFactory</code> * @throws SOAPException if there was an error creating the * default <code>SOAPFactory</code> */ public static SOAPFactory newInstance() throws SOAPException { try { return (SOAPFactory) FactoryFinder.find(SF_PROPERTY, DEFAULT_SF); } catch (Exception exception) { throw new SOAPException("Unable to create SOAP Factory: " + exception.getMessage()); } } private static final String SF_PROPERTY = "javax.xml.soap.SOAPFactory"; private static final String DEFAULT_SF = "org.apache.axis.soap.SOAPFactoryImpl"; }
6,757
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/AttachmentPart.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; import javax.activation.DataHandler; import java.util.Iterator; /** * <P>A single attachment to a <CODE>SOAPMessage</CODE> object. A * <CODE>SOAPMessage</CODE> object may contain zero, one, or many * <CODE>AttachmentPart</CODE> objects. Each <CODE> * AttachmentPart</CODE> object consists of two parts, * application-specific content and associated MIME headers. The * MIME headers consists of name/value pairs that can be used to * identify and describe the content.</P> * * <P>An <CODE>AttachmentPart</CODE> object must conform to * certain standards.</P> * * <OL> * <LI>It must conform to <A href= * "http://www.ietf.org/rfc/rfc2045.txt">MIME [RFC2045] * standards</A></LI> * * <LI>It MUST contain content</LI> * * <LI> * The header portion MUST include the following header: * * <UL> * <LI> * <CODE>Content-Type</CODE><BR> * This header identifies the type of data in the content * of an <CODE>AttachmentPart</CODE> object and MUST * conform to [RFC2045]. The following is an example of a * Content-Type header: * <PRE> * Content-Type: application/xml * * </PRE> * The following line of code, in which <CODE>ap</CODE> is * an <CODE>AttachmentPart</CODE> object, sets the header * shown in the previous example. * <PRE> * ap.setMimeHeader("Content-Type", "application/xml"); * * </PRE> * * <P></P> * </LI> * </UL> * </LI> * </OL> * * <P>There are no restrictions on the content portion of an * <CODE>AttachmentPart</CODE> object. The content may be anything * from a simple plain text object to a complex XML document or * image file.</P> * * <P>An <CODE>AttachmentPart</CODE> object is created with the * method <CODE>SOAPMessage.createAttachmentPart</CODE>. After * setting its MIME headers, the <CODE>AttachmentPart</CODE> * object is added to the message that created it with the method * <CODE>SOAPMessage.addAttachmentPart</CODE>.</P> * * <P>The following code fragment, in which <CODE>m</CODE> is a * <CODE>SOAPMessage</CODE> object and <CODE>contentStringl</CODE> * is a <CODE>String</CODE>, creates an instance of <CODE> * AttachmentPart</CODE>, sets the <CODE>AttachmentPart</CODE> * object with some content and header information, and adds the * <CODE>AttachmentPart</CODE> object to the <CODE> * SOAPMessage</CODE> object.</P> * <PRE> * AttachmentPart ap1 = m.createAttachmentPart(); * ap1.setContent(contentString1, "text/plain"); * m.addAttachmentPart(ap1); * </PRE> * * <P>The following code fragment creates and adds a second <CODE> * AttachmentPart</CODE> instance to the same message. <CODE> * jpegData</CODE> is a binary byte buffer representing the jpeg * file.</P> * <PRE> * AttachmentPart ap2 = m.createAttachmentPart(); * byte[] jpegData = ...; * ap2.setContent(new ByteArrayInputStream(jpegData), "image/jpeg"); * m.addAttachmentPart(ap2); * </PRE> * * <P>The <CODE>getContent</CODE> method retrieves the contents * and header from an <CODE>AttachmentPart</CODE> object. * Depending on the <CODE>DataContentHandler</CODE> objects * present, the returned <CODE>Object</CODE> can either be a typed * Java object corresponding to the MIME type or an <CODE> * InputStream</CODE> object that contains the content as * bytes.</P> * <PRE> * String content1 = ap1.getContent(); * java.io.InputStream content2 = ap2.getContent(); * </PRE> * The method <CODE>clearContent</CODE> removes all the content * from an <CODE>AttachmentPart</CODE> object but does not affect * its header information. * <PRE> * ap1.clearContent(); * </PRE> */ public abstract class AttachmentPart { // fixme: should this constructor be protected? /** Create a new AttachmentPart. */ public AttachmentPart() {} /** * Returns the number of bytes in this <CODE> * AttachmentPart</CODE> object. * @return the size of this <CODE>AttachmentPart</CODE> object * in bytes or -1 if the size cannot be determined * @throws SOAPException if the content of this * attachment is corrupted of if there was an exception * while trying to determine the size. */ public abstract int getSize() throws SOAPException; /** * Clears out the content of this <CODE> * AttachmentPart</CODE> object. The MIME header portion is left * untouched. */ public abstract void clearContent(); /** * Gets the content of this <code>AttachmentPart</code> object as a Java * object. The type of the returned Java object depends on (1) the * <code>DataContentHandler</code> object that is used to interpret the bytes * and (2) the <code>Content-Type</code> given in the header. * <p> * For the MIME content types "text/plain", "text/html" and "text/xml", the * <code>DataContentHandler</code> object does the conversions to and * from the Java types corresponding to the MIME types. * For other MIME types,the <code>DataContentHandler</code> object * can return an <code>InputStream</code> object that contains the content data * as raw bytes. * <p> * A JAXM-compliant implementation must, as a minimum, return a * <code>java.lang.String</code> object corresponding to any content * stream with a <code>Content-Type</code> value of * <code>text/plain</code>, a * <code>javax.xml.transform.StreamSource</code> object corresponding to a * content stream with a <code>Content-Type</code> value of * <code>text/xml</code>, a <code>java.awt.Image</code> object * corresponding to a content stream with a * <code>Content-Type</code> value of <code>image/gif</code> or * <code>image/jpeg</code>. For those content types that an * installed <code>DataContentHandler</code> object does not understand, the * <code>DataContentHandler</code> object is required to return a * <code>java.io.InputStream</code> object with the raw bytes. * * @return a Java object with the content of this <CODE> * AttachmentPart</CODE> object * @throws SOAPException if there is no content set * into this <CODE>AttachmentPart</CODE> object or if there * was a data transformation error */ public abstract Object getContent() throws SOAPException; /** * Sets the content of this attachment part to that of the * given <CODE>Object</CODE> and sets the value of the <CODE> * Content-Type</CODE> header to the given type. The type of the * <CODE>Object</CODE> should correspond to the value given for * the <CODE>Content-Type</CODE>. This depends on the particular * set of <CODE>DataContentHandler</CODE> objects in use. * @param object the Java object that makes up * the content for this attachment part * @param contentType the MIME string that * specifies the type of the content * @throws java.lang.IllegalArgumentException if * the contentType does not match the type of the content * object, or if there was no <CODE> * DataContentHandler</CODE> object for this content * object * @see #getContent() getContent() */ public abstract void setContent(Object object, String contentType); /** * Gets the <CODE>DataHandler</CODE> object for this <CODE> * AttachmentPart</CODE> object. * @return the <CODE>DataHandler</CODE> object associated with * this <CODE>AttachmentPart</CODE> object * @throws SOAPException if there is * no data in this <CODE>AttachmentPart</CODE> object */ public abstract DataHandler getDataHandler() throws SOAPException; /** * Sets the given <CODE>DataHandler</CODE> object as the * data handler for this <CODE>AttachmentPart</CODE> object. * Typically, on an incoming message, the data handler is * automatically set. When a message is being created and * populated with content, the <CODE>setDataHandler</CODE> * method can be used to get data from various data sources into * the message. * @param datahandler <CODE>DataHandler</CODE> object to * be set * @throws java.lang.IllegalArgumentException if * there was a problem with the specified <CODE> * DataHandler</CODE> object */ public abstract void setDataHandler(DataHandler datahandler); /** * Gets the value of the MIME header whose name is * "Content-Id". * @return a <CODE>String</CODE> giving the value of the * "Content-Id" header or <CODE>null</CODE> if there is * none * @see #setContentId(java.lang.String) setContentId(java.lang.String) */ public String getContentId() { String as[] = getMimeHeader("Content-Id"); if (as != null && as.length > 0) { return as[0]; } else { return null; } } /** * Gets the value of the MIME header * "Content-Location". * @return a <CODE>String</CODE> giving the value of the * "Content-Location" header or <CODE>null</CODE> if there * is none */ public String getContentLocation() { String as[] = getMimeHeader("Content-Location"); if (as != null && as.length > 0) { return as[0]; } else { return null; } } /** * Gets the value of the MIME header "Content-Type". * @return a <CODE>String</CODE> giving the value of the * "Content-Type" header or <CODE>null</CODE> if there is * none */ public String getContentType() { String as[] = getMimeHeader("Content-Type"); if (as != null && as.length > 0) { return as[0]; } else { return null; } } /** * Sets the MIME header "Content-Id" with the given * value. * @param contentId a <CODE>String</CODE> giving * the value of the "Content-Id" header * @throws java.lang.IllegalArgumentException if * there was a problem with the specified <CODE> * contentId</CODE> value * @see #getContentId() getContentId() */ public void setContentId(String contentId) { setMimeHeader("Content-Id", contentId); } /** * Sets the MIME header "Content-Location" with the given * value. * @param contentLocation a <CODE>String</CODE> * giving the value of the "Content-Location" header * @throws java.lang.IllegalArgumentException if * there was a problem with the specified content * location */ public void setContentLocation(String contentLocation) { setMimeHeader("Content-Location", contentLocation); } /** * Sets the MIME header "Content-Type" with the given * value. * @param contentType a <CODE>String</CODE> * giving the value of the "Content-Type" header * @throws java.lang.IllegalArgumentException if * there was a problem with the specified content type */ public void setContentType(String contentType) { setMimeHeader("Content-Type", contentType); } /** * Removes all MIME headers that match the given name. * @param header - the string name of the MIME * header/s to be removed */ public abstract void removeMimeHeader(String header); /** Removes all the MIME header entries. */ public abstract void removeAllMimeHeaders(); /** * Gets all the values of the header identified by the given * <CODE>String</CODE>. * @param name the name of the header; example: * "Content-Type" * @return a <CODE>String</CODE> array giving the value for the * specified header * @see #setMimeHeader(java.lang.String, java.lang.String) setMimeHeader(java.lang.String, java.lang.String) */ public abstract String[] getMimeHeader(String name); /** * Changes the first header entry that matches the given name * to the given value, adding a new header if no existing * header matches. This method also removes all matching * headers but the first. * * <P>Note that RFC822 headers can only contain US-ASCII * characters.</P> * @param name a <CODE>String</CODE> giving the * name of the header for which to search * @param value a <CODE>String</CODE> giving the * value to be set for the header whose name matches the * given name * @throws java.lang.IllegalArgumentException if * there was a problem with the specified mime header name * or value */ public abstract void setMimeHeader(String name, String value); /** * Adds a MIME header with the specified name and value to * this <CODE>AttachmentPart</CODE> object. * * <P>Note that RFC822 headers can contain only US-ASCII * characters.</P> * @param name a <CODE>String</CODE> giving the * name of the header to be added * @param value a <CODE>String</CODE> giving the * value of the header to be added * @throws java.lang.IllegalArgumentException if * there was a problem with the specified mime header name * or value */ public abstract void addMimeHeader(String name, String value); /** * Retrieves all the headers for this <CODE> * AttachmentPart</CODE> object as an iterator over the <CODE> * MimeHeader</CODE> objects. * @return an <CODE>Iterator</CODE> object with all of the Mime * headers for this <CODE>AttachmentPart</CODE> object */ public abstract Iterator getAllMimeHeaders(); /** * Retrieves all <CODE>MimeHeader</CODE> objects that match * a name in the given array. * @param names a <CODE>String</CODE> array with * the name(s) of the MIME headers to be returned * @return all of the MIME headers that match one of the names * in the given array as an <CODE>Iterator</CODE> * object */ public abstract Iterator getMatchingMimeHeaders(String names[]); /** * Retrieves all <CODE>MimeHeader</CODE> objects whose name * does not match a name in the given array. * @param names a <CODE>String</CODE> array with * the name(s) of the MIME headers not to be returned * @return all of the MIME headers in this <CODE> * AttachmentPart</CODE> object except those that match one * of the names in the given array. The nonmatching MIME * headers are returned as an <CODE>Iterator</CODE> * object. */ public abstract Iterator getNonMatchingMimeHeaders(String names[]); }
6,758
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPPart.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; import javax.xml.transform.Source; import java.util.Iterator; /** * <P>The container for the SOAP-specific portion of a <CODE> * SOAPMessage</CODE> object. All messages are required to have a * SOAP part, so when a <CODE>SOAPMessage</CODE> object is * created, it will automatically have a <CODE>SOAPPart</CODE> * object.</P> * * <P>A <CODE>SOAPPart</CODE> object is a MIME part and has the * MIME headers Content-Id, Content-Location, and Content-Type. * Because the value of Content-Type must be "text/xml", a <CODE> * SOAPPart</CODE> object automatically has a MIME header of * Content-Type with its value set to "text/xml". The value must * be "text/xml" because content in the SOAP part of a message * must be in XML format. Content that is not of type "text/xml" * must be in an <CODE>AttachmentPart</CODE> object rather than in * the <CODE>SOAPPart</CODE> object.</P> * * <P>When a message is sent, its SOAP part must have the MIME * header Content-Type set to "text/xml". Or, from the other * perspective, the SOAP part of any message that is received must * have the MIME header Content-Type with a value of * "text/xml".</P> * * <P>A client can access the <CODE>SOAPPart</CODE> object of a * <CODE>SOAPMessage</CODE> object by calling the method <CODE> * SOAPMessage.getSOAPPart</CODE>. The following line of code, in * which <CODE>message</CODE> is a <CODE>SOAPMessage</CODE> * object, retrieves the SOAP part of a message.</P> * <PRE> * SOAPPart soapPart = message.getSOAPPart(); * </PRE> * * <P>A <CODE>SOAPPart</CODE> object contains a <CODE> * SOAPEnvelope</CODE> object, which in turn contains a <CODE> * SOAPBody</CODE> object and a <CODE>SOAPHeader</CODE> object. * The <CODE>SOAPPart</CODE> method <CODE>getEnvelope</CODE> can * be used to retrieve the <CODE>SOAPEnvelope</CODE> object.</P> */ public abstract class SOAPPart implements org.w3c.dom.Document { public SOAPPart() {} /** * Gets the <CODE>SOAPEnvelope</CODE> object associated with * this <CODE>SOAPPart</CODE> object. Once the SOAP envelope is * obtained, it can be used to get its contents. * @return the <CODE>SOAPEnvelope</CODE> object for this <CODE> * SOAPPart</CODE> object * @throws SOAPException if there is a SOAP error */ public abstract SOAPEnvelope getEnvelope() throws SOAPException; /** * Retrieves the value of the MIME header whose name is * "Content-Id". * @return a <CODE>String</CODE> giving the value of the MIME * header named "Content-Id" * @see #setContentId(java.lang.String) setContentId(java.lang.String) */ public String getContentId() { String as[] = getMimeHeader("Content-Id"); if (as != null && as.length > 0) { return as[0]; } else { return null; } } /** * Retrieves the value of the MIME header whose name is * "Content-Location". * @return a <CODE>String</CODE> giving the value of the MIME * header whose name is "Content-Location" * @see #setContentLocation(java.lang.String) setContentLocation(java.lang.String) */ public String getContentLocation() { String as[] = getMimeHeader("Content-Location"); if (as != null && as.length > 0) { return as[0]; } else { return null; } } /** * Sets the value of the MIME header named "Content-Id" to * the given <CODE>String</CODE>. * @param contentId a <CODE>String</CODE> giving * the value of the MIME header "Content-Id" * @throws java.lang.IllegalArgumentException if * there is a problem in setting the content id * @see #getContentId() getContentId() */ public void setContentId(String contentId) { setMimeHeader("Content-Id", contentId); } /** * Sets the value of the MIME header "Content-Location" to * the given <CODE>String</CODE>. * @param contentLocation a <CODE>String</CODE> * giving the value of the MIME header * "Content-Location" * @throws java.lang.IllegalArgumentException if * there is a problem in setting the content location. * @see #getContentLocation() getContentLocation() */ public void setContentLocation(String contentLocation) { setMimeHeader("Content-Location", contentLocation); } /** * Removes all MIME headers that match the given name. * @param header a <CODE>String</CODE> giving * the name of the MIME header(s) to be removed */ public abstract void removeMimeHeader(String header); /** * Removes all the <CODE>MimeHeader</CODE> objects for this * <CODE>SOAPEnvelope</CODE> object. */ public abstract void removeAllMimeHeaders(); /** * Gets all the values of the <CODE>MimeHeader</CODE> object * in this <CODE>SOAPPart</CODE> object that is identified by * the given <CODE>String</CODE>. * @param name the name of the header; example: * "Content-Type" * @return a <CODE>String</CODE> array giving all the values for * the specified header * @see #setMimeHeader(java.lang.String, java.lang.String) setMimeHeader(java.lang.String, java.lang.String) */ public abstract String[] getMimeHeader(String name); /** * Changes the first header entry that matches the given * header name so that its value is the given value, adding a * new header with the given name and value if no existing * header is a match. If there is a match, this method clears * all existing values for the first header that matches and * sets the given value instead. If more than one header has * the given name, this method removes all of the matching * headers after the first one. * * <P>Note that RFC822 headers can contain only US-ASCII * characters.</P> * @param name a <CODE>String</CODE> giving the * header name for which to search * @param value a <CODE>String</CODE> giving the * value to be set. This value will be substituted for the * current value(s) of the first header that is a match if * there is one. If there is no match, this value will be * the value for a new <CODE>MimeHeader</CODE> object. * @throws java.lang.IllegalArgumentException if * there was a problem with the specified mime header name * or value * @throws java.lang.IllegalArgumentException if there was a problem with the specified mime header name or value * @see #getMimeHeader(java.lang.String) getMimeHeader(java.lang.String) */ public abstract void setMimeHeader(String name, String value); /** * Creates a <CODE>MimeHeader</CODE> object with the specified * name and value and adds it to this <CODE>SOAPPart</CODE> * object. If a <CODE>MimeHeader</CODE> with the specified * name already exists, this method adds the specified value * to the already existing value(s). * * <P>Note that RFC822 headers can contain only US-ASCII * characters.</P> * * @param name a <CODE>String</CODE> giving the * header name * @param value a <CODE>String</CODE> giving the * value to be set or added * @throws java.lang.IllegalArgumentException if * there was a problem with the specified mime header name * or value */ public abstract void addMimeHeader(String name, String value); /** * Retrieves all the headers for this <CODE>SOAPPart</CODE> * object as an iterator over the <CODE>MimeHeader</CODE> * objects. * @return an <CODE>Iterator</CODE> object with all of the Mime * headers for this <CODE>SOAPPart</CODE> object */ public abstract Iterator getAllMimeHeaders(); /** * Retrieves all <CODE>MimeHeader</CODE> objects that match * a name in the given array. * @param names a <CODE>String</CODE> array with * the name(s) of the MIME headers to be returned * @return all of the MIME headers that match one of the names * in the given array, returned as an <CODE>Iterator</CODE> * object */ public abstract Iterator getMatchingMimeHeaders(String names[]); /** * Retrieves all <CODE>MimeHeader</CODE> objects whose name * does not match a name in the given array. * @param names a <CODE>String</CODE> array with * the name(s) of the MIME headers not to be returned * @return all of the MIME headers in this <CODE>SOAPPart</CODE> * object except those that match one of the names in the * given array. The nonmatching MIME headers are returned as * an <CODE>Iterator</CODE> object. */ public abstract Iterator getNonMatchingMimeHeaders(String names[]); /** * Sets the content of the <CODE>SOAPEnvelope</CODE> object * with the data from the given <CODE>Source</CODE> object. * @param source <CODE>javax.xml.transform.Source</CODE> object with the data to * be set * @throws SOAPException if there is a problem in * setting the source * @see #getContent() getContent() */ public abstract void setContent(Source source) throws SOAPException; /** * Returns the content of the SOAPEnvelope as a JAXP <CODE> * Source</CODE> object. * @return the content as a <CODE> * javax.xml.transform.Source</CODE> object * @throws SOAPException if the implementation cannot * convert the specified <CODE>Source</CODE> object * @see #setContent(javax.xml.transform.Source) setContent(javax.xml.transform.Source) */ public abstract Source getContent() throws SOAPException; }
6,759
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/Name.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; /** * A representation of an XML name. This interface provides methods for * getting the local and namespace-qualified names and also for getting the * prefix associated with the namespace for the name. It is also possible * to get the URI of the namespace. * <P> * The following is an example of a namespace declaration in an element. * <PRE> * &lt;wombat:GetLastTradePrice xmlns:wombat="http://www.wombat.org/trader"&gt; * </PRE> * ("xmlns" stands for "XML namespace".) * The following * shows what the methods in the <code>Name</code> interface will return. * <UL> * <LI><code>getQualifiedName</code> will return "prefix:LocalName" = * "WOMBAT:GetLastTradePrice" * <LI><code>getURI</code> will return "http://www.wombat.org/trader" * <LI><code>getLocalName</code> will return "GetLastTracePrice" * <LI><code>getPrefix</code> will return "WOMBAT" * </UL> * <P> * XML namespaces are used to disambiguate SOAP identifiers from * application-specific identifiers. * <P> * <code>Name</code> objects are created using the method * <code>SOAPEnvelope.createName</code>, which has two versions. * One method creates <code>Name</code> objects with * a local name, a namespace prefix, and a namespace URI. * and the second creates <code>Name</code> objects with just a local name. * The following line of * code, in which <i>se</i> is a <code>SOAPEnvelope</code> object, creates a new * <code>Name</code> object with all three. * <PRE> * Name name = se.createName("GetLastTradePrice", "WOMBAT", * "http://www.wombat.org/trader"); * </PRE> * The following line of code gives an example of how a <code>Name</code> object * can be used. The variable <i>element</i> is a <code>SOAPElement</code> object. * This code creates a new <code>SOAPElement</code> object with the given name and * adds it to <i>element</i>. * <PRE> * element.addChildElement(name); * </PRE> */ public interface Name { /** * Gets the local name part of the XML name that this <code>Name</code> * object represents. * @return a string giving the local name */ public abstract String getLocalName(); /** * Gets the namespace-qualified name of the XML name that this * <code>Name</code> object represents. * @return the namespace-qualified name as a string */ public abstract String getQualifiedName(); /** * Returns the prefix associated with the namespace for the XML * name that this <code>Name</code> object represents. * @return the prefix as a string */ public abstract String getPrefix(); /** * Returns the URI of the namespace for the XML * name that this <code>Name</code> object represents. * @return the URI as a string */ public abstract String getURI(); }
6,760
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPElementFactory.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; /** * <P><CODE>SOAPElementFactory</CODE> is a factory for XML * fragments that will eventually end up in the SOAP part. These * fragments can be inserted as children of the <CODE> * SOAPHeader</CODE> or <CODE>SOAPBody</CODE> or <CODE> * SOAPEnvelope</CODE>.</P> * * <P>Elements created using this factory do not have the * properties of an element that lives inside a SOAP header * document. These elements are copied into the XML document tree * when they are inserted.</P> * @deprecated - Use javax.xml.soap.SOAPFactory for creating SOAPElements. * @see SOAPFactory SOAPFactory */ public class SOAPElementFactory { /** * Create a new <code>SOAPElementFactory from a <code>SOAPFactory</code>. * * @param soapfactory the <code>SOAPFactory</code> to use */ private SOAPElementFactory(SOAPFactory soapfactory) { sf = soapfactory; } /** * Create a <CODE>SOAPElement</CODE> object initialized with * the given <CODE>Name</CODE> object. * @param name a <CODE>Name</CODE> object with * the XML name for the new element * @return the new <CODE>SOAPElement</CODE> object that was * created * @throws SOAPException if there is an error in * creating the <CODE>SOAPElement</CODE> object * @deprecated Use javax.xml.soap.SOAPFactory.createElement(javax.xml.soap.Name) instead * @see SOAPFactory#createElement(javax.xml.soap.Name) SOAPFactory.createElement(javax.xml.soap.Name) */ public SOAPElement create(Name name) throws SOAPException { return sf.createElement(name); } /** * Create a <CODE>SOAPElement</CODE> object initialized with * the given local name. * @param localName a <CODE>String</CODE> giving * the local name for the new element * @return the new <CODE>SOAPElement</CODE> object that was * created * @throws SOAPException if there is an error in * creating the <CODE>SOAPElement</CODE> object * @deprecated Use javax.xml.soap.SOAPFactory.createElement(String localName) instead * @see SOAPFactory#createElement(java.lang.String) SOAPFactory.createElement(java.lang.String) */ public SOAPElement create(String localName) throws SOAPException { return sf.createElement(localName); } /** * Create a new <CODE>SOAPElement</CODE> object with the * given local name, prefix and uri. * @param localName a <CODE>String</CODE> giving * the local name for the new element * @param prefix the prefix for this <CODE> * SOAPElement</CODE> * @param uri a <CODE>String</CODE> giving the * URI of the namespace to which the new element * belongs * @return the new <CODE>SOAPElement</CODE> object that was * created * @throws SOAPException if there is an error in * creating the <CODE>SOAPElement</CODE> object * @deprecated Use javax.xml.soap.SOAPFactory.createElement(String localName, String prefix, String uri) instead * @see SOAPFactory#createElement(java.lang.String, java.lang.String, java.lang.String) SOAPFactory.createElement(java.lang.String, java.lang.String, java.lang.String) */ public SOAPElement create(String localName, String prefix, String uri) throws SOAPException { return sf.createElement(localName, prefix, uri); } /** * Creates a new instance of <CODE>SOAPElementFactory</CODE>. * * @return a new instance of a <CODE> * SOAPElementFactory</CODE> * @throws SOAPException if there was an error creating * the default <CODE>SOAPElementFactory</CODE> */ public static SOAPElementFactory newInstance() throws SOAPException { try { return new SOAPElementFactory(SOAPFactory.newInstance()); } catch (Exception exception) { throw new SOAPException("Unable to create SOAP Element Factory: " + exception.getMessage()); } } private SOAPFactory sf; }
6,761
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/Detail.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; import java.util.Iterator; /** * A container for <code>DetailEntry</code> objects. <code>DetailEntry</code> * objects give detailed error information that is application-specific and * related to the <code>SOAPBody</code> object that contains it. * <P> * A <code>Detail</code> object, which is part of a <code>SOAPFault</code> * object, can be retrieved using the method <code>SOAPFault.getDetail</code>. * The <code>Detail</code> interface provides two methods. One creates a new * <code>DetailEntry</code> object and also automatically adds it to * the <code>Detail</code> object. The second method gets a list of the * <code>DetailEntry</code> objects contained in a <code>Detail</code> * object. * <P> * The following code fragment, in which <i>sf</i> is a <code>SOAPFault</code> * object, gets its <code>Detail</code> object (<i>d</i>), adds a new * <code>DetailEntry</code> object to <i>d</i>, and then gets a list of all the * <code>DetailEntry</code> objects in <i>d</i>. The code also creates a * <code>Name</code> object to pass to the method <code>addDetailEntry</code>. * The variable <i>se</i>, used to create the <code>Name</code> object, * is a <code>SOAPEnvelope</code> object. * <PRE> * Detail d = sf.getDetail(); * Name name = se.createName("GetLastTradePrice", "WOMBAT", * "http://www.wombat.org/trader"); * d.addDetailEntry(name); * Iterator it = d.getDetailEntries(); * </PRE> */ public interface Detail extends SOAPFaultElement { /** * Creates a new <code>DetailEntry</code> object with the given * name and adds it to this <code>Detail</code> object. * @param name a <code>Name</code> object identifying the new <code>DetailEntry</code> object * @return DetailEntry. * @throws SOAPException thrown when there is a problem in adding a DetailEntry object to this Detail object. */ public abstract DetailEntry addDetailEntry(Name name) throws SOAPException; /** * Gets a list of the detail entries in this <code>Detail</code> object. * @return an <code>Iterator</code> object over the <code>DetailEntry</code> * objects in this <code>Detail</code> object */ public abstract Iterator getDetailEntries(); }
6,762
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/MimeHeader.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; /** * An object that stores a MIME header name and its value. One * or more <CODE>MimeHeader</CODE> objects may be contained in a * <CODE>MimeHeaders</CODE> object. * @see MimeHeaders MimeHeaders */ public class MimeHeader { /** * Constructs a <CODE>MimeHeader</CODE> object initialized * with the given name and value. * @param name a <CODE>String</CODE> giving the * name of the header * @param value a <CODE>String</CODE> giving the * value of the header */ public MimeHeader(String name, String value) { this.name = name; this.value = value; } /** * Returns the name of this <CODE>MimeHeader</CODE> * object. * @return the name of the header as a <CODE>String</CODE> */ public String getName() { return name; } /** * Returns the value of this <CODE>MimeHeader</CODE> * object. * @return the value of the header as a <CODE>String</CODE> */ public String getValue() { return value; } private String name; private String value; }
6,763
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPBodyElement.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; /** * A <code>SOAPBodyElement</code> object represents the contents in * a <code>SOAPBody</code> object. The <code>SOAPFault</code> interface * is a <code>SOAPBodyElement</code> object that has been defined. * <P> * A new <code>SOAPBodyElement</code> object can be created and added * to a <code>SOAPBody</code> object with the <code>SOAPBody</code> * method <code>addBodyElement</code>. In the following line of code, * <code>sb</code> is a <code>SOAPBody</code> object, and * <code>myName</code> is a <code>Name</code> object. * <PRE> * SOAPBodyElement sbe = sb.addBodyElement(myName); * </PRE> */ public interface SOAPBodyElement extends SOAPElement {}
6,764
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPElement.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; import java.util.Iterator; /** * An object representing the contents in a * <code>SOAPBody</code> object, the contents in a <code>SOAPHeader</code> * object, the content that can follow the <code>SOAPBody</code> object in a * <code>SOAPEnvelope</code> object, or what can follow the detail element * in a <code>SOAPFault</code> object. It is * the base class for all of the classes that represent the SOAP objects as * defined in the SOAP specification. */ public interface SOAPElement extends Node, org.w3c.dom.Element { /** * Creates a new <code>SOAPElement</code> object initialized with the * given <code>Name</code> object and adds the new element to this * <code>SOAPElement</code> object. * @param name a <code>Name</code> object with the XML name for the * new element * @return the new <code>SOAPElement</code> object that was created * @throws SOAPException if there is an error in creating the * <code>SOAPElement</code> object */ public abstract SOAPElement addChildElement(Name name) throws SOAPException; /** * Creates a new <code>SOAPElement</code> object initialized with the * given <code>String</code> object and adds the new element to this * <code>SOAPElement</code> object. * @param localName a <code>String</code> giving the local name for * the element * @return the new <code>SOAPElement</code> object that was created * @throws SOAPException if there is an error in creating the * <code>SOAPElement</code> object */ public abstract SOAPElement addChildElement(String localName) throws SOAPException; /** * Creates a new <code>SOAPElement</code> object initialized with the * specified local name and prefix and adds the new element to this * <code>SOAPElement</code> object. * @param localName a <code>String</code> giving the local name for * the new element * @param prefix a <code>String</code> giving the namespace prefix for * the new element * @return the new <code>SOAPElement</code> object that was created * @throws SOAPException if there is an error in creating the * <code>SOAPElement</code> object */ public abstract SOAPElement addChildElement(String localName, String prefix) throws SOAPException; /** * Creates a new <code>SOAPElement</code> object initialized with the * specified local name, prefix, and URI and adds the new element to this * <code>SOAPElement</code> object. * @param localName a <code>String</code> giving the local name for * the new element * @param prefix a <code>String</code> giving the namespace prefix for * the new element * @param uri a <code>String</code> giving the URI of the namespace * to which the new element belongs * @return the new <code>SOAPElement</code> object that was created * @throws SOAPException if there is an error in creating the * <code>SOAPElement</code> object */ public abstract SOAPElement addChildElement( String localName, String prefix, String uri) throws SOAPException; /** * Add a <code>SOAPElement</code> as a child of this * <code>SOAPElement</code> instance. The <code>SOAPElement</code> * is expected to be created by a * <code>SOAPElementFactory</code>. Callers should not rely on the * element instance being added as is into the XML * tree. Implementations could end up copying the content * of the <code>SOAPElement</code> passed into an instance of * a different <code>SOAPElement</code> implementation. For * instance if <code>addChildElement()</code> is called on a * <code>SOAPHeader</code>, <code>element</code> will be copied * into an instance of a <code>SOAPHeaderElement</code>. * * <P>The fragment rooted in <code>element</code> is either added * as a whole or not at all, if there was an error. * * <P>The fragment rooted in <code>element</code> cannot contain * elements named "Envelope", "Header" or "Body" and in the SOAP * namespace. Any namespace prefixes present in the fragment * should be fully resolved using appropriate namespace * declarations within the fragment itself. * @param element the <code>SOAPElement</code> to be added as a * new child * @return an instance representing the new SOAP element that was * actually added to the tree. * @throws SOAPException if there was an error in adding this * element as a child */ public abstract SOAPElement addChildElement(SOAPElement element) throws SOAPException; /** * Creates a new <code>Text</code> object initialized with the given * <code>String</code> and adds it to this <code>SOAPElement</code> object. * @param text a <code>String</code> object with the textual content to be added * @return the <code>SOAPElement</code> object into which * the new <code>Text</code> object was inserted * @throws SOAPException if there is an error in creating the * new <code>Text</code> object */ public abstract SOAPElement addTextNode(String text) throws SOAPException; /** * Adds an attribute with the specified name and value to this * <code>SOAPElement</code> object. * <p> * @param name a <code>Name</code> object with the name of the attribute * @param value a <code>String</code> giving the value of the attribute * @return the <code>SOAPElement</code> object into which the attribute was * inserted * @throws SOAPException if there is an error in creating the * Attribute */ public abstract SOAPElement addAttribute(Name name, String value) throws SOAPException; /** * Adds a namespace declaration with the specified prefix and URI to this * <code>SOAPElement</code> object. * <p> * @param prefix a <code>String</code> giving the prefix of the namespace * @param uri a <CODE>String</CODE> giving * the prefix of the namespace * @return the <code>SOAPElement</code> object into which this * namespace declaration was inserted. * @throws SOAPException if there is an error in creating the * namespace */ public abstract SOAPElement addNamespaceDeclaration( String prefix, String uri) throws SOAPException; /** * Returns the value of the attribute with the specified * name. * @param name a <CODE>Name</CODE> object with * the name of the attribute * @return a <CODE>String</CODE> giving the value of the * specified attribute */ public abstract String getAttributeValue(Name name); /** * Returns an iterator over all of the attribute names in * this <CODE>SOAPElement</CODE> object. The iterator can be * used to get the attribute names, which can then be passed to * the method <CODE>getAttributeValue</CODE> to retrieve the * value of each attribute. * @return an iterator over the names of the attributes */ public abstract Iterator getAllAttributes(); /** * Returns the URI of the namespace that has the given * prefix. * * @param prefix a <CODE>String</CODE> giving * the prefix of the namespace for which to search * @return a <CODE>String</CODE> with the uri of the namespace * that has the given prefix */ public abstract String getNamespaceURI(String prefix); /** * Returns an iterator of namespace prefixes. The iterator * can be used to get the namespace prefixes, which can then be * passed to the method <CODE>getNamespaceURI</CODE> to retrieve * the URI of each namespace. * @return an iterator over the namespace prefixes in this * <CODE>SOAPElement</CODE> object */ public abstract Iterator getNamespacePrefixes(); /** * Returns the name of this <CODE>SOAPElement</CODE> * object. * @return a <CODE>Name</CODE> object with the name of this * <CODE>SOAPElement</CODE> object */ public abstract Name getElementName(); /** * Removes the attribute with the specified name. * @param name the <CODE>Name</CODE> object with * the name of the attribute to be removed * @return <CODE>true</CODE> if the attribute was removed * successfully; <CODE>false</CODE> if it was not */ public abstract boolean removeAttribute(Name name); /** * Removes the namespace declaration corresponding to the * given prefix. * @param prefix a <CODE>String</CODE> giving * the prefix for which to search * @return <CODE>true</CODE> if the namespace declaration was * removed successfully; <CODE>false</CODE> if it was * not */ public abstract boolean removeNamespaceDeclaration(String prefix); /** * Returns an iterator over all the immediate content of * this element. This includes <CODE>Text</CODE> objects as well * as <CODE>SOAPElement</CODE> objects. * @return an iterator with the content of this <CODE> * SOAPElement</CODE> object */ public abstract Iterator getChildElements(); /** * Returns an iterator over all the child elements with the * specified name. * @param name a <CODE>Name</CODE> object with * the name of the child elements to be returned * @return an <CODE>Iterator</CODE> object over all the elements * in this <CODE>SOAPElement</CODE> object with the * specified name */ public abstract Iterator getChildElements(Name name); /** * Sets the encoding style for this <CODE>SOAPElement</CODE> * object to one specified. * @param encodingStyle a <CODE>String</CODE> * giving the encoding style * @throws java.lang.IllegalArgumentException if * there was a problem in the encoding style being set. * @see #getEncodingStyle() getEncodingStyle() */ public abstract void setEncodingStyle(String encodingStyle) throws SOAPException; /** * Returns the encoding style for this <CODE> * SOAPElement</CODE> object. * @return a <CODE>String</CODE> giving the encoding style * @see #setEncodingStyle(java.lang.String) setEncodingStyle(java.lang.String) */ public abstract String getEncodingStyle(); /** * Detaches all children of this <code>SOAPElement</code>. * <p> * This method is useful for rolling back the construction of partially * completed <code>SOAPHeaders</code> and <code>SOAPBodys</code> in * reparation for sending a fault when an error condition is detected. It is * also useful for recycling portions of a document within a SOAP message. */ public abstract void removeContents(); /** * Returns an <code>Iterator</code> over the namespace prefix * <code>String</code>s visible to this element. The prefixes returned by * this iterator can be passed to the method <code>getNamespaceURI()</code> * to retrieve the URI of each namespace. * * @return an iterator over the namespace prefixes are within scope of this * <code>SOAPElement</code> object */ public abstract Iterator getVisibleNamespacePrefixes(); }
6,765
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/DetailEntry.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; /** * The content for a <code>Detail</code> object, giving details for * a <code>SOAPFault</code> object. A <code>DetailEntry</code> object, * which carries information about errors related to the <code>SOAPBody</code> * object that contains it, is application-specific. * <P> */ public interface DetailEntry extends SOAPElement {}
6,766
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPFaultElement.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; /** * A representation of the contents in * a <code>SOAPFault</code> object. The <code>Detail</code> interface * is a <code>SOAPFaultElement</code> object that has been defined. * <p> * Content is added to a <code>SOAPFaultElement</code> using the * <code>SOAPElement</code> method <code>addTextNode</code>. */ public interface SOAPFaultElement extends SOAPElement {}
6,767
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/MimeHeaders.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; import java.util.Iterator; import java.util.Vector; /** * A container for <CODE>MimeHeader</CODE> objects, which * represent the MIME headers present in a MIME part of a * message. * * <P>This class is used primarily when an application wants to * retrieve specific attachments based on certain MIME headers and * values. This class will most likely be used by implementations * of <CODE>AttachmentPart</CODE> and other MIME dependent parts * of the JAXM API. * @see SOAPMessage#getAttachments() SOAPMessage.getAttachments() * @see AttachmentPart AttachmentPart */ public class MimeHeaders { class MatchingIterator implements Iterator { private Object nextMatch() { label0: while (iterator.hasNext()) { MimeHeader mimeheader = (MimeHeader) iterator.next(); if (names == null) { return match ? null : mimeheader; } for (int i = 0; i < names.length; i++) { if (!mimeheader.getName().equalsIgnoreCase(names[i])) { continue; } if (match) { return mimeheader; } continue label0; } if (!match) { return mimeheader; } } return null; } public boolean hasNext() { if (nextHeader == null) { nextHeader = nextMatch(); } return nextHeader != null; } public Object next() { if (nextHeader != null) { Object obj = nextHeader; nextHeader = null; return obj; } if (hasNext()) { return nextHeader; } else { return null; } } public void remove() { iterator.remove(); } private boolean match; private Iterator iterator; private String names[]; private Object nextHeader; MatchingIterator(String as[], boolean flag) { match = flag; names = as; iterator = headers.iterator(); } } /** * Constructs * a default <CODE>MimeHeaders</CODE> object initialized with * an empty <CODE>Vector</CODE> object. */ public MimeHeaders() { headers = new Vector(); } /** * Returns all of the values for the specified header as an * array of <CODE>String</CODE> objects. * @param name the name of the header for which * values will be returned * @return a <CODE>String</CODE> array with all of the values * for the specified header * @see #setHeader(java.lang.String, java.lang.String) setHeader(java.lang.String, java.lang.String) */ public String[] getHeader(String name) { Vector vector = new Vector(); for (int i = 0; i < headers.size(); i++) { MimeHeader mimeheader = (MimeHeader) headers.elementAt(i); if (mimeheader.getName().equalsIgnoreCase(name) && (mimeheader.getValue() != null)) { vector.addElement(mimeheader.getValue()); } } if (vector.size() == 0) { return null; } else { String as[] = new String[vector.size()]; vector.copyInto(as); return as; } } /** * Replaces the current value of the first header entry whose * name matches the given name with the given value, adding a * new header if no existing header name matches. This method * also removes all matching headers after the first one. * * <P>Note that RFC822 headers can contain only US-ASCII * characters.</P> * @param name a <CODE>String</CODE> with the * name of the header for which to search * @param value a <CODE>String</CODE> with the * value that will replace the current value of the * specified header * @throws java.lang.IllegalArgumentException if there was a * problem in the mime header name or the value being set * @see #getHeader(java.lang.String) getHeader(java.lang.String) */ public void setHeader(String name, String value) { boolean flag = false; if ((name == null) || name.equals("")) { throw new IllegalArgumentException( "Illegal MimeHeader name"); } for (int i = 0; i < headers.size(); i++) { MimeHeader mimeheader = (MimeHeader) headers.elementAt(i); if (mimeheader.getName().equalsIgnoreCase(name)) { if (!flag) { headers.setElementAt(new MimeHeader(mimeheader .getName(), value), i); flag = true; } else { headers.removeElementAt(i--); } } } if (!flag) { addHeader(name, value); } } /** * Adds a <CODE>MimeHeader</CODE> object with the specified * name and value to this <CODE>MimeHeaders</CODE> object's * list of headers. * * <P>Note that RFC822 headers can contain only US-ASCII * characters.</P> * @param name a <CODE>String</CODE> with the * name of the header to be added * @param value a <CODE>String</CODE> with the * value of the header to be added * @throws java.lang.IllegalArgumentException if * there was a problem in the mime header name or value * being added */ public void addHeader(String name, String value) { if ((name == null) || name.equals("")) { throw new IllegalArgumentException( "Illegal MimeHeader name"); } int i = headers.size(); for (int j = i - 1; j >= 0; j--) { MimeHeader mimeheader = (MimeHeader) headers.elementAt(j); if (mimeheader.getName().equalsIgnoreCase(name)) { headers.insertElementAt(new MimeHeader(name, value), j + 1); return; } } headers.addElement(new MimeHeader(name, value)); } /** * Remove all <CODE>MimeHeader</CODE> objects whose name * matches the the given name. * @param name a <CODE>String</CODE> with the * name of the header for which to search */ public void removeHeader(String name) { for (int i = 0; i < headers.size(); i++) { MimeHeader mimeheader = (MimeHeader) headers.elementAt(i); if (mimeheader.getName().equalsIgnoreCase(name)) { headers.removeElementAt(i--); } } } /** * Removes all the header entries from this <CODE> * MimeHeaders</CODE> object. */ public void removeAllHeaders() { headers.removeAllElements(); } /** * Returns all the headers in this <CODE>MimeHeaders</CODE> * object. * @return an <CODE>Iterator</CODE> object over this <CODE> * MimeHeaders</CODE> object's list of <CODE> * MimeHeader</CODE> objects */ public Iterator getAllHeaders() { return headers.iterator(); } /** * Returns all the <CODE>MimeHeader</CODE> objects whose * name matches a name in the given array of names. * @param names an array of <CODE>String</CODE> * objects with the names for which to search * @return an <CODE>Iterator</CODE> object over the <CODE> * MimeHeader</CODE> objects whose name matches one of the * names in the given list */ public Iterator getMatchingHeaders(String names[]) { return new MatchingIterator(names, true); } /** * Returns all of the <CODE>MimeHeader</CODE> objects whose * name does not match a name in the given array of names. * @param names an array of <CODE>String</CODE> * objects with the names for which to search * @return an <CODE>Iterator</CODE> object over the <CODE> * MimeHeader</CODE> objects whose name does not match one * of the names in the given list */ public Iterator getNonMatchingHeaders(String names[]) { return new MatchingIterator(names, false); } // fixme: does this need to be a Vector? Will a non-synchronized impl of // List do? /** * A <code>Vector</code> containing the headers as <code>MimeHeader</code> * instances. */ private Vector headers; }
6,768
0
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml
Create_ds/axis-axis1-java/axis-saaj/src/main/java/javax/xml/soap/SOAPMessage.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 javax.xml.soap; import javax.activation.DataHandler; import java.io.IOException; import java.io.OutputStream; import java.util.Iterator; /** * <P>The root class for all SOAP messages. As transmitted on the * "wire", a SOAP message is an XML document or a MIME message * whose first body part is an XML/SOAP document.</P> * * <P>A <CODE>SOAPMessage</CODE> object consists of a SOAP part * and optionally one or more attachment parts. The SOAP part for * a <CODE>SOAPMessage</CODE> object is a <CODE>SOAPPart</CODE> * object, which contains information used for message routing and * identification, and which can contain application-specific * content. All data in the SOAP Part of a message must be in XML * format.</P> * * <P>A new <CODE>SOAPMessage</CODE> object contains the following * by default:</P> * * <UL> * <LI>A <CODE>SOAPPart</CODE> object</LI> * * <LI>A <CODE>SOAPEnvelope</CODE> object</LI> * * <LI>A <CODE>SOAPBody</CODE> object</LI> * * <LI>A <CODE>SOAPHeader</CODE> object</LI> * </UL> * The SOAP part of a message can be retrieved by calling the * method <CODE>SOAPMessage.getSOAPPart()</CODE>. The <CODE> * SOAPEnvelope</CODE> object is retrieved from the <CODE> * SOAPPart</CODE> object, and the <CODE>SOAPEnvelope</CODE> * object is used to retrieve the <CODE>SOAPBody</CODE> and <CODE> * SOAPHeader</CODE> objects. * <PRE> * SOAPPart sp = message.getSOAPPart(); * SOAPEnvelope se = sp.getEnvelope(); * SOAPBody sb = se.getBody(); * SOAPHeader sh = se.getHeader(); * </PRE> * * <P>In addition to the mandatory <CODE>SOAPPart</CODE> object, a * <CODE>SOAPMessage</CODE> object may contain zero or more <CODE> * AttachmentPart</CODE> objects, each of which contains * application-specific data. The <CODE>SOAPMessage</CODE> * interface provides methods for creating <CODE> * AttachmentPart</CODE> objects and also for adding them to a * <CODE>SOAPMessage</CODE> object. A party that has received a * <CODE>SOAPMessage</CODE> object can examine its contents by * retrieving individual attachment parts.</P> * * <P>Unlike the rest of a SOAP message, an attachment is not * required to be in XML format and can therefore be anything from * simple text to an image file. Consequently, any message content * that is not in XML format must be in an <CODE> * AttachmentPart</CODE> object.</P> * * <P>A <CODE>MessageFactory</CODE> object creates new <CODE> * SOAPMessage</CODE> objects. If the <CODE>MessageFactory</CODE> * object was initialized with a messaging Profile, it produces * <CODE>SOAPMessage</CODE> objects that conform to that Profile. * For example, a <CODE>SOAPMessage</CODE> object created by a * <CODE>MessageFactory</CODE> object initialized with the ebXML * Profile will have the appropriate ebXML headers.</P> * @see MessageFactory MessageFactory * @see AttachmentPart AttachmentPart */ public abstract class SOAPMessage { public SOAPMessage() {} /** * Retrieves a description of this <CODE>SOAPMessage</CODE> * object's content. * @return a <CODE>String</CODE> describing the content of this * message or <CODE>null</CODE> if no description has been * set * @see #setContentDescription(java.lang.String) setContentDescription(java.lang.String) */ public abstract String getContentDescription(); /** * Sets the description of this <CODE>SOAPMessage</CODE> * object's content with the given description. * @param description a <CODE>String</CODE> * describing the content of this message * @see #getContentDescription() getContentDescription() */ public abstract void setContentDescription(String description); /** * Gets the SOAP part of this <CODE>SOAPMessage</CODE> object. * * * <P>If a <CODE>SOAPMessage</CODE> object contains one or * more attachments, the SOAP Part must be the first MIME body * part in the message.</P> * @return the <CODE>SOAPPart</CODE> object for this <CODE> * SOAPMessage</CODE> object */ public abstract SOAPPart getSOAPPart(); /** * Removes all <CODE>AttachmentPart</CODE> objects that have * been added to this <CODE>SOAPMessage</CODE> object. * * <P>This method does not touch the SOAP part.</P> */ public abstract void removeAllAttachments(); /** * Gets a count of the number of attachments in this * message. This count does not include the SOAP part. * @return the number of <CODE>AttachmentPart</CODE> objects * that are part of this <CODE>SOAPMessage</CODE> * object */ public abstract int countAttachments(); /** * Retrieves all the <CODE>AttachmentPart</CODE> objects * that are part of this <CODE>SOAPMessage</CODE> object. * @return an iterator over all the attachments in this * message */ public abstract Iterator getAttachments(); /** * Retrieves all the <CODE>AttachmentPart</CODE> objects * that have header entries that match the specified headers. * Note that a returned attachment could have headers in * addition to those specified. * @param headers a <CODE>MimeHeaders</CODE> * object containing the MIME headers for which to * search * @return an iterator over all attachments that have a header * that matches one of the given headers */ public abstract Iterator getAttachments(MimeHeaders headers); /** * Adds the given <CODE>AttachmentPart</CODE> object to this * <CODE>SOAPMessage</CODE> object. An <CODE> * AttachmentPart</CODE> object must be created before it can be * added to a message. * @param attachmentpart an <CODE> * AttachmentPart</CODE> object that is to become part of * this <CODE>SOAPMessage</CODE> object * @throws java.lang.IllegalArgumentException */ public abstract void addAttachmentPart(AttachmentPart attachmentpart); /** * Creates a new empty <CODE>AttachmentPart</CODE> object. * Note that the method <CODE>addAttachmentPart</CODE> must be * called with this new <CODE>AttachmentPart</CODE> object as * the parameter in order for it to become an attachment to this * <CODE>SOAPMessage</CODE> object. * @return a new <CODE>AttachmentPart</CODE> object that can be * populated and added to this <CODE>SOAPMessage</CODE> * object */ public abstract AttachmentPart createAttachmentPart(); /** * Creates an <CODE>AttachmentPart</CODE> object and * populates it using the given <CODE>DataHandler</CODE> * object. * @param datahandler the <CODE> * javax.activation.DataHandler</CODE> object that will * generate the content for this <CODE>SOAPMessage</CODE> * object * @return a new <CODE>AttachmentPart</CODE> object that * contains data generated by the given <CODE> * DataHandler</CODE> object * @throws java.lang.IllegalArgumentException if * there was a problem with the specified <CODE> * DataHandler</CODE> object * @see DataHandler DataHandler * @see javax.activation.DataContentHandler DataContentHandler */ public AttachmentPart createAttachmentPart(DataHandler datahandler) { AttachmentPart attachmentpart = createAttachmentPart(); attachmentpart.setDataHandler(datahandler); return attachmentpart; } /** * Returns all the transport-specific MIME headers for this * <CODE>SOAPMessage</CODE> object in a transport-independent * fashion. * @return a <CODE>MimeHeaders</CODE> object containing the * <CODE>MimeHeader</CODE> objects */ public abstract MimeHeaders getMimeHeaders(); /** * Creates an <CODE>AttachmentPart</CODE> object and * populates it with the specified data of the specified content * type. * @param content an <CODE>Object</CODE> * containing the content for this <CODE>SOAPMessage</CODE> * object * @param contentType a <CODE>String</CODE> * object giving the type of content; examples are * "text/xml", "text/plain", and "image/jpeg" * @return a new <CODE>AttachmentPart</CODE> object that * contains the given data * @throws java.lang.IllegalArgumentException if the contentType does not match the type of the content * object, or if there was no <CODE> * DataContentHandler</CODE> object for the given content * object * @see DataHandler DataHandler * @see javax.activation.DataContentHandler DataContentHandler */ public AttachmentPart createAttachmentPart(Object content, String contentType) { AttachmentPart attachmentpart = createAttachmentPart(); attachmentpart.setContent(content, contentType); return attachmentpart; } /** * Updates this <CODE>SOAPMessage</CODE> object with all the * changes that have been made to it. This method is called * automatically when a message is sent or written to by the * methods <CODE>ProviderConnection.send</CODE>, <CODE> * SOAPConnection.call</CODE>, or <CODE> * SOAPMessage.writeTo</CODE>. However, if changes are made to * a message that was received or to one that has already been * sent, the method <CODE>saveChanges</CODE> needs to be * called explicitly in order to save the changes. The method * <CODE>saveChanges</CODE> also generates any changes that * can be read back (for example, a MessageId in profiles that * support a message id). All MIME headers in a message that * is created for sending purposes are guaranteed to have * valid values only after <CODE>saveChanges</CODE> has been * called. * * <P>In addition, this method marks the point at which the * data from all constituent <CODE>AttachmentPart</CODE> * objects are pulled into the message.</P> * @throws SOAPException if there * was a problem saving changes to this message. */ public abstract void saveChanges() throws SOAPException; /** * Indicates whether this <CODE>SOAPMessage</CODE> object * has had the method <CODE>saveChanges</CODE> called on * it. * @return <CODE>true</CODE> if <CODE>saveChanges</CODE> has * been called on this message at least once; <CODE> * false</CODE> otherwise. */ public abstract boolean saveRequired(); /** * Writes this <CODE>SOAPMessage</CODE> object to the given * output stream. The externalization format is as defined by * the SOAP 1.1 with Attachments specification. * * <P>If there are no attachments, just an XML stream is * written out. For those messages that have attachments, * <CODE>writeTo</CODE> writes a MIME-encoded byte stream.</P> * @param out the <CODE>OutputStream</CODE> * object to which this <CODE>SOAPMessage</CODE> object will * be written * @throws SOAPException if there was a problem in * externalizing this SOAP message * @throws IOException if an I/O error * occurs */ public abstract void writeTo(OutputStream out) throws SOAPException, IOException; /** * Gets the SOAP Body contained in this <code>SOAPMessage</code> object. * * @return the <code>SOAPBody</code> object contained by this * <code>SOAPMessage</code> object * @throws SOAPException if the SOAP Body does not exist or cannot be * retrieved */ public SOAPBody getSOAPBody() throws SOAPException { throw new UnsupportedOperationException("getSOAPBody must be overridden in subclasses of SOAPMessage"); } /** * Gets the SOAP Header contained in this <code>SOAPMessage</code> object. * * @return the <code>SOAPHeader</code> object contained by this * <code>SOAPMessage</code> object * @throws SOAPException if the SOAP Header does not exist or cannot be * retrieved */ public SOAPHeader getSOAPHeader() throws SOAPException { throw new UnsupportedOperationException("getSOAPHeader must be overridden in subclasses of SOAPMessage"); } /** * Associates the specified value with the specified property. If there was * already a value associated with this property, the old value is replaced. * <p> * The valid property names include <code>WRITE_XML_DECLARATION</code> and * <code>CHARACTER_SET_ENCODING</code>. All of these standard SAAJ * properties are prefixed by "javax.xml.soap". Vendors may also add * implementation specific properties. These properties must be prefixed * with package names that are unique to the vendor. * <p> * Setting the property <code>WRITE_XML_DECLARATION</code> to * <code>"true"</code> will cause an XML Declaration to be written out at * the start of the SOAP message. The default value of "false" suppresses * this declaration. * <p> * The property <code>CHARACTER_SET_ENCODING</code> defaults to the value * <code>"utf-8"</code> which causes the SOAP message to be encoded using * UTF-8. Setting <code>CHARACTER_SET_ENCODING</code> to * <code>"utf-16"</code> causes the SOAP message to be encoded using UTF-16. * <p> * Some implementations may allow encodings in addition to UTF-8 and UTF-16. * Refer to your vendor's documentation for details. * * @param property the property with which the specified value is to be * associated * @param value the value to be associated with the specified property * @throws SOAPException if the property name is not recognized */ public void setProperty(String property, Object value) throws SOAPException { throw new UnsupportedOperationException("setProperty must be overridden in subclasses of SOAPMessage"); } /** * Retrieves value of the specified property. * * @param property the name of the property to retrieve * @return the value of the property or <code>null</code> if no such * property exists * @throws SOAPException if the property name is not recognized */ public Object getProperty(String property) throws SOAPException { throw new UnsupportedOperationException("getProperty must be overridden in subclasses of SOAPMessage"); } /** Specifies the character type encoding for the SOAP Message. */ public static final String CHARACTER_SET_ENCODING = "javax.xml.soap.character-set-encoding"; /** Specifies whether the SOAP Message should contain an XML declaration. */ public static final String WRITE_XML_DECLARATION = "javax.xml.soap.write-xml-declaration"; }
6,769
0
Create_ds/axis-axis1-java/tests/spring-compat-tests/src/test/java/org/apache/axis/test
Create_ds/axis-axis1-java/tests/spring-compat-tests/src/test/java/org/apache/axis/test/spring/RemotingITCase.java
/* * 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.axis.test.spring; import junit.framework.TestCase; import org.springframework.context.support.ClassPathXmlApplicationContext; public class RemotingITCase extends TestCase { public void test() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("context.xml"); OrderManager orderManager = (OrderManager)context.getBean("orderManager"); String orderID = orderManager.submitOrder(new Order("1234", new OrderItem[] { new OrderItem("2345", 2) })); System.out.println(orderManager.getOrder(orderID)); context.close(); } }
6,770
0
Create_ds/axis-axis1-java/tests/spring-compat-tests/src/main/java/org/apache/axis/test
Create_ds/axis-axis1-java/tests/spring-compat-tests/src/main/java/org/apache/axis/test/spring/OrderManager.java
/* * 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.axis.test.spring; public interface OrderManager { String submitOrder(Order order); Order getOrder(String orderID); }
6,771
0
Create_ds/axis-axis1-java/tests/spring-compat-tests/src/main/java/org/apache/axis/test
Create_ds/axis-axis1-java/tests/spring-compat-tests/src/main/java/org/apache/axis/test/spring/OrderManagerBean.java
/* * 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.axis.test.spring; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; public class OrderManagerBean implements OrderManager { private final AtomicInteger orderIDSeq = new AtomicInteger(10000); private final Map<String,Order> orders = Collections.synchronizedMap(new HashMap<String,Order>()); public String submitOrder(Order order) { String orderID = String.valueOf(orderIDSeq.incrementAndGet()); orders.put(orderID, order); return orderID; } public Order getOrder(String orderID) { return (Order)orders.get(orderID); } }
6,772
0
Create_ds/axis-axis1-java/tests/spring-compat-tests/src/main/java/org/apache/axis/test
Create_ds/axis-axis1-java/tests/spring-compat-tests/src/main/java/org/apache/axis/test/spring/OrderEndpoint.java
/* * 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.axis.test.spring; import java.rmi.RemoteException; import org.springframework.remoting.jaxrpc.ServletEndpointSupport; public class OrderEndpoint extends ServletEndpointSupport implements OrderManagerPortType { private OrderManager orderManager; protected void onInit() { orderManager = (OrderManager)getWebApplicationContext().getBean("orderManager"); } public String submitOrder(Order order) throws RemoteException { return orderManager.submitOrder(order); } public Order getOrder(String orderID) throws RemoteException { return orderManager.getOrder(orderID); } }
6,773
0
Create_ds/axis-axis1-java/tests/interop-tests/src/test/java/test/wsdl
Create_ds/axis-axis1-java/tests/interop-tests/src/test/java/test/wsdl/terra/TerraServiceTestCase.java
/** * TerraServiceTestCase.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package test.wsdl.terra; import java.net.URL; public class TerraServiceTestCase extends junit.framework.TestCase { public TerraServiceTestCase(java.lang.String name) { super(name); } public void test11TerraServiceSoapGetPlaceList() throws Exception { TerraServiceSoap binding; try { binding = new TerraServiceLocator().getTerraServiceSoap(new URL("http://localhost:" + System.getProperty("mock.httpPort", "9080") + "/terraservice")); } catch (javax.xml.rpc.ServiceException jre) { throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertTrue("binding is null", binding != null); try { ArrayOfPlaceFacts value = null; value = binding.getPlaceList(new java.lang.String("Boston"), 5, true); PlaceFacts[] facts = value.getPlaceFacts(); for(int i=0;i<facts.length;i++){ System.out.println("City :" + facts[i].getPlace().getCity()); System.out.println("State :" + facts[i].getPlace().getState()); System.out.println("Country :" + facts[i].getPlace().getCountry()); System.out.println("Lat :" + facts[i].getCenter().getLon()); System.out.println("Long :" + facts[i].getCenter().getLat()); System.out.println("Theme :" + facts[i].getAvailableThemeMask()); System.out.println("PlaceType :" + facts[i].getPlaceTypeId().getValue()); System.out.println("Population:" + facts[i].getPopulation()); System.out.println("---------------------------"); } } catch (java.rmi.RemoteException re) { throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re); } } }
6,774
0
Create_ds/axis-axis1-java/tests/interop-tests/src/test/java/test/wsdl/soap12
Create_ds/axis-axis1-java/tests/interop-tests/src/test/java/test/wsdl/soap12/assertion/Soap12TestDocBindingImpl.java
/** * Soap12TestDocBindingImpl.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package test.wsdl.soap12.assertion; public class Soap12TestDocBindingImpl implements test.wsdl.soap12.assertion.Soap12TestPortTypeDoc{ public void emptyBody() throws java.rmi.RemoteException { } public java.lang.String echoOk(java.lang.String echoOk) throws java.rmi.RemoteException { return echoOk; } }
6,775
0
Create_ds/axis-axis1-java/tests/interop-tests/src/test/java/test/wsdl/soap12
Create_ds/axis-axis1-java/tests/interop-tests/src/test/java/test/wsdl/soap12/assertion/WhiteMesaSoap12TestSvcTestCase.java
/** * WhiteMesaSoap12TestSvcTestCase.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package test.wsdl.soap12.assertion; import org.apache.axis.message.SOAPHeaderElement; import org.apache.axis.message.SOAPEnvelope; import org.apache.axis.message.Text; import org.apache.axis.Constants; import org.apache.axis.AxisFault; import org.apache.axis.soap.SOAPConstants; import org.apache.axis.constants.Style; import org.apache.axis.client.Call; import java.net.URL; import java.util.Arrays; import java.util.TimeZone; import java.util.Calendar; import java.util.ArrayList; import java.util.Iterator; public class WhiteMesaSoap12TestSvcTestCase extends junit.framework.TestCase { public final String TEST_NS = "http://example.org/ts-tests"; public final String BASE_URL = "http://localhost:" + System.getProperty("mock.httpPort", "9080"); public final String RPC_ENDPOINT = BASE_URL + "/soap12/test-rpc"; public final String DOC_ENDPOINT = BASE_URL + "/soap12/test-doc"; public final String INTERMEDIARY_ENDPOINT = BASE_URL + "/soap12/test-intermediary"; public final String ROLE_A = "http://example.org/ts-tests/A"; public final String ROLE_B = "http://example.org/ts-tests/B"; public final String ROLE_C = "http://example.org/ts-tests/C"; public WhiteMesaSoap12TestSvcTestCase(java.lang.String name) { super(name); } public void testSoap12TestDocPortWSDL() throws Exception { javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); java.net.URL url = new java.net.URL(DOC_ENDPOINT + "?WSDL"); javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getServiceName()); assertTrue(service != null); } public void testSoap12TestRpcPortWSDL() throws Exception { javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); java.net.URL url = new java.net.URL(RPC_ENDPOINT + "?WSDL"); javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getServiceName()); assertTrue(service != null); } public void test1Soap12TestRpcPortReturnVoid() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); // Test operation binding.returnVoid(); // TBD - validate results } public void test2Soap12TestRpcPortEchoStruct() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); test.wsdl.soap12.assertion.xsd.SOAPStruct input = new test.wsdl.soap12.assertion.xsd.SOAPStruct(); input.setVarFloat(-5); input.setVarInt(10); input.setVarString("EchoStruct"); // Test operation test.wsdl.soap12.assertion.xsd.SOAPStruct output = null; output = binding.echoStruct(input); // TBD - validate results assertEquals(input, output); } public void test3Soap12TestRpcPortEchoStructArray() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); test.wsdl.soap12.assertion.xsd.SOAPStruct[] input = new test.wsdl.soap12.assertion.xsd.SOAPStruct[1]; input[0] = new test.wsdl.soap12.assertion.xsd.SOAPStruct(); input[0].setVarFloat(-5); input[0].setVarInt(10); input[0].setVarString("EchoStruct"); // Test operation test.wsdl.soap12.assertion.xsd.SOAPStruct[] output = null; output = binding.echoStructArray(input); // TBD - validate results assertTrue(Arrays.equals(input,output)); } public void test4Soap12TestRpcPortEchoStructAsSimpleTypes() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); test.wsdl.soap12.assertion.xsd.SOAPStruct input = new test.wsdl.soap12.assertion.xsd.SOAPStruct(); input.setVarFloat(-5); input.setVarInt(10); input.setVarString("EchoStructAsSimpleTypes"); javax.xml.rpc.holders.StringHolder out1 = new javax.xml.rpc.holders.StringHolder(); javax.xml.rpc.holders.IntHolder out2 = new javax.xml.rpc.holders.IntHolder(); javax.xml.rpc.holders.FloatHolder out3 = new javax.xml.rpc.holders.FloatHolder(); // Test operation binding.echoStructAsSimpleTypes(input, out1, out2, out3); // TBD - validate results assertEquals(out1.value, input.getVarString()); assertEquals(out2.value, input.getVarInt()); assertTrue(out3.value == input.getVarFloat()); } public void test5Soap12TestRpcPortEchoSimpleTypesAsStruct() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); String input1 = new String("EchoSimpleTypesAsStruct"); int input2 = 50; float input3 = 45.5F; // Test operation test.wsdl.soap12.assertion.xsd.SOAPStruct output = null; output = binding.echoSimpleTypesAsStruct(input1, input2, input3); // TBD - validate results assertEquals(input1, output.getVarString()); assertEquals(input2, output.getVarInt()); assertTrue(input3 == output.getVarFloat()); } public void test6Soap12TestRpcPortEchoNestedStruct() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); test.wsdl.soap12.assertion.xsd.SOAPStructStruct input = new test.wsdl.soap12.assertion.xsd.SOAPStructStruct(); input.setVarFloat(-5); input.setVarInt(10); input.setVarString("EchoNestedStruct1"); test.wsdl.soap12.assertion.xsd.SOAPStruct inputInner = new test.wsdl.soap12.assertion.xsd.SOAPStruct(); inputInner.setVarFloat(-5); inputInner.setVarInt(10); inputInner.setVarString("EchoNestedStruct2"); input.setVarStruct(inputInner); // Test operation test.wsdl.soap12.assertion.xsd.SOAPStructStruct output = null; output = binding.echoNestedStruct(input); // TBD - validate results assertEquals(input, output); } public void test7Soap12TestRpcPortEchoNestedArray() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); test.wsdl.soap12.assertion.xsd.SOAPArrayStruct input = new test.wsdl.soap12.assertion.xsd.SOAPArrayStruct(); input.setVarFloat(-5); input.setVarInt(10); input.setVarString("EchoNestedArray1"); input.setVarArray(new String[] {"EchoNestedArray2","EchoNestedArray3","EchoNestedArray4"}); // TODO: This does not work :( //// Test operation //test.wsdl.soap12.assertion.xsd.SOAPArrayStruct output = null; //output = binding.echoNestedArray(input); //// TBD - validate results //assertEquals(input, output); } public void test8Soap12TestRpcPortEchoFloatArray() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); float[] input = new float[] { 1.1F, 1.2F, 1.3F }; // Test operation float[] output = null; output = binding.echoFloatArray(input); // TBD - validate results assertTrue(Arrays.equals(input,output)); } public void test9Soap12TestRpcPortEchoStringArray() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); String[] input = new String[] { "1.1F", "1.2F", "1.3F" }; // Test operation java.lang.String[] output = null; output = binding.echoStringArray(input); // TBD - validate results assertTrue(Arrays.equals(input,output)); } public void test10Soap12TestRpcPortEchoIntegerArray() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); int[] input = new int[] { 1, 2, 3 }; // Test operation int[] output = null; output = binding.echoIntegerArray(input); // TBD - validate results assertTrue(Arrays.equals(input,output)); } public void test11Soap12TestRpcPortEchoBase64() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); byte[] input = new byte[] {0xC, 0xA, 0xF, 0xE}; // Test operation byte[] output = null; output = binding.echoBase64(input); // TBD - validate results assertTrue(Arrays.equals(input,output)); } public void test12Soap12TestRpcPortEchoBoolean() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); // Test operation boolean value = false; value = binding.echoBoolean(true); // TBD - validate results assertEquals(true, value); } public void test13Soap12TestRpcPortEchoDate() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); java.util.Calendar input = java.util.Calendar.getInstance(); input.setTimeZone(TimeZone.getTimeZone("GMT")); input.set(Calendar.MILLISECOND, 0); java.util.Calendar output = null; output = binding.echoDate(input); output.setTimeZone(TimeZone.getTimeZone("GMT")); assertEquals(input, output); } public void test14Soap12TestRpcPortEchoDecimal() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); java.math.BigDecimal input = new java.math.BigDecimal(5000); // Test operation java.math.BigDecimal output = null; output = binding.echoDecimal(input); // TBD - validate results assertEquals(input, output); } public void test15Soap12TestRpcPortEchoFloat() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); float input = -334.5F; // Test operation float output = 0; output = binding.echoFloat(input); // TBD - validate results assertTrue(input == output); } public void test16Soap12TestRpcPortEchoString() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); // Test operation java.lang.String value = null; value = binding.echoString(new java.lang.String("EchoString")); // TBD - validate results assertEquals("EchoString", value); } public void test17Soap12TestRpcPortCountItems() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); // Test operation int output = -3; output = binding.countItems(new java.lang.String[] {"Life","is","a","box","of","chocolates"}); // TBD - validate results assertEquals(output, 6); } public void test18Soap12TestRpcPortIsNil() throws Exception { Soap12TestRpcBindingStub binding; try { binding = (Soap12TestRpcBindingStub) new WhiteMesaSoap12TestSvcLocator().getSoap12TestRpcPort(new URL(RPC_ENDPOINT)); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); // TODO: This does not work :( //// Test operation //boolean value = binding.isNil(new java.lang.String("isNil")); // //// TBD - validate results //assertEquals(false, value); } /** * Several tests (T1, etc) use the same functionality, send an empty body * with the "echoOk" header using various roles, and check the return in the * "responseOk" header. * * @throws Exception */ protected void testEchoOkHeaderWithEmptyBody(String role) throws Exception { // Test operation Call call = new Call(DOC_ENDPOINT); call.setOperationStyle(Style.DOCUMENT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); SOAPEnvelope reqEnv = new SOAPEnvelope(SOAPConstants.SOAP12_CONSTANTS); SOAPHeaderElement header = new SOAPHeaderElement(TEST_NS, "echoOk"); header.setRole(role); header.appendChild(new Text("this is a test")); reqEnv.addHeader(header); SOAPEnvelope respEnv = call.invoke(reqEnv); // Get the response header SOAPHeaderElement respHeader = respEnv.getHeaderByName(TEST_NS, "responseOk"); assertNotNull("Missing response header", respHeader); assertEquals("this is a test", respHeader.getValue()); } /** * Test T1 - echoOk header with empty body using "next" role * * @throws Exception */ public void testT1() throws Exception { testEchoOkHeaderWithEmptyBody(Constants.URI_SOAP12_NEXT_ROLE); } /** * Test T2 - echoOk header with empty body using supported role * * @throws Exception */ public void testT2() throws Exception { testEchoOkHeaderWithEmptyBody("http://example.org/ts-tests/C"); } /** * Test T3 - echoOk header with empty body using no role * * @throws Exception */ public void testT3() throws Exception { testEchoOkHeaderWithEmptyBody(null); } /** * Test T4 - echoOk header with empty body using role * "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" * * @throws Exception */ public void testT4() throws Exception { testEchoOkHeaderWithEmptyBody(Constants.URI_SOAP12_ULTIMATE_ROLE); } /** * Test T5 - echoOk header to unrecognized role (should be ignored) * * @throws Exception */ public void testT5() throws Exception { Call call = new Call(DOC_ENDPOINT); call.setOperationStyle(Style.DOCUMENT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); SOAPEnvelope reqEnv = new SOAPEnvelope(SOAPConstants.SOAP12_CONSTANTS); SOAPHeaderElement header = new SOAPHeaderElement(TEST_NS, "echoOk"); header.setRole(ROLE_B); header.setObjectValue("test header"); reqEnv.addHeader(header); SOAPEnvelope respEnv = call.invoke(reqEnv); assertTrue("Got unexpected header!", respEnv.getHeaders().isEmpty()); } /** * Test T6 - echoOk header targeted at endpoint via intermediary * * @throws Exception */ public void testT6() throws Exception { Call call = new Call(INTERMEDIARY_ENDPOINT); call.setOperationStyle(Style.DOCUMENT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); SOAPEnvelope reqEnv = new SOAPEnvelope(SOAPConstants.SOAP12_CONSTANTS); SOAPHeaderElement header = new SOAPHeaderElement(TEST_NS, "echoOk"); header.setRole(ROLE_C); header.setObjectValue("test header"); reqEnv.addHeader(header); SOAPEnvelope respEnv = call.invoke(reqEnv); SOAPHeaderElement respHeader = respEnv.getHeaderByName(TEST_NS, "responseOk"); assertNotNull(respHeader); assertEquals("test header", respHeader.getValue()); } /** * Test T12 - unknown header, with MustUnderstand true * * @throws Exception */ public void testT12() throws Exception { Call call = new Call(DOC_ENDPOINT); call.setOperationStyle(Style.DOCUMENT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); SOAPEnvelope reqEnv = new SOAPEnvelope(SOAPConstants.SOAP12_CONSTANTS); SOAPHeaderElement header = new SOAPHeaderElement(TEST_NS, "Unknown"); header.appendChild(new Text("test header")); header.setRole(Constants.URI_SOAP12_ULTIMATE_ROLE); header.setMustUnderstand(true); reqEnv.addHeader(header); try { call.invoke(reqEnv); } catch (AxisFault fault) { assertEquals(Constants.FAULT_SOAP12_MUSTUNDERSTAND, fault.getFaultCode()); ArrayList headers = fault.getHeaders(); // If there is a NotUnderstood header, check it for (Iterator i = headers.iterator(); i.hasNext();) { SOAPHeaderElement h = (SOAPHeaderElement) i.next(); if (h.getQName().equals(Constants.QNAME_NOTUNDERSTOOD)) { // TODO : check qname attribute } } return; } fail("Didn't receive expected fault!"); } public void test20Soap12TestDocPortEchoOk() throws Exception { test.wsdl.soap12.assertion.Soap12TestDocBindingStub binding; try { binding = (test.wsdl.soap12.assertion.Soap12TestDocBindingStub) new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getSoap12TestDocPort(); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); // TODO: This does not work :( //// Test operation //java.lang.String value = null; // value = binding.echoOk(new java.lang.String("EchoOk")); //// TBD - validate results //assertEquals(value, "EchoOk"); } }
6,776
0
Create_ds/axis-axis1-java/tests/interop-tests/src/test/java/test/wsdl/soap12
Create_ds/axis-axis1-java/tests/interop-tests/src/test/java/test/wsdl/soap12/assertion/Soap12TestRpcBindingImpl.java
/** * Soap12TestRpcBindingImpl.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package test.wsdl.soap12.assertion; public class Soap12TestRpcBindingImpl implements test.wsdl.soap12.assertion.Soap12TestPortTypeRpc{ public void returnVoid() throws java.rmi.RemoteException { } public test.wsdl.soap12.assertion.xsd.SOAPStruct echoStruct(test.wsdl.soap12.assertion.xsd.SOAPStruct inputStruct) throws java.rmi.RemoteException { return inputStruct; } public test.wsdl.soap12.assertion.xsd.SOAPStruct[] echoStructArray(test.wsdl.soap12.assertion.xsd.SOAPStruct[] inputStructArray) throws java.rmi.RemoteException { return inputStructArray; } public void echoStructAsSimpleTypes(test.wsdl.soap12.assertion.xsd.SOAPStruct inputStruct, javax.xml.rpc.holders.StringHolder outputString, javax.xml.rpc.holders.IntHolder outputInteger, javax.xml.rpc.holders.FloatHolder outputFloat) throws java.rmi.RemoteException { outputString.value = inputStruct.getVarString(); outputInteger.value = inputStruct.getVarInt(); outputFloat.value = inputStruct.getVarFloat(); } public test.wsdl.soap12.assertion.xsd.SOAPStruct echoSimpleTypesAsStruct(java.lang.String inputString, int inputInteger, float inputFloat) throws java.rmi.RemoteException { test.wsdl.soap12.assertion.xsd.SOAPStruct ret = new test.wsdl.soap12.assertion.xsd.SOAPStruct(); ret.setVarString(inputString); ret.setVarInt(inputInteger); ret.setVarFloat(inputFloat); return ret; } public test.wsdl.soap12.assertion.xsd.SOAPStructStruct echoNestedStruct(test.wsdl.soap12.assertion.xsd.SOAPStructStruct inputStruct) throws java.rmi.RemoteException { return inputStruct; } public test.wsdl.soap12.assertion.xsd.SOAPArrayStruct echoNestedArray(test.wsdl.soap12.assertion.xsd.SOAPArrayStruct inputStruct) throws java.rmi.RemoteException { return inputStruct; } public float[] echoFloatArray(float[] inputFloatArray) throws java.rmi.RemoteException { return inputFloatArray; } public java.lang.String[] echoStringArray(java.lang.String[] inputStringArray) throws java.rmi.RemoteException { return inputStringArray; } public int[] echoIntegerArray(int[] inputIntegerArray) throws java.rmi.RemoteException { return inputIntegerArray; } public byte[] echoBase64(byte[] inputBase64) throws java.rmi.RemoteException { return inputBase64; } public boolean echoBoolean(boolean inputBoolean) throws java.rmi.RemoteException { return inputBoolean; } public java.util.Calendar echoDate(java.util.Calendar inputDate) throws java.rmi.RemoteException { return inputDate; } public java.math.BigDecimal echoDecimal(java.math.BigDecimal inputDecimal) throws java.rmi.RemoteException { return inputDecimal; } public float echoFloat(float inputFloat) throws java.rmi.RemoteException { return inputFloat; } public java.lang.String echoString(java.lang.String inputString) throws java.rmi.RemoteException { return inputString; } public int countItems(java.lang.String[] inputStringArray) throws java.rmi.RemoteException { return inputStringArray.length; } public boolean isNil(java.lang.String inputString) throws java.rmi.RemoteException { return (inputString == null || inputString.length() == 0); } }
6,777
0
Create_ds/axis-axis1-java/tests/interop-tests/src/test/java/test/wsdl/soap12
Create_ds/axis-axis1-java/tests/interop-tests/src/test/java/test/wsdl/soap12/additional/Soap12AddTestRpcBindingImpl.java
/** * Soap12AddTestRpcBindingImpl.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package test.wsdl.soap12.additional; public class Soap12AddTestRpcBindingImpl implements test.wsdl.soap12.additional.Soap12AddTestPortTypeRpc{ public void echoVoid() throws java.rmi.RemoteException { } public test.wsdl.soap12.additional.xsd.SOAPStruct echoSimpleTypesAsStruct(java.lang.String inputString, int inputInteger, float inputFloat) throws java.rmi.RemoteException { return null; } // getTime is a notification style operation and is unsupported. public java.lang.String echoString(java.lang.String inputString) throws java.rmi.RemoteException { return inputString; } public test.wsdl.soap12.additional.xsd.SOAPStructTypes echoSimpleTypesAsStructOfSchemaTypes(java.lang.Object input1, java.lang.Object input2, java.lang.Object input3, java.lang.Object input4) throws java.rmi.RemoteException { return null; } public int echoInteger(int inputInteger) throws java.rmi.RemoteException { return -3; } }
6,778
0
Create_ds/axis-axis1-java/tests/interop-tests/src/test/java/test/wsdl/soap12
Create_ds/axis-axis1-java/tests/interop-tests/src/test/java/test/wsdl/soap12/additional/WhiteMesaSoap12AddTestSvcTestCase.java
/** * WhiteMesaSoap12AddTestSvcTestCase.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package test.wsdl.soap12.additional; import org.apache.axis.AxisFault; import org.apache.axis.Constants; import org.apache.axis.utils.XMLUtils; import org.apache.axis.client.Call; import org.apache.axis.encoding.ser.BeanDeserializerFactory; import org.apache.axis.encoding.ser.BeanSerializerFactory; import org.apache.axis.constants.Style; import org.apache.axis.constants.Use; import org.apache.axis.message.*; import org.apache.axis.soap.SOAP12Constants; import org.apache.axis.soap.SOAPConstants; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.w3c.dom.Node; import org.w3c.dom.Element; import test.wsdl.soap12.additional.xsd.SOAPStruct; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import java.util.Vector; import java.net.URL; /** * Additional SOAP 1.2 tests. * * For details, see: * * http://www.w3.org/2000/xp/Group/2/03/soap1.2implementation.html#addtests * * Auto-generated from WhiteMesa's WSDL, with additional coding by: * @author Davanum Srinivas (dims@apache.org) * @author Glen Daniels (gdaniels@apache.org) */ public class WhiteMesaSoap12AddTestSvcTestCase extends junit.framework.TestCase { public static final String STRING_VAL = "SOAP 1.2 is cool!"; public static final float FLOAT_VAL = 3.14F; public static final Float FLOAT_OBJVAL = new Float(FLOAT_VAL); public static final int INT_VAL = 69; public static final Integer INT_OBJVAL = new Integer(INT_VAL); public final String TEST_NS = "http://soapinterop.org/"; public final QName ECHO_STRING_QNAME = new QName(TEST_NS, "echoString"); // Endpoints // TODO : Shouldn't be hardcoded! public static String HOST = "http://localhost:" + System.getProperty("mock.httpPort", "9080"); // public static String HOST = "http://www.whitemesa.net"; public static String RPC_ENDPOINT = HOST + "/soap12/add-test-rpc"; public static String DOC_ENDPOINT = HOST + "/soap12/add-test-doc"; public static String GET_DOC_ENDPOINT = HOST + "/soap12/add-test-doc/getTime"; public static String GET_RPC_ENDPOINT = HOST + "/soap12/add-test-rpc/getTime"; public static String DOC_INT_ENDPOINT = HOST + "/soap12/add-test-doc-int"; public static String DOC_INT_UC_ENDPOINT = HOST + "/soap12/add-test-doc-int-uc"; private QName SOAPSTRUCT_QNAME = new QName("http://example.org/ts-tests/xsd", "SOAPStruct"); static String configFile = null; public static void main(String[] args) throws Exception { // If we have an argument, it's a configuration file. if (args.length > 0) { configFile = args[0]; } WhiteMesaSoap12AddTestSvcTestCase tester = new WhiteMesaSoap12AddTestSvcTestCase("testXMLP5"); tester.setUp(); tester.testXMLP19(); System.out.println("Done."); // junit.textui.TestRunner.run(WhiteMesaSoap12AddTestSvcTestCase.class); } public WhiteMesaSoap12AddTestSvcTestCase(java.lang.String name) { super(name); } public void testSoap12AddTestDocUpperPortWSDL() throws Exception { javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); java.net.URL url = new java.net.URL(DOC_INT_UC_ENDPOINT + "?WSDL"); javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getServiceName()); assertTrue(service != null); } public void testSoap12AddTestRpcPortWSDL() throws Exception { javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); java.net.URL url = new java.net.URL(RPC_ENDPOINT + "?WSDL"); javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getServiceName()); assertTrue(service != null); } public void testSoap12AddTestDocIntermediaryPortWSDL() throws Exception { javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); java.net.URL url = new java.net.URL(DOC_INT_ENDPOINT + "?WSDL"); javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getServiceName()); assertTrue(service != null); } public void testSoap12AddTestDocPortWSDL() throws Exception { javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); java.net.URL url = new java.net.URL(DOC_ENDPOINT + "?WSDL"); javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getServiceName()); assertTrue(service != null); } protected void setUp() throws Exception { if (configFile == null) { configFile = System.getProperty("configFile"); } if (configFile == null) { return; } Document doc = XMLUtils.newDocument(configFile); NodeList nl = doc.getDocumentElement().getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node node = nl.item(i); if (!(node instanceof Element)) continue; Element el = (Element) node; String tag = el.getLocalName(); String data = XMLUtils.getChildCharacterData(el); if ("host".equals(tag)) { HOST = data; RPC_ENDPOINT = HOST + "/soap12/add-test-rpc"; DOC_ENDPOINT = HOST + "/soap12/add-test-doc"; GET_DOC_ENDPOINT = HOST + "/soap12/add-test-doc/getTime"; GET_RPC_ENDPOINT = HOST + "/soap12/add-test-rpc/getTime"; DOC_INT_ENDPOINT = HOST + "/soap12/add-test-doc-int"; DOC_INT_UC_ENDPOINT = HOST + "/soap12/add-test-doc-int-uc"; } else if ("rpcEndpoint".equals(tag)) { RPC_ENDPOINT = data; } else if ("docEndpoint".equals(tag)) { DOC_ENDPOINT = data; } else if ("getRpcEndpoint".equals(tag)) { GET_RPC_ENDPOINT = data; } else if ("getDocEndpoint".equals(tag)) { GET_DOC_ENDPOINT = data; } else if ("docIntEndpoint".equals(tag)) { DOC_INT_ENDPOINT = data; } else if ("docIntUcEndpoint".equals(tag)) { DOC_INT_UC_ENDPOINT = data; } } } /** * Test xmlp-1 - call echoString with no arguments (even though it expects * one). Confirm bad arguments fault from endpoint. * * @throws Exception */ public void testXMLP1() throws Exception { Call call = new Call(RPC_ENDPOINT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); try { call.invoke(ECHO_STRING_QNAME, null); } catch (AxisFault fault) { assertEquals(Constants.FAULT_SOAP12_SENDER, fault.getFaultCode()); QName [] subCodes = fault.getFaultSubCodes(); assertNotNull(subCodes); assertEquals(1, subCodes.length); assertEquals(Constants.FAULT_SUBCODE_BADARGS, subCodes[0]); return; } fail("Didn't catch expected fault"); } /** * Test xmlp-2, using the GET webmethod. * * @throws Exception */ public void testXMLP2() throws Exception { Call call = new Call(GET_DOC_ENDPOINT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); call.setProperty(SOAP12Constants.PROP_WEBMETHOD, "GET"); call.setOperationStyle(Style.DOCUMENT); call.setOperationUse(Use.LITERAL); call.invoke(); SOAPEnvelope env = call.getMessageContext().getResponseMessage().getSOAPEnvelope(); Object result = env.getFirstBody().getValueAsType(Constants.XSD_TIME); assertEquals(org.apache.axis.types.Time.class, result.getClass()); // Suppose we could check the actual time here too, but we aren't // gonna for now. } /** * Test xmlp-3, using the GET webmethod and RPC mode (i.e. deal with * the rpc:result element). * * @throws Exception */ public void testXMLP3() throws Exception { Call call = new Call(GET_RPC_ENDPOINT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); call.setProperty(SOAP12Constants.PROP_WEBMETHOD, "GET"); call.setOperationStyle(Style.RPC); call.setReturnType(Constants.XSD_TIME); Object ret = call.invoke("", new Object [] {}); assertEquals(org.apache.axis.types.Time.class, ret.getClass()); // Suppose we could check the actual time here too, but we aren't // gonna for now. } public void testXMLP4() throws Exception { Call call = new Call(RPC_ENDPOINT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); call.registerTypeMapping(SOAPStruct.class, SOAPSTRUCT_QNAME, new BeanSerializerFactory(SOAPStruct.class, SOAPSTRUCT_QNAME), new BeanDeserializerFactory(SOAPStruct.class, SOAPSTRUCT_QNAME)); call.addParameter(new QName("", "inputFloat"), Constants.XSD_FLOAT, ParameterMode.IN); call.addParameter(new QName("", "inputInteger"), Constants.XSD_INT, ParameterMode.IN); call.addParameter(new QName("", "inputString"), Constants.XSD_STRING, ParameterMode.IN); call.setReturnType(SOAPSTRUCT_QNAME); SOAPStruct ret = (SOAPStruct)call.invoke( new QName(TEST_NS, "echoSimpleTypesAsStruct"), new Object [] { new Float(FLOAT_VAL), new Integer(INT_VAL), STRING_VAL }); assertEquals(STRING_VAL, ret.getVarString()); assertEquals(FLOAT_VAL, ret.getVarFloat(), 0.0004F); assertEquals(INT_VAL, ret.getVarInt()); } public void testXMLP5() throws Exception { Call call = new Call(RPC_ENDPOINT); try { call.invoke(new QName(TEST_NS, "echoVoid"), null); } catch (AxisFault fault) { // Got the expected Fault - make sure it looks right assertEquals(Constants.FAULT_VERSIONMISMATCH, fault.getFaultCode()); return; } fail("Didn't catch expected fault"); } public void testXMLP6() throws Exception { Call call = new Call(RPC_ENDPOINT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); SOAPHeaderElement unknownHeader = new SOAPHeaderElement("http://example.org", "unknown", "Nobody understands me!"); unknownHeader.setMustUnderstand(true); // TODO: the role is set by default to next, but using the URI for SOAP 1.1; that looks like a bug unknownHeader.setRole(SOAPConstants.SOAP12_CONSTANTS.getNextRoleURI()); call.addHeader(unknownHeader); try { call.invoke(new QName(TEST_NS, "echoVoid"), null); } catch (AxisFault fault) { // Got the expected Fault - make sure it looks right assertEquals(Constants.FAULT_SOAP12_MUSTUNDERSTAND, fault.getFaultCode()); return; } fail("Didn't catch expected fault"); } public void testXMLP7() throws Exception { URL url = new URL(DOC_ENDPOINT); test.wsdl.soap12.additional.Soap12AddTestDocBindingStub binding; try { binding = (test.wsdl.soap12.additional.Soap12AddTestDocBindingStub) new test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getSoap12AddTestDocPort(url); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); // Test operation try { binding.echoSenderFault(STRING_VAL); } catch (java.rmi.RemoteException e) { if (e instanceof AxisFault) { AxisFault af = (AxisFault)e; assertEquals(Constants.FAULT_SOAP12_SENDER, af.getFaultCode()); return; // success } } fail("Should have received sender fault!"); } public void testXMLP8() throws Exception { Soap12AddTestPortTypeDoc binding = new WhiteMesaSoap12AddTestSvcLocator().getSoap12AddTestDocPort(new URL(DOC_ENDPOINT)); try { binding.echoReceiverFault("test"); } catch (AxisFault af) { assertEquals(Constants.FAULT_SOAP12_RECEIVER, af.getFaultCode()); return; // success } fail("Should have received receiver fault!"); } /** * Test xmlp-9 : do an "echoString" call with a bad (unknown) encoding * style on the argument. Confirm Sender fault from endpoint. * * @throws Exception */ public void testXMLP9() throws Exception { Call call = new Call(RPC_ENDPOINT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); SOAPEnvelope reqEnv = new SOAPEnvelope(SOAPConstants.SOAP12_CONSTANTS); SOAPBodyElement body = new SOAPBodyElement(new PrefixedQName(TEST_NS, "echoString", "ns")); reqEnv.addBodyElement(body); MessageElement arg = new MessageElement("", "inputString"); arg.setEncodingStyle("http://this-is-a-bad-encoding-style"); body.addChild(arg); try { call.invoke(reqEnv); } catch (AxisFault fault) { assertEquals(Constants.FAULT_SOAP12_DATAENCODINGUNKNOWN, fault.getFaultCode()); return; } fail("Didn't catch expected fault"); } /** * Test xmlp-10 : reply with the schema types of the arguments, in order */ // public void testXMLP10() throws Exception { // Call call = new Call(RPC_ENDPOINT); // call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); // SOAPEnvelope reqEnv = new SOAPEnvelope(SOAPConstants.SOAP12_CONSTANTS); // SOAPBodyElement body = new SOAPBodyElement( // new PrefixedQName(TEST_NS, // "echoSimpleTypesAsStructOfSchemaTypes", "ns")); // reqEnv.addBodyElement(body); // MessageElement arg = new MessageElement("", "input1"); // arg.setObjectValue(new Integer(5)); // body.addChild(arg); // arg = new MessageElement("", "input2"); // arg.setObjectValue(new Float(5.5F)); // body.addChild(arg); // arg = new MessageElement("", "input3"); // arg.setObjectValue("hi there"); // body.addChild(arg); // arg = new MessageElement("", "input4"); // Text text = new Text("untyped"); // arg.addChild(text); // body.addChild(arg); // call.invoke(reqEnv); // } /** * Test xmlp-11 : send a string where an integer is expected, confirm * BadArguments fault. * * @throws Exception */ public void testXMLP11() throws Exception { Call call = new Call(RPC_ENDPOINT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); call.setProperty(Call.SEND_TYPE_ATTR, Boolean.FALSE); try { call.invoke(new QName(TEST_NS, "echoInteger"), new Object [] { new RPCParam("inputInteger", "ceci n'est pas un int") } ); } catch (AxisFault fault) { assertEquals(Constants.FAULT_SOAP12_SENDER, fault.getFaultCode()); QName [] subCodes = fault.getFaultSubCodes(); assertNotNull(subCodes); assertEquals(1, subCodes.length); assertEquals(Constants.FAULT_SUBCODE_BADARGS, subCodes[0]); return; } fail("Didn't catch expected fault"); } /** * Test xmlp-12 : unknown method call to RPC endpoint. Confirm * "ProcedureNotPresent" subcode of "Sender" fault. * * @throws Exception */ public void testXMLP12() throws Exception { Call call = new Call(RPC_ENDPOINT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); call.addParameter(new QName("inputInteger"), Constants.XSD_INT, ParameterMode.IN); try { call.invoke(new QName(TEST_NS, "unknownFreakyMethod"), new Object [] { new Integer(5) }); } catch (AxisFault fault) { assertEquals(Constants.FAULT_SOAP12_SENDER, fault.getFaultCode()); QName [] subCodes = fault.getFaultSubCodes(); assertNotNull(subCodes); assertEquals(1, subCodes.length); assertEquals(Constants.FAULT_SUBCODE_PROC_NOT_PRESENT, subCodes[0]); return; } fail("Didn't catch expected fault"); } /** * Test xmlp-13 : doc/lit echoString which sends back the original * message via a transparent "forwarding intermediary" * */ public void testXMLP13() throws Exception { String ARG = "i FeEL sTrAnGEly CAsEd (but I like it)"; Call call = new Call(DOC_INT_ENDPOINT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); call.setOperationStyle(Style.WRAPPED); call.addParameter(new QName("", "inputString"), Constants.XSD_STRING, ParameterMode.IN); call.setReturnType(Constants.XSD_STRING); String ret = (String)call.invoke(ECHO_STRING_QNAME, new Object [] { ARG }); assertEquals("Return didn't match argument", ARG, ret); } /** * Test xmlp-14 : doc/lit echoString which sends back the original * message via an "active intermediary" (translating the string * to uppercase) * */ public void testXMLP14() throws Exception { String ARG = "i FeEL sTrAnGEly CAsEd (and dream of UPPER)"; Call call = new Call(DOC_INT_UC_ENDPOINT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); call.setOperationStyle(Style.WRAPPED); call.addParameter(new QName("", "inputString"), Constants.XSD_STRING, ParameterMode.IN); call.setReturnType(Constants.XSD_STRING); String ret = (String)call.invoke(ECHO_STRING_QNAME, new Object [] { ARG }); assertEquals("Return wasn't uppercased argument", ARG.toUpperCase(), ret); } public void testXMLP15() throws Exception { String HEADER_VAL = "I'm going to be discarded!"; String HEADER_NS = "http://test-xmlp-15"; String HEADER_NAME = "unknown"; Call call = new Call(DOC_INT_ENDPOINT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); call.setOperationStyle(Style.WRAPPED); call.setOperationUse(Use.LITERAL); SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS, HEADER_NAME); header.setRole(Constants.URI_SOAP12_NEXT_ROLE); header.setObjectValue(HEADER_VAL); call.addHeader(header); call.addParameter(new QName("", "inputString"), Constants.XSD_STRING, ParameterMode.IN); call.invoke(ECHO_STRING_QNAME, new Object [] { "body string" }); SOAPEnvelope respEnv = call.getMessageContext().getResponseMessage().getSOAPEnvelope(); // Confirm we got no headers back Vector headers = respEnv.getHeaders(); assertTrue("Headers Vector wasn't empty", headers.isEmpty()); } public void testXMLP16() throws Exception { String HEADER_VAL = "I'm going all the way through!"; String HEADER_NS = "http://test-xmlp-16"; String HEADER_NAME = "unknown"; QName HEADER_QNAME = new QName(HEADER_NS, HEADER_NAME); Call call = new Call(DOC_INT_ENDPOINT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS, HEADER_NAME); header.setRole(Constants.URI_SOAP12_NONE_ROLE); header.setObjectValue(HEADER_VAL); call.addHeader(header); call.addParameter(new QName("", "inputString"), Constants.XSD_STRING, ParameterMode.IN); call.invoke(ECHO_STRING_QNAME, new Object [] { "body string" }); SOAPEnvelope respEnv = call.getMessageContext().getResponseMessage().getSOAPEnvelope(); // Confirm we got our header back Vector headers = respEnv.getHeaders(); assertEquals(1, headers.size()); SOAPHeaderElement respHeader = (SOAPHeaderElement)headers.get(0); assertEquals(Constants.URI_SOAP12_NONE_ROLE, respHeader.getRole()); assertEquals(HEADER_QNAME, respHeader.getQName()); assertEquals(HEADER_VAL, respHeader.getValue()); } public void testXMLP17() throws Exception { String HEADER_VAL = "I'm going all the way through!"; String HEADER_NS = "http://test-xmlp-17"; String HEADER_NAME = "seekrit"; QName HEADER_QNAME = new QName(HEADER_NS, HEADER_NAME); Call call = new Call(DOC_INT_ENDPOINT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS, HEADER_NAME); header.setRole(Constants.URI_SOAP12_ULTIMATE_ROLE); header.setObjectValue(HEADER_VAL); call.addHeader(header); call.addParameter(new QName("", "inputString"), Constants.XSD_STRING, ParameterMode.IN); call.invoke(ECHO_STRING_QNAME, new Object [] { "body string" }); SOAPEnvelope respEnv = call.getMessageContext().getResponseMessage().getSOAPEnvelope(); // Confirm we got a single header back, targeted at the ultimate // receiver Vector headers = respEnv.getHeaders(); assertEquals(1, headers.size()); SOAPHeaderElement respHeader = (SOAPHeaderElement)headers.get(0); assertEquals(Constants.URI_SOAP12_ULTIMATE_ROLE, respHeader.getRole()); assertEquals(HEADER_QNAME, respHeader.getQName()); assertEquals(HEADER_VAL, respHeader.getValue()); } public void testXMLP18() throws Exception { String HEADER_VAL = "I'm going all the way through!"; String HEADER_NS = "http://test-xmlp-17"; String HEADER_NAME = "seekrit"; QName HEADER_QNAME = new QName(HEADER_NS, HEADER_NAME); Call call = new Call(DOC_INT_ENDPOINT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS, HEADER_NAME); header.setRole(Constants.URI_SOAP12_NEXT_ROLE); header.setRelay(true); header.setObjectValue(HEADER_VAL); call.addHeader(header); call.addParameter(new QName("", "inputString"), Constants.XSD_STRING, ParameterMode.IN); call.invoke(ECHO_STRING_QNAME, new Object [] { "body string" }); SOAPEnvelope respEnv = call.getMessageContext().getResponseMessage().getSOAPEnvelope(); // Confirm we got a single header back, targeted at the ultimate // receiver Vector headers = respEnv.getHeaders(); assertEquals(1, headers.size()); SOAPHeaderElement respHeader = (SOAPHeaderElement)headers.get(0); assertEquals(Constants.URI_SOAP12_NEXT_ROLE, respHeader.getRole()); assertTrue(respHeader.getRelay()); assertEquals(HEADER_QNAME, respHeader.getQName()); assertEquals(HEADER_VAL, respHeader.getValue()); } public void testXMLP19() throws Exception { String HEADER_VAL = "I'm going to generate a fault!"; String HEADER_NS = "http://test-xmlp-17"; String HEADER_NAME = "seekrit"; Call call = new Call(DOC_INT_ENDPOINT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS, HEADER_NAME); header.setRole(Constants.URI_SOAP12_NEXT_ROLE); header.setMustUnderstand(true); header.setObjectValue(HEADER_VAL); call.addHeader(header); call.addParameter(new QName("", "inputString"), Constants.XSD_STRING, ParameterMode.IN); try { call.invoke(ECHO_STRING_QNAME, new Object [] { "body string" }); } catch (AxisFault fault) { // Got the expected Fault - make sure it looks right assertEquals(Constants.FAULT_SOAP12_MUSTUNDERSTAND, fault.getFaultCode()); return; } fail("Didn't catch expected fault"); } }
6,779
0
Create_ds/axis-axis1-java/tests/interop-tests/src/test/java/test/wsdl/soap12
Create_ds/axis-axis1-java/tests/interop-tests/src/test/java/test/wsdl/soap12/additional/Soap12AddTestDocBindingImpl.java
/** * Soap12AddTestDocBindingImpl.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package test.wsdl.soap12.additional; public class Soap12AddTestDocBindingImpl implements test.wsdl.soap12.additional.Soap12AddTestPortTypeDoc{ // getTime is a notification style operation and is unsupported. public java.lang.String echoString(java.lang.String inputString) throws java.rmi.RemoteException { return null; } public void echoSenderFault(java.lang.Object inElement) throws java.rmi.RemoteException { } public void echoReceiverFault(java.lang.Object inElement) throws java.rmi.RemoteException { } }
6,780
0
Create_ds/axis-axis1-java/axis-rt-transport-mail/src/main/java/org/apache/axis/transport
Create_ds/axis-axis1-java/axis-rt-transport-mail/src/main/java/org/apache/axis/transport/mail/MailWorker.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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.axis.transport.mail; import org.apache.axis.AxisFault; import org.apache.axis.Constants; import org.apache.axis.Message; import org.apache.axis.MessageContext; import org.apache.axis.components.logger.LogFactory; import org.apache.axis.message.SOAPEnvelope; import org.apache.axis.message.SOAPFault; import org.apache.axis.server.AxisServer; import org.apache.axis.transport.http.HTTPConstants; import org.apache.axis.utils.Messages; import org.apache.commons.logging.Log; import org.apache.commons.net.smtp.SMTPClient; import org.apache.commons.net.smtp.SMTPReply; import javax.mail.Session; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimePart; import java.io.ByteArrayOutputStream; import java.io.Writer; import java.util.Properties; public class MailWorker implements Runnable { protected static Log log = LogFactory.getLog(MailWorker.class.getName()); // Server private MailServer server; // Current message private MimeMessage mimeMessage; // Axis specific constants private static String transportName = "Mail"; private Properties prop = new Properties(); private Session session = Session.getDefaultInstance(prop, null); /** * Constructor for MailWorker * @param server * @param mimeMessage */ public MailWorker(MailServer server, MimeMessage mimeMessage) { this.server = server; this.mimeMessage = mimeMessage; } /** * The main workhorse method. */ public void run() { // create an Axis server AxisServer engine = MailServer.getAxisServer(); // create and initialize a message context MessageContext msgContext = new MessageContext(engine); Message requestMsg; // buffers for the headers we care about StringBuffer soapAction = new StringBuffer(); StringBuffer fileName = new StringBuffer(); StringBuffer contentType = new StringBuffer(); StringBuffer contentLocation = new StringBuffer(); Message responseMsg = null; // prepare request (do as much as possible while waiting for the // next connection). try { msgContext.setTargetService(null); } catch (AxisFault fault) { } msgContext.setResponseMessage(null); msgContext.reset(); msgContext.setTransportName(transportName); responseMsg = null; try { try { // parse all headers into hashtable parseHeaders(mimeMessage, contentType, contentLocation, soapAction); // Real and relative paths are the same for the // MailServer msgContext.setProperty(Constants.MC_REALPATH, fileName.toString()); msgContext.setProperty(Constants.MC_RELATIVE_PATH, fileName.toString()); msgContext.setProperty(Constants.MC_JWS_CLASSDIR, "jwsClasses"); // this may be "" if either SOAPAction: "" or if no SOAPAction at all. // for now, do not complain if no SOAPAction at all String soapActionString = soapAction.toString(); if (soapActionString != null) { msgContext.setUseSOAPAction(true); msgContext.setSOAPActionURI(soapActionString); } requestMsg = new Message(mimeMessage.getInputStream(), false, contentType.toString(), contentLocation.toString()); msgContext.setRequestMessage(requestMsg); // invoke the Axis engine engine.invoke(msgContext); // Retrieve the response from Axis responseMsg = msgContext.getResponseMessage(); if (responseMsg == null) { throw new AxisFault(Messages.getMessage("nullResponse00")); } } catch (Exception e) { e.printStackTrace(); AxisFault af; if (e instanceof AxisFault) { af = (AxisFault) e; log.debug(Messages.getMessage("serverFault00"), af); } else { af = AxisFault.makeFault(e); } // There may be headers we want to preserve in the // response message - so if it's there, just add the // FaultElement to it. Otherwise, make a new one. responseMsg = msgContext.getResponseMessage(); if (responseMsg == null) { responseMsg = new Message(af); } else { try { SOAPEnvelope env = responseMsg.getSOAPEnvelope(); env.clearBody(); env.addBodyElement(new SOAPFault((AxisFault) e)); } catch (AxisFault fault) { // Should never reach here! } } } String replyTo = ((InternetAddress) mimeMessage.getReplyTo()[0]).getAddress(); String sendFrom = ((InternetAddress) mimeMessage.getAllRecipients()[0]).getAddress(); String subject = "Re: " + mimeMessage.getSubject(); writeUsingSMTP(msgContext, server.getHost(), sendFrom, replyTo, subject, responseMsg); } catch (Exception e) { e.printStackTrace(); log.debug(Messages.getMessage("exception00"), e); } if (msgContext.getProperty(MessageContext.QUIT_REQUESTED) != null) { // why then, quit! try { server.stop(); } catch (Exception e) { } } } /** * Send the soap request message to the server * * @param msgContext * @param smtpHost * @param sendFrom * @param replyTo * @param output * @throws Exception */ private void writeUsingSMTP(MessageContext msgContext, String smtpHost, String sendFrom, String replyTo, String subject, Message output) throws Exception { SMTPClient client = new SMTPClient(); client.connect(smtpHost); // After connection attempt, you should check the reply code to verify // success. System.out.print(client.getReplyString()); int reply = client.getReplyCode(); if (!SMTPReply.isPositiveCompletion(reply)) { client.disconnect(); AxisFault fault = new AxisFault("SMTP", "( SMTP server refused connection )", null, null); throw fault; } client.login(smtpHost); System.out.print(client.getReplyString()); reply = client.getReplyCode(); if (!SMTPReply.isPositiveCompletion(reply)) { client.disconnect(); AxisFault fault = new AxisFault("SMTP", "( SMTP server refused connection )", null, null); throw fault; } MimeMessage msg = new MimeMessage(session); msg.setFrom(new InternetAddress(sendFrom)); msg.addRecipient(MimeMessage.RecipientType.TO, new InternetAddress(replyTo)); msg.setDisposition(MimePart.INLINE); msg.setSubject(subject); ByteArrayOutputStream out = new ByteArrayOutputStream(8 * 1024); output.writeTo(out); msg.setContent(out.toString(), output.getContentType(msgContext.getSOAPConstants())); ByteArrayOutputStream out2 = new ByteArrayOutputStream(8 * 1024); msg.writeTo(out2); client.setSender(sendFrom); System.out.print(client.getReplyString()); client.addRecipient(replyTo); System.out.print(client.getReplyString()); Writer writer = client.sendMessageData(); System.out.print(client.getReplyString()); writer.write(out2.toString()); writer.flush(); writer.close(); System.out.print(client.getReplyString()); if (!client.completePendingCommand()) { System.out.print(client.getReplyString()); AxisFault fault = new AxisFault("SMTP", "( Failed to send email )", null, null); throw fault; } System.out.print(client.getReplyString()); client.logout(); client.disconnect(); } /** * Read all mime headers, returning the value of Content-Length and * SOAPAction. * @param mimeMessage InputStream to read from * @param contentType The content type. * @param contentLocation The content location * @param soapAction StringBuffer to return the soapAction into */ private void parseHeaders(MimeMessage mimeMessage, StringBuffer contentType, StringBuffer contentLocation, StringBuffer soapAction) throws Exception { contentType.append(mimeMessage.getContentType()); contentLocation.append(mimeMessage.getContentID()); String values[] = mimeMessage.getHeader(HTTPConstants.HEADER_SOAP_ACTION); if (values != null) soapAction.append(values[0]); } }
6,781
0
Create_ds/axis-axis1-java/axis-rt-transport-mail/src/main/java/org/apache/axis/transport
Create_ds/axis-axis1-java/axis-rt-transport-mail/src/main/java/org/apache/axis/transport/mail/MailSender.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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.axis.transport.mail; import org.apache.axis.AxisFault; import org.apache.axis.Message; import org.apache.axis.MessageContext; import org.apache.axis.components.logger.LogFactory; import org.apache.axis.components.uuid.UUIDGen; import org.apache.axis.components.uuid.UUIDGenFactory; import org.apache.axis.handlers.BasicHandler; import org.apache.axis.transport.http.HTTPConstants; import org.apache.axis.utils.Messages; import org.apache.commons.logging.Log; import org.apache.commons.net.pop3.POP3Client; import org.apache.commons.net.pop3.POP3MessageInfo; import org.apache.commons.net.smtp.SMTPClient; import org.apache.commons.net.smtp.SMTPReply; import javax.mail.Session; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimePart; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.Reader; import java.io.Writer; import java.util.Properties; /** * This is meant to be used on a SOAP Client to call a SOAP server via SMTP/POP3 * * @author Davanum Srinivas (dims@yahoo.com) */ public class MailSender extends BasicHandler { protected static Log log = LogFactory.getLog(MailSender.class.getName()); private UUIDGen uuidGen = UUIDGenFactory.getUUIDGen(); Properties prop = new Properties(); Session session = Session.getDefaultInstance(prop, null); /** * invoke creates a socket connection, sends the request SOAP message and then * reads the response SOAP message back from the SOAP server * * @param msgContext the messsage context * * @throws AxisFault */ public void invoke(MessageContext msgContext) throws AxisFault { if (log.isDebugEnabled()) { log.debug(Messages.getMessage("enter00", "MailSender::invoke")); } try { // Send the SOAP request to the SMTP server String id = writeUsingSMTP(msgContext); // Read SOAP response from the POP3 Server readUsingPOP3(id, msgContext); } catch (Exception e) { log.debug(e); throw AxisFault.makeFault(e); } if (log.isDebugEnabled()) { log.debug(Messages.getMessage("exit00", "HTTPDispatchHandler::invoke")); } } /** * Send the soap request message to the server * * @param msgContext message context * * @return id for the current message * @throws Exception */ private String writeUsingSMTP(MessageContext msgContext) throws Exception { String id = (new java.rmi.server.UID()).toString(); String smtpHost = msgContext.getStrProp(MailConstants.SMTP_HOST); SMTPClient client = new SMTPClient(); client.connect(smtpHost); // After connection attempt, you should check the reply code to verify // success. System.out.print(client.getReplyString()); int reply = client.getReplyCode(); if (!SMTPReply.isPositiveCompletion(reply)) { client.disconnect(); AxisFault fault = new AxisFault("SMTP", "( SMTP server refused connection )", null, null); throw fault; } client.login(smtpHost); System.out.print(client.getReplyString()); reply = client.getReplyCode(); if (!SMTPReply.isPositiveCompletion(reply)) { client.disconnect(); AxisFault fault = new AxisFault("SMTP", "( SMTP server refused connection )", null, null); throw fault; } String fromAddress = msgContext.getStrProp(MailConstants.FROM_ADDRESS); String toAddress = msgContext.getStrProp(MailConstants.TO_ADDRESS); MimeMessage msg = new MimeMessage(session); msg.setFrom(new InternetAddress(fromAddress)); msg.addRecipient(MimeMessage.RecipientType.TO, new InternetAddress(toAddress)); // Get SOAPAction, default to "" String action = msgContext.useSOAPAction() ? msgContext.getSOAPActionURI() : ""; if (action == null) { action = ""; } Message reqMessage = msgContext.getRequestMessage(); msg.addHeader(HTTPConstants.HEADER_USER_AGENT, Messages.getMessage("axisUserAgent")); msg.addHeader(HTTPConstants.HEADER_SOAP_ACTION, action); msg.setDisposition(MimePart.INLINE); msg.setSubject(id); ByteArrayOutputStream out = new ByteArrayOutputStream(8 * 1024); reqMessage.writeTo(out); msg.setContent(out.toString(), reqMessage.getContentType(msgContext.getSOAPConstants())); ByteArrayOutputStream out2 = new ByteArrayOutputStream(8 * 1024); msg.writeTo(out2); client.setSender(fromAddress); System.out.print(client.getReplyString()); client.addRecipient(toAddress); System.out.print(client.getReplyString()); Writer writer = client.sendMessageData(); System.out.print(client.getReplyString()); writer.write(out2.toString()); writer.flush(); writer.close(); System.out.print(client.getReplyString()); if (!client.completePendingCommand()) { System.out.print(client.getReplyString()); AxisFault fault = new AxisFault("SMTP", "( Failed to send email )", null, null); throw fault; } System.out.print(client.getReplyString()); client.logout(); client.disconnect(); return id; } /** * Read from server using POP3 * @param msgContext * @throws Exception */ private void readUsingPOP3(String id, MessageContext msgContext) throws Exception { // Read the response back from the server String pop3Host = msgContext.getStrProp(MailConstants.POP3_HOST); String pop3User = msgContext.getStrProp(MailConstants.POP3_USERID); String pop3passwd = msgContext.getStrProp(MailConstants.POP3_PASSWORD); Reader reader; POP3MessageInfo[] messages = null; MimeMessage mimeMsg = null; POP3Client pop3 = new POP3Client(); // We want to timeout if a response takes longer than 60 seconds pop3.setDefaultTimeout(60000); for (int i = 0; i < 12; i++) { pop3.connect(pop3Host); if (!pop3.login(pop3User, pop3passwd)) { pop3.disconnect(); AxisFault fault = new AxisFault("POP3", "( Could not login to server. Check password. )", null, null); throw fault; } messages = pop3.listMessages(); if (messages != null && messages.length > 0) { StringBuffer buffer = null; for (int j = 0; j < messages.length; j++) { reader = pop3.retrieveMessage(messages[j].number); if (reader == null) { AxisFault fault = new AxisFault("POP3", "( Could not retrieve message header. )", null, null); throw fault; } buffer = new StringBuffer(); BufferedReader bufferedReader = new BufferedReader(reader); int ch; while ((ch = bufferedReader.read()) != -1) { buffer.append((char) ch); } bufferedReader.close(); if (buffer.toString().indexOf(id) != -1) { ByteArrayInputStream bais = new ByteArrayInputStream(buffer.toString().getBytes()); Properties prop = new Properties(); Session session = Session.getDefaultInstance(prop, null); mimeMsg = new MimeMessage(session, bais); pop3.deleteMessage(messages[j].number); break; } buffer = null; } } pop3.logout(); pop3.disconnect(); if (mimeMsg == null) { Thread.sleep(5000); } else { break; } } if (mimeMsg == null) { pop3.logout(); pop3.disconnect(); AxisFault fault = new AxisFault("POP3", "( Could not retrieve message list. )", null, null); throw fault; } String contentType = mimeMsg.getContentType(); String contentLocation = mimeMsg.getContentID(); Message outMsg = new Message(mimeMsg.getInputStream(), false, contentType, contentLocation); outMsg.setMessageType(Message.RESPONSE); msgContext.setResponseMessage(outMsg); if (log.isDebugEnabled()) { log.debug("\n" + Messages.getMessage("xmlRecd00")); log.debug("-----------------------------------------------"); log.debug(outMsg.getSOAPPartAsString()); } } }
6,782
0
Create_ds/axis-axis1-java/axis-rt-transport-mail/src/main/java/org/apache/axis/transport
Create_ds/axis-axis1-java/axis-rt-transport-mail/src/main/java/org/apache/axis/transport/mail/Handler.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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.axis.transport.mail; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; /** * A stub URLStreamHandler, so the system will recognize our * custom URLs as valid. * * @author Davanum Srinivas &lt;dims@yahoo.com&gt; */ public class Handler extends URLStreamHandler { protected URLConnection openConnection(URL u) { return null; } }
6,783
0
Create_ds/axis-axis1-java/axis-rt-transport-mail/src/main/java/org/apache/axis/transport
Create_ds/axis-axis1-java/axis-rt-transport-mail/src/main/java/org/apache/axis/transport/mail/MailServer.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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.axis.transport.mail; import org.apache.axis.components.logger.LogFactory; import org.apache.axis.i18n.Messages; import org.apache.axis.server.AxisServer; import org.apache.axis.utils.Options; import org.apache.commons.logging.Log; import org.apache.commons.net.pop3.POP3Client; import org.apache.commons.net.pop3.POP3MessageInfo; import javax.mail.Session; import javax.mail.internet.MimeMessage; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.Reader; import java.net.MalformedURLException; import java.util.Properties; /** * This is a simple implementation of an SMTP/POP3 server for processing * SOAP requests via Apache's xml-axis. This is not intended for production * use. Its intended uses are for demos, debugging, and performance * profiling. * * @author Davanum Srinivas &lt;dims@yahoo.com&gt; * @author Rob Jellinghaus (robj@unrealities.com) */ public class MailServer implements Runnable { protected static Log log = LogFactory.getLog(MailServer.class.getName()); private String host; private int port; private String userid; private String password; public MailServer(String host, int port, String userid, String password) { this.host = host; this.port = port; this.userid = userid; this.password = password; } // Are we doing threads? private static boolean doThreads = true; public void setDoThreads(boolean value) { doThreads = value; } public boolean getDoThreads() { return doThreads; } public String getHost() { return host; } // Axis server (shared between instances) private static AxisServer myAxisServer = null; protected static synchronized AxisServer getAxisServer() { if (myAxisServer == null) { myAxisServer = new AxisServer(); } return myAxisServer; } // are we stopped? // latch to true if stop() is called private boolean stopped = false; /** * Accept requests from a given TCP port and send them through the * Axis engine for processing. */ public void run() { log.info(Messages.getMessage("start00", "MailServer", host + ":" + port)); // Accept and process requests from the socket while (!stopped) { try { pop3.connect(host, port); pop3.login(userid, password); POP3MessageInfo[] messages = pop3.listMessages(); if (messages != null && messages.length > 0) { for (int i = 0; i < messages.length; i++) { Reader reader = pop3.retrieveMessage(messages[i].number); if (reader == null) { continue; } StringBuffer buffer = new StringBuffer(); BufferedReader bufferedReader = new BufferedReader(reader); int ch; while ((ch = bufferedReader.read()) != -1) { buffer.append((char) ch); } bufferedReader.close(); ByteArrayInputStream bais = new ByteArrayInputStream(buffer.toString().getBytes()); Properties prop = new Properties(); Session session = Session.getDefaultInstance(prop, null); MimeMessage mimeMsg = new MimeMessage(session, bais); pop3.deleteMessage(messages[i].number); if (mimeMsg != null) { MailWorker worker = new MailWorker(this, mimeMsg); if (doThreads) { Thread thread = new Thread(worker); thread.setDaemon(true); thread.start(); } else { worker.run(); } } } } } catch (java.io.InterruptedIOException iie) { } catch (Exception e) { log.debug(Messages.getMessage("exception00"), e); break; } finally { try { pop3.logout(); pop3.disconnect(); Thread.sleep(3000); } catch (Exception e) { log.error(Messages.getMessage("exception00"), e); } } } log.info(Messages.getMessage("quit00", "MailServer")); } /** * POP3 connection */ private POP3Client pop3; /** * Obtain the serverSocket that that MailServer is listening on. */ public POP3Client getPOP3() { return pop3; } /** * Set the serverSocket this server should listen on. * (note : changing this will not affect a running server, but if you * stop() and then start() the server, the new socket will be used). */ public void setPOP3(POP3Client pop3) { this.pop3 = pop3; } /** * Start this server. * * Spawns a worker thread to listen for HTTP requests. * * @param daemon a boolean indicating if the thread should be a daemon. */ public void start(boolean daemon) throws Exception { if (doThreads) { Thread thread = new Thread(this); thread.setDaemon(daemon); thread.start(); } else { run(); } } /** * Start this server as a NON-daemon. */ public void start() throws Exception { start(false); } /** * Stop this server. * * This will interrupt any pending accept(). */ public void stop() throws Exception { /* * Close the server socket cleanly, but avoid fresh accepts while * the socket is closing. */ stopped = true; log.info(Messages.getMessage("quit00", "MailServer")); // Kill the JVM, which will interrupt pending accepts even on linux. System.exit(0); } /** * Server process. */ public static void main(String args[]) { Options opts = null; try { opts = new Options(args); } catch (MalformedURLException e) { log.error(Messages.getMessage("malformedURLException00"), e); return; } try { doThreads = (opts.isFlagSet('t') > 0); String host = opts.getHost(); int port = ((opts.isFlagSet('p') > 0) ? opts.getPort() : 110); POP3Client pop3 = new POP3Client(); MailServer sas = new MailServer(host, port, opts.getUser(), opts.getPassword()); sas.setPOP3(pop3); sas.start(); } catch (Exception e) { log.error(Messages.getMessage("exception00"), e); return; } } }
6,784
0
Create_ds/axis-axis1-java/axis-rt-transport-mail/src/main/java/org/apache/axis/transport
Create_ds/axis-axis1-java/axis-rt-transport-mail/src/main/java/org/apache/axis/transport/mail/MailTransport.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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.axis.transport.mail; import org.apache.axis.AxisEngine; import org.apache.axis.MessageContext; import org.apache.axis.client.Call; import org.apache.axis.client.Transport; /** * A Transport which will cause an invocation via "mail" * * @author Davanum Srinivas &lt;dims@yahoo.com&gt; */ public class MailTransport extends Transport { public MailTransport() { transportName = "mail"; } /** * Set up any transport-specific derived properties in the message context. * @param mc the context to set up * @param call the Call object * @param engine the engine containing the registries */ public void setupMessageContextImpl(MessageContext mc, Call call, AxisEngine engine) { } }
6,785
0
Create_ds/axis-axis1-java/axis-rt-transport-mail/src/main/java/org/apache/axis/transport
Create_ds/axis-axis1-java/axis-rt-transport-mail/src/main/java/org/apache/axis/transport/mail/MailConstants.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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.axis.transport.mail; public class MailConstants { public final static String FROM_ADDRESS = "transport.mail.from"; public final static String TO_ADDRESS = "transport.mail.to"; public final static String SMTP_HOST = "transport.mail.smtp.host"; public final static String POP3_HOST = "transport.mail.pop3.host"; public final static String POP3_USERID = "transport.mail.pop3.userid"; public final static String POP3_PASSWORD = "transport.mail.pop3.password"; }
6,786
0
Create_ds/axis-axis1-java/distribution/src/main/files/samples
Create_ds/axis-axis1-java/distribution/src/main/files/samples/security/ClientSigningHandler.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 samples.security; import org.apache.axis.AxisFault; import org.apache.axis.Handler; import org.apache.axis.Message; import org.apache.axis.MessageContext; import org.apache.axis.components.logger.LogFactory; import org.apache.axis.handlers.BasicHandler; import org.apache.axis.message.SOAPEnvelope; import org.apache.commons.logging.Log; public class ClientSigningHandler extends BasicHandler { static Log log = LogFactory.getLog(ClientSigningHandler.class.getName()); static { org.apache.xml.security.Init.init(); } public void invoke(MessageContext msgContext) throws AxisFault { /** Sign the SOAPEnvelope */ try { Handler serviceHandler = msgContext.getService(); String filename = (String) getOption("keystore"); if ((filename == null) || (filename.equals(""))) throw new AxisFault("Server.NoKeyStoreFile", "No KeyStore file configured for the ClientSigningHandler!", null, null); Message requestMessage = msgContext.getRequestMessage(); SOAPEnvelope unsignedEnvelope = requestMessage.getSOAPEnvelope(); // need to correctly compute baseuri SignedSOAPEnvelope signedEnvelope = new SignedSOAPEnvelope(msgContext, unsignedEnvelope, "http://xml-security", filename); requestMessage = new Message(signedEnvelope); msgContext.setCurrentMessage(requestMessage); // and then pass on to next handler //requestMessage.getSOAPPart().writeTo(System.out); } catch (Exception e) { throw AxisFault.makeFault(e); } } public void onFault(MessageContext msgContext) { try { // probably needs to fault. } catch (Exception e) { log.error(e); } } }
6,787
0
Create_ds/axis-axis1-java/distribution/src/main/files/samples
Create_ds/axis-axis1-java/distribution/src/main/files/samples/security/Client.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 samples.security; import org.apache.axis.MessageContext; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.axis.message.SOAPBodyElement; import org.apache.axis.message.SOAPEnvelope; import org.apache.axis.utils.Options; import org.apache.axis.utils.XMLUtils; public class Client { public static void main(String[] args) throws Exception { try { Options opts = new Options(args); Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new java.net.URL(opts.getURL())); SOAPEnvelope env = new SOAPEnvelope(); SOAPBodyElement sbe = new SOAPBodyElement(XMLUtils.StringToElement("http://localhost:8080/LogTestService", "testMethod", "")); env.addBodyElement(sbe); env = new SignedSOAPEnvelope(env, "http://xml-security"); System.out.println("\n============= Request =============="); XMLUtils.PrettyElementToStream(env.getAsDOM(), System.out); call.invoke(env); MessageContext mc = call.getMessageContext(); System.out.println("\n============= Response =============="); XMLUtils.PrettyElementToStream(mc.getResponseMessage().getSOAPEnvelope().getAsDOM(), System.out); } catch (Exception e) { e.printStackTrace(); } } }
6,788
0
Create_ds/axis-axis1-java/distribution/src/main/files/samples
Create_ds/axis-axis1-java/distribution/src/main/files/samples/security/LogHandler.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 samples.security; import org.apache.axis.AxisFault; import org.apache.axis.Handler; import org.apache.axis.Message; import org.apache.axis.MessageContext; import org.apache.axis.components.logger.LogFactory; import org.apache.axis.handlers.BasicHandler; import org.apache.axis.utils.Messages; import org.apache.commons.logging.Log; import org.apache.xml.security.signature.XMLSignature; import org.apache.xml.security.utils.Constants; import org.apache.xpath.CachedXPathAPI; import org.w3c.dom.Document; import org.w3c.dom.Element; import java.io.FileWriter; import java.io.PrintWriter; public class LogHandler extends BasicHandler { static Log log = LogFactory.getLog(LogHandler.class.getName()); static { org.apache.xml.security.Init.init(); } public void invoke(MessageContext msgContext) throws AxisFault { try { System.out.println("Starting Server verification"); Message inMsg = msgContext.getRequestMessage(); Message outMsg = msgContext.getResponseMessage(); // verify signed message Document doc = inMsg.getSOAPEnvelope().getAsDocument(); String BaseURI = "http://xml-security"; CachedXPathAPI xpathAPI = new CachedXPathAPI(); Element nsctx = doc.createElement("nsctx"); nsctx.setAttribute("xmlns:ds", Constants.SignatureSpecNS); Element signatureElem = (Element) xpathAPI.selectSingleNode(doc, "//ds:Signature", nsctx); // check to make sure that the document claims to have been signed if (signatureElem == null) { System.out.println("The document is not signed"); return; } XMLSignature sig = new XMLSignature(signatureElem, BaseURI); boolean verify = sig.checkSignatureValue(sig.getKeyInfo().getPublicKey()); System.out.println("Server verification complete."); System.out.println("The signature is" + (verify ? " " : " not ") + "valid"); } catch (Exception e) { throw AxisFault.makeFault(e); } } public void onFault(MessageContext msgContext) { try { Handler serviceHandler = msgContext.getService(); String filename = (String) getOption("filename"); if ((filename == null) || (filename.equals(""))) throw new AxisFault("Server.NoLogFile", "No log file configured for the LogHandler!", null, null); FileWriter fw = new FileWriter(filename, true); PrintWriter pw = new PrintWriter(fw); pw.println("====================="); pw.println("= " + Messages.getMessage("fault00")); pw.println("====================="); pw.close(); } catch (Exception e) { log.error(e); } } }
6,789
0
Create_ds/axis-axis1-java/distribution/src/main/files/samples
Create_ds/axis-axis1-java/distribution/src/main/files/samples/security/Service.java
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed 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 samples.security; public class Service { public String testMethod() { return "Hi, you've reached the testMethod."; } }
6,790
0
Create_ds/axis-axis1-java/distribution/src/main/files/samples
Create_ds/axis-axis1-java/distribution/src/main/files/samples/security/SignedSOAPEnvelope.java
/* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package samples.security; import org.apache.axis.Constants; import org.apache.axis.Message; import org.apache.axis.MessageContext; import org.apache.axis.client.AxisClient; import org.apache.axis.configuration.NullProvider; import org.apache.axis.encoding.SerializationContext; import org.apache.axis.encoding.SerializationContext; import org.apache.axis.encoding.DeserializationContext; import org.apache.axis.message.SOAPEnvelope; import org.apache.axis.message.SOAPHeaderElement; import org.apache.axis.utils.Mapping; import org.apache.axis.utils.Messages; import org.apache.axis.utils.XMLUtils; import org.apache.xml.security.c14n.Canonicalizer; import org.apache.xml.security.signature.XMLSignature; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.InputSource; import java.io.FileInputStream; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.security.KeyStore; import java.security.PrivateKey; import java.security.cert.X509Certificate; public class SignedSOAPEnvelope extends SOAPEnvelope { static String SOAPSECNS = "http://schemas.xmlsoap.org/soap/security/2000-12"; static String SOAPSECprefix = "SOAP-SEC"; static String keystoreType = "JKS"; static String keystoreFile = "keystore.jks"; static String keystorePass = "xmlsecurity"; static String privateKeyAlias = "test"; static String privateKeyPass = "xmlsecurity"; static String certificateAlias = "test"; private MessageContext msgContext; static { org.apache.xml.security.Init.init(); } public SignedSOAPEnvelope(MessageContext msgContext, SOAPEnvelope env, String baseURI, String keystoreFile) { this.msgContext = msgContext; init(env, baseURI, keystoreFile); } public SignedSOAPEnvelope(SOAPEnvelope env, String baseURI) { init(env, baseURI, keystoreFile); } private void init(SOAPEnvelope env, String baseURI, String keystoreFile) { try { System.out.println("Beginning Client signing..."); env.addMapping(new Mapping(SOAPSECNS, SOAPSECprefix)); env.addAttribute(Constants.URI_SOAP11_ENV, "actor", "some-uri"); env.addAttribute(Constants.URI_SOAP11_ENV, "mustUnderstand", "1"); SOAPHeaderElement header = new SOAPHeaderElement(XMLUtils.StringToElement(SOAPSECNS, "Signature", "")); env.addHeader(header); Document doc = getSOAPEnvelopeAsDocument(env, msgContext); KeyStore ks = KeyStore.getInstance(keystoreType); FileInputStream fis = new FileInputStream(keystoreFile); ks.load(fis, keystorePass.toCharArray()); PrivateKey privateKey = (PrivateKey) ks.getKey(privateKeyAlias, privateKeyPass.toCharArray()); Element soapHeaderElement = (Element) ((Element) doc.getFirstChild()).getElementsByTagNameNS("*", "Header").item(0); Element soapSignatureElement = (Element) soapHeaderElement.getElementsByTagNameNS("*", "Signature").item(0); //Id attribute creation Element body = (Element)doc.getElementsByTagNameNS("http://schemas.xmlsoap.org/soap/envelope/", "Body").item(0); body.setAttribute("Id", "Body"); XMLSignature sig = new XMLSignature(doc, baseURI, XMLSignature.ALGO_ID_SIGNATURE_DSA); soapSignatureElement.appendChild(sig.getElement()); sig.addDocument("#Body"); X509Certificate cert = (X509Certificate) ks.getCertificate(certificateAlias); sig.addKeyInfo(cert); sig.addKeyInfo(cert.getPublicKey()); sig.sign(privateKey); Canonicalizer c14n = Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS); byte[] canonicalMessage = c14n.canonicalizeSubtree(doc); InputSource is = new InputSource(new java.io.ByteArrayInputStream(canonicalMessage)); DeserializationContext dser = null; if (msgContext == null) { AxisClient tmpEngine = new AxisClient(new NullProvider()); msgContext = new MessageContext(tmpEngine); } dser = new DeserializationContext(is, msgContext, Message.REQUEST, this); dser.parse(); System.out.println("Client signing complete."); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e.toString()); } } private Document getSOAPEnvelopeAsDocument(SOAPEnvelope env, MessageContext msgContext) throws Exception { StringWriter writer = new StringWriter(); SerializationContext serializeContext = new SerializationContext(writer, msgContext); env.output(serializeContext); writer.close(); Reader reader = new StringReader(writer.getBuffer().toString()); Document doc = XMLUtils.newDocument(new InputSource(reader)); if (doc == null) throw new Exception( Messages.getMessage("noDoc00", writer.getBuffer().toString())); return doc; } }
6,791
0
Create_ds/axis-axis1-java/distribution/src/main/files/samples
Create_ds/axis-axis1-java/distribution/src/main/files/samples/xbeans/StarWarsBindingImpl.java
/** * StarWarsBindingImpl.java * * This file was auto-generated from WSDL * by the Apache Axis 1.3 Oct 16, 2005 (11:41:21 EDT) WSDL2Java emitter. */ package samples.xbeans; public class StarWarsBindingImpl implements samples.xbeans.StarWarsPortType{ com.superflaco.xbeans.Character stashed; public com.superflaco.xbeans.Character getChewbecca() throws java.rmi.RemoteException { com.superflaco.xbeans.Character chewie = com.superflaco.xbeans.Character.Factory.newInstance(); chewie.setName("Chewbacca"); com.superflaco.xbeans.System sys = com.superflaco.xbeans.System.Factory.newInstance(); sys.setName("WookieSector"); chewie.setHome(sys); chewie.setFaction("smuggler"); chewie.setEvil(false); chewie.setJedi(false); return chewie; } public com.superflaco.xbeans.Character stashChar(com.superflaco.xbeans.Character newChew) throws java.rmi.RemoteException { if (stashed == null) { stashed = getChewbecca(); } if (newChew != null) { System.out.println("old: " + stashed.toString()); System.out.println("new: " + newChew.toString()); stashed = newChew; } return stashed; } }
6,792
0
Create_ds/axis-axis1-java/distribution/src/main/files/samples
Create_ds/axis-axis1-java/distribution/src/main/files/samples/xbeans/StarWarsTestCase.java
/** * StarWarsTestCase.java * * This file was auto-generated from WSDL * by the Apache Axis 1.3 Oct 16, 2005 (11:41:21 EDT) WSDL2Java emitter. */ package samples.xbeans; public class StarWarsTestCase extends junit.framework.TestCase { public StarWarsTestCase(java.lang.String name) { super(name); } /** TODO: Fix me public void testStarWarsPortWSDL() throws Exception { javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); java.net.URL url = new java.net.URL(new samples.xbeans.StarWarsLocator().getStarWarsPortAddress() + "?WSDL"); javax.xml.rpc.Service service = serviceFactory.createService(url, new samples.xbeans.StarWarsLocator().getServiceName()); assertTrue(service != null); } **/ public void test1StarWarsPortGetChewbecca() throws Exception { samples.xbeans.StarWarsBindingStub binding; try { binding = (samples.xbeans.StarWarsBindingStub) new samples.xbeans.StarWarsLocator().getStarWarsPort(); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); // Test operation com.superflaco.xbeans.Character value = null; value = binding.getChewbecca(); // TBD - validate results assertNotNull(value); System.out.println(value.toString()); } }
6,793
0
Create_ds/axis-axis1-java/distribution/src/main/files/samples/ws-i/scm/source/java/implemented/org/apache/axis/wsi/scm
Create_ds/axis-axis1-java/distribution/src/main/files/samples/ws-i/scm/source/java/implemented/org/apache/axis/wsi/scm/manufacturer/ManufacturerSoapBindingImplC.java
package org.apache.axis.wsi.scm.manufacturer; /** * ManufacturerSoapBindingImpl.java * * This file was auto-generated from WSDL * by the Apache Axis #axisVersion# #today# WSDL2Java emitter. */ public class ManufacturerSoapBindingImplC implements org.apache.axis.wsi.scm.manufacturer.ManufacturerPortType{ public boolean submitPO(org.apache.axis.wsi.scm.manufacturer.po.PurchOrdType purchaseOrder, org.apache.axis.wsi.scm.configuration.ConfigurationType configurationHeader, org.apache.axis.wsi.scm.manufacturer.callback.StartHeaderType startHeader) throws java.rmi.RemoteException, org.apache.axis.wsi.scm.configuration.ConfigurationFaultType, org.apache.axis.wsi.scm.manufacturer.po.SubmitPOFaultType { return false; } }
6,794
0
Create_ds/axis-axis1-java/distribution/src/main/files/samples/ws-i/scm/source/java/implemented/org/apache/axis/wsi/scm
Create_ds/axis-axis1-java/distribution/src/main/files/samples/ws-i/scm/source/java/implemented/org/apache/axis/wsi/scm/manufacturer/ManufacturerServiceTestCase.java
/** * ManufacturerServiceTestCase.java * * This file was auto-generated from WSDL * by the Apache Axis 1.2alpha Jan 15, 2004 (11:28:11 EST) WSDL2Java emitter. */ package org.apache.axis.wsi.scm.manufacturer; public class ManufacturerServiceTestCase extends junit.framework.TestCase { public ManufacturerServiceTestCase(java.lang.String name) { super(name); } /* FIXME: RUNTIME WSDL broken. public void testManufacturerCPortWSDL() throws Exception { javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); java.net.URL url = new java.net.URL(new org.apache.axis.wsi.scm.manufacturer.ManufacturerServiceLocator().getManufacturerCPortAddress() + "?WSDL"); javax.xml.rpc.Service service = serviceFactory.createService(url, new org.apache.axis.wsi.scm.manufacturer.ManufacturerServiceLocator().getServiceName()); assertTrue(service != null); } */ public void test1ManufacturerCPortSubmitPO() throws Exception { org.apache.axis.wsi.scm.manufacturer.ManufacturerSoapBindingStub binding; try { binding = (org.apache.axis.wsi.scm.manufacturer.ManufacturerSoapBindingStub) new org.apache.axis.wsi.scm.manufacturer.ManufacturerServiceLocator().getManufacturerCPort(); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); // Test operation try { boolean value = false; value = binding.submitPO(new org.apache.axis.wsi.scm.manufacturer.po.PurchOrdType(), new org.apache.axis.wsi.scm.configuration.ConfigurationType(), new org.apache.axis.wsi.scm.manufacturer.callback.StartHeaderType()); } catch (org.apache.axis.wsi.scm.configuration.ConfigurationFaultType e1) { throw new junit.framework.AssertionFailedError("ConfigurationFault Exception caught: " + e1); } catch (org.apache.axis.wsi.scm.manufacturer.po.SubmitPOFaultType e2) { throw new junit.framework.AssertionFailedError("POFault Exception caught: " + e2); } // TBD - validate results } /* FIXME: RUNTIME WSDL broken. public void testManufacturerBPortWSDL() throws Exception { javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); java.net.URL url = new java.net.URL(new org.apache.axis.wsi.scm.manufacturer.ManufacturerServiceLocator().getManufacturerBPortAddress() + "?WSDL"); javax.xml.rpc.Service service = serviceFactory.createService(url, new org.apache.axis.wsi.scm.manufacturer.ManufacturerServiceLocator().getServiceName()); assertTrue(service != null); } */ public void test2ManufacturerBPortSubmitPO() throws Exception { org.apache.axis.wsi.scm.manufacturer.ManufacturerSoapBindingStub binding; try { binding = (org.apache.axis.wsi.scm.manufacturer.ManufacturerSoapBindingStub) new org.apache.axis.wsi.scm.manufacturer.ManufacturerServiceLocator().getManufacturerBPort(); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); // Test operation try { boolean value = false; value = binding.submitPO(new org.apache.axis.wsi.scm.manufacturer.po.PurchOrdType(), new org.apache.axis.wsi.scm.configuration.ConfigurationType(), new org.apache.axis.wsi.scm.manufacturer.callback.StartHeaderType()); } catch (org.apache.axis.wsi.scm.configuration.ConfigurationFaultType e1) { throw new junit.framework.AssertionFailedError("ConfigurationFault Exception caught: " + e1); } catch (org.apache.axis.wsi.scm.manufacturer.po.SubmitPOFaultType e2) { throw new junit.framework.AssertionFailedError("POFault Exception caught: " + e2); } // TBD - validate results } /* FIXME: RUNTIME WSDL broken. public void testManufacturerAPortWSDL() throws Exception { javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); java.net.URL url = new java.net.URL(new org.apache.axis.wsi.scm.manufacturer.ManufacturerServiceLocator().getManufacturerAPortAddress() + "?WSDL"); javax.xml.rpc.Service service = serviceFactory.createService(url, new org.apache.axis.wsi.scm.manufacturer.ManufacturerServiceLocator().getServiceName()); assertTrue(service != null); } */ public void test3ManufacturerAPortSubmitPO() throws Exception { org.apache.axis.wsi.scm.manufacturer.ManufacturerSoapBindingStub binding; try { binding = (org.apache.axis.wsi.scm.manufacturer.ManufacturerSoapBindingStub) new org.apache.axis.wsi.scm.manufacturer.ManufacturerServiceLocator().getManufacturerAPort(); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); // Test operation try { boolean value = false; value = binding.submitPO(new org.apache.axis.wsi.scm.manufacturer.po.PurchOrdType(), new org.apache.axis.wsi.scm.configuration.ConfigurationType(), new org.apache.axis.wsi.scm.manufacturer.callback.StartHeaderType()); } catch (org.apache.axis.wsi.scm.configuration.ConfigurationFaultType e1) { throw new junit.framework.AssertionFailedError("ConfigurationFault Exception caught: " + e1); } catch (org.apache.axis.wsi.scm.manufacturer.po.SubmitPOFaultType e2) { throw new junit.framework.AssertionFailedError("POFault Exception caught: " + e2); } // TBD - validate results } /* FIXME: RUNTIME WSDL broken. public void testWarehouseCallbackPortWSDL() throws Exception { javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); java.net.URL url = new java.net.URL(new org.apache.axis.wsi.scm.manufacturer.ManufacturerServiceLocator().getWarehouseCallbackPortAddress() + "?WSDL"); javax.xml.rpc.Service service = serviceFactory.createService(url, new org.apache.axis.wsi.scm.manufacturer.ManufacturerServiceLocator().getServiceName()); assertTrue(service != null); } */ public void test4WarehouseCallbackPortSubmitSN() throws Exception { org.apache.axis.wsi.scm.manufacturer.WarehouseCallbackSoapBindingStub binding; try { binding = (org.apache.axis.wsi.scm.manufacturer.WarehouseCallbackSoapBindingStub) new org.apache.axis.wsi.scm.manufacturer.ManufacturerServiceLocator().getWarehouseCallbackPort(); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); // Test operation try { boolean value = false; value = binding.submitSN(new org.apache.axis.wsi.scm.manufacturer.sn.ShipmentNoticeType(), new org.apache.axis.wsi.scm.configuration.ConfigurationType(), new org.apache.axis.wsi.scm.manufacturer.callback.CallbackHeaderType()); } catch (org.apache.axis.wsi.scm.configuration.ConfigurationFaultType e1) { throw new junit.framework.AssertionFailedError("ConfigurationFault Exception caught: " + e1); } catch (org.apache.axis.wsi.scm.manufacturer.callback.CallbackFaultType e2) { throw new junit.framework.AssertionFailedError("CallbackFault Exception caught: " + e2); } // TBD - validate results } public void test5WarehouseCallbackPortErrorPO() throws Exception { org.apache.axis.wsi.scm.manufacturer.WarehouseCallbackSoapBindingStub binding; try { binding = (org.apache.axis.wsi.scm.manufacturer.WarehouseCallbackSoapBindingStub) new org.apache.axis.wsi.scm.manufacturer.ManufacturerServiceLocator().getWarehouseCallbackPort(); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); // Test operation try { boolean value = false; value = binding.errorPO(new org.apache.axis.wsi.scm.manufacturer.po.SubmitPOFaultType(), new org.apache.axis.wsi.scm.configuration.ConfigurationType(), new org.apache.axis.wsi.scm.manufacturer.callback.CallbackHeaderType()); } catch (org.apache.axis.wsi.scm.configuration.ConfigurationFaultType e1) { throw new junit.framework.AssertionFailedError("ConfigurationFault Exception caught: " + e1); } catch (org.apache.axis.wsi.scm.manufacturer.callback.CallbackFaultType e2) { throw new junit.framework.AssertionFailedError("CallbackFault Exception caught: " + e2); } // TBD - validate results } }
6,795
0
Create_ds/axis-axis1-java/distribution/src/main/files/samples/ws-i/scm/source/java/implemented/org/apache/axis/wsi/scm
Create_ds/axis-axis1-java/distribution/src/main/files/samples/ws-i/scm/source/java/implemented/org/apache/axis/wsi/scm/manufacturer/ManufacturerSoapBindingImplB.java
package org.apache.axis.wsi.scm.manufacturer; /** * ManufacturerSoapBindingImpl.java * * This file was auto-generated from WSDL * by the Apache Axis #axisVersion# #today# WSDL2Java emitter. */ public class ManufacturerSoapBindingImplB implements org.apache.axis.wsi.scm.manufacturer.ManufacturerPortType{ public boolean submitPO(org.apache.axis.wsi.scm.manufacturer.po.PurchOrdType purchaseOrder, org.apache.axis.wsi.scm.configuration.ConfigurationType configurationHeader, org.apache.axis.wsi.scm.manufacturer.callback.StartHeaderType startHeader) throws java.rmi.RemoteException, org.apache.axis.wsi.scm.configuration.ConfigurationFaultType, org.apache.axis.wsi.scm.manufacturer.po.SubmitPOFaultType { return false; } }
6,796
0
Create_ds/axis-axis1-java/distribution/src/main/files/samples/ws-i/scm/source/java/implemented/org/apache/axis/wsi/scm
Create_ds/axis-axis1-java/distribution/src/main/files/samples/ws-i/scm/source/java/implemented/org/apache/axis/wsi/scm/manufacturer/ManufacturerSoapBindingImplA.java
package org.apache.axis.wsi.scm.manufacturer; /** * ManufacturerSoapBindingImpl.java * * This file was auto-generated from WSDL * by the Apache Axis #axisVersion# #today# WSDL2Java emitter. */ public class ManufacturerSoapBindingImplA implements org.apache.axis.wsi.scm.manufacturer.ManufacturerPortType{ public boolean submitPO(org.apache.axis.wsi.scm.manufacturer.po.PurchOrdType purchaseOrder, org.apache.axis.wsi.scm.configuration.ConfigurationType configurationHeader, org.apache.axis.wsi.scm.manufacturer.callback.StartHeaderType startHeader) throws java.rmi.RemoteException, org.apache.axis.wsi.scm.configuration.ConfigurationFaultType, org.apache.axis.wsi.scm.manufacturer.po.SubmitPOFaultType { return false; } }
6,797
0
Create_ds/axis-axis1-java/distribution/src/main/files/samples/ws-i/scm/source/java/implemented/org/apache/axis/wsi/scm
Create_ds/axis-axis1-java/distribution/src/main/files/samples/ws-i/scm/source/java/implemented/org/apache/axis/wsi/scm/configurator/ConfiguratorServiceTestCase.java
/** * ConfiguratorServiceTestCase.java * * This file was auto-generated from WSDL * by the Apache Axis 1.2alpha Jan 15, 2004 (11:28:11 EST) WSDL2Java emitter. */ package org.apache.axis.wsi.scm.configurator; public class ConfiguratorServiceTestCase extends junit.framework.TestCase { public ConfiguratorServiceTestCase(java.lang.String name) { super(name); } /* FIXME: RUNTIME WSDL broken. public void testConfiguratorPortWSDL() throws Exception { javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); java.net.URL url = new java.net.URL(new org.apache.axis.wsi.scm.configurator.ConfiguratorServiceLocator().getConfiguratorPortAddress() + "?WSDL"); javax.xml.rpc.Service service = serviceFactory.createService(url, new org.apache.axis.wsi.scm.configurator.ConfiguratorServiceLocator().getServiceName()); assertTrue(service != null); } */ public void test1ConfiguratorPortGetConfigurationOptions() throws Exception { org.apache.axis.wsi.scm.configurator.ConfiguratorBindingStub binding; try { binding = (org.apache.axis.wsi.scm.configurator.ConfiguratorBindingStub) new org.apache.axis.wsi.scm.configurator.ConfiguratorServiceLocator().getConfiguratorPort(); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); // Test operation try { org.apache.axis.wsi.scm.configurator.ConfigOptionsType value = null; value = binding.getConfigurationOptions(true); } catch (org.apache.axis.wsi.scm.configurator.ConfiguratorFailedFault e1) { throw new junit.framework.AssertionFailedError("configuratorFailedFault Exception caught: " + e1); } // TBD - validate results } }
6,798
0
Create_ds/axis-axis1-java/distribution/src/main/files/samples/ws-i/scm/source/java/implemented/org/apache/axis/wsi/scm
Create_ds/axis-axis1-java/distribution/src/main/files/samples/ws-i/scm/source/java/implemented/org/apache/axis/wsi/scm/configurator/ConfiguratorBindingImpl.java
/** * ConfiguratorBindingImpl.java * * This file was auto-generated from WSDL * by the Apache Axis #axisVersion# #today# WSDL2Java emitter. */ package org.apache.axis.wsi.scm.configurator; public class ConfiguratorBindingImpl implements org.apache.axis.wsi.scm.configurator.ConfiguratorPortType{ public org.apache.axis.wsi.scm.configurator.ConfigOptionsType getConfigurationOptions(boolean refresh) throws java.rmi.RemoteException, org.apache.axis.wsi.scm.configurator.ConfiguratorFailedFault { return null; } }
6,799