[ http://nagoya.apache.org/jira/browse/AXIS-1734?page=comments#action_57120 ] Thurston N commented on AXIS-1734: ----------------------------------
I apologize for the formatting of the previous message, it's my first first post and I thought you had to HTML-encode. I think there is a major mis-understanding about document literal/wrapped literal. WSDL knows nothing about "wrapped." style is one of rpc or document. The wrapped vs. document in this sense is really an Axis (more specifically an Axis-binding question). So given an "XML document" contained within a <soap-env:body>;, how does the Axis server properly invoke a method? Which involves 3 steps: identify the implementation class, identify the appropriate method, and finally package the argument(s) correctly. I think it is correct to say that the major difference between Axis-document vs. Axis-wrapped, is with wrapped, there is a semantical connection between the root-element-name and the method name, e.g. in your case, the root-element-name would be <operation>, because that's the name of your method (declared in interface Endpoint). So in the generated WSDL, you'd see the following: <schema . . .> <element name="operation"> <complexType name="Structure"> <sequence> <element name="integer" type="xsd:int"> <element name="string" type="xsd:string"> . . . In contrast to the WSDL you referenced in an earlier post (where the root-element) is in0. So, although the choice (Axis-document vs. Axis-wrapped) produces different WSDL, it's not a WSDL decision. Does that make sense? I prefer "wrapped", because (at least theoretically), the actual SOAP XML is enough for the Axis engine to call the appropriate method correctly. If you use Axis-document, then there is no way for the actual SOAP XML to indicate which method to invoke (because there is no "operation" element in the XML). In fact, the only way that I can see it working, is the engine can work back from the element name, Structure, to then identify the <wsdl:part>-->then its parent <wsdl:message>, which can be semantically linked to the method name. This strikes me as awkward at best. Anyways, both the Axis-document and Axis-wrapped are WSDL document/literal. And either choice shouldn't affect interoperability on the client end, it's just two different ways to allow the Axis engine to do the method invocation correctly. This is what I've deduced--if this is incorrect, I'd love the Axis guys to correct it, because the UserGuide does not explain this well. > JAVA2WSDL (ant) with document/literal encoding > ---------------------------------------------- > > Key: AXIS-1734 > URL: http://nagoya.apache.org/jira/browse/AXIS-1734 > Project: Axis > Type: Bug > Components: WSDL processing > Versions: 1.2 Beta, 1.2RC2 > Environment: Windows 2K SP4 / Ant 1.6 within Eclipse 3.0.1 > JDK 1.4.2_01-b06 > Reporter: Ephemeris Lappis > Assignee: Davanum Srinivas > Attachments: AXIS-2.zip > > WSDL generation from Java, using document/literal encoding doesn't work when > the code uses custom data types and exceptions. Code for the endpoint > interface, the data type and exception are copied at the end of the message. > From a first simple script, and then adding explicit mapping or complex type > tags, i did'nt find and way to make the generation work for this 'basic' > example : > Case 1 : > -------- > In the ant task, if i just set the service interface classname, java2wsdl > displays out messages, asking for mappings for my exception and data types : > <target name="wsdl"> > <property name="my.namespace" value="http://ws.moon.net/axis2" > /> > <java2wsdl output="axis2.wsdl" > className="my.ws.Endpoint" > namespace="${my.namespace}" > portTypeName="SampleService" > servicePortName="SampleServicePort" > serviceElementName="MyService" > style="DOCUMENT" > use="LITERAL" > location="http://ws.moon.net/axis2"> > <classpath> > <pathelement location="Classes" /> > <path refid="my.axis.classpath" /> > </classpath> > </java2wsdl> > </target> > Console : > [java2wsdl] - Unable to find required classes (javax.activation.DataHandler > and javax.mail.internet.MimeMultipart). Attachment support is disabled. > [java2wsdl] Java2WSDL my.ws.Endpoint > [java2wsdl] - Please register a typemapping/beanmapping for 'my.ws.Structure' > [java2wsdl] - Please register a typemapping/beanmapping for > 'my.ws.ProblemException' > Case 2 : > ------ > If i add an explicit mapping on the package, the result is the same. > <target name="wsdl"> > <property name="my.namespace" value="http://ws.moon.net/axis2" > /> > <java2wsdl output="axis2.wsdl" > className="my.ws.Endpoint" > namespace="${my.namespace}" > portTypeName="SampleService" > servicePortName="SampleServicePort" > serviceElementName="MyService" > style="DOCUMENT" > use="LITERAL" > location="http://ws.moon.net/axis2"> > <classpath> > <pathelement location="Classes" /> > <path refid="my.axis.classpath" /> > </classpath> > <mapping package="my.ws" namespace="${my.namespace}" /> > </java2wsdl> > </target> > Case 3 : > ------ > I add an explicit complex type tag for my data type. Axis task fails on > resolving the data type class. > <target name="wsdl"> > <property name="my.namespace" value="http://ws.moon.net/axis2" > /> > <java2wsdl output="axis2.wsdl" > className="my.ws.Endpoint" > namespace="${my.namespace}" > portTypeName="SampleService" > servicePortName="SampleServicePort" > serviceElementName="MyService" > style="DOCUMENT" > use="LITERAL" > location="http://ws.moon.net/axis2"> > <classpath> > <pathelement location="Classes" /> > <path refid="my.axis.classpath" /> > </classpath> > <mapping package="my.ws" namespace="${my.namespace}" /> > <complextype classname="my.ws.Structure" > namespace="${my.namespace}" /> > </java2wsdl> > </target> > Console : > [java2wsdl] - Unable to find required classes (javax.activation.DataHandler > and javax.mail.internet.MimeMultipart). Attachment support is disabled. > [java2wsdl] Java2WSDL my.ws.Endpoint > [java2wsdl] java.lang.ClassNotFoundException: my.ws.Structure > [java2wsdl] at > org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1149) > [java2wsdl] at > org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1090) > [java2wsdl] at > org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:960) > [java2wsdl] at java.lang.ClassLoader.loadClass(ClassLoader.java:235) > [java2wsdl] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) > [java2wsdl] at java.lang.Class.forName0(Native Method) > [java2wsdl] at java.lang.Class.forName(Class.java:141) > [java2wsdl] at > org.apache.axis.tools.ant.wsdl.ComplexType.register(ComplexType.java:52) > [java2wsdl] at > org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:206) > [java2wsdl] at > org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) > [java2wsdl] at org.apache.tools.ant.Task.perform(Task.java:364) > [java2wsdl] at org.apache.tools.ant.Target.execute(Target.java:341) > [java2wsdl] at org.apache.tools.ant.Target.performTasks(Target.java:369) > [java2wsdl] at org.apache.tools.ant.Project.executeTarget(Project.java:1214) > [java2wsdl] at > org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:379) > [java2wsdl] at > org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135) > BUILD FAILED: > D:\Data\Philippe\Atelier\Java\Eclipse-Workspace\AXIS-2\build.xml:25: Error > while running org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask > --- my/ws/Endpoint.java --- > package my.ws; > import java.rmi.Remote; > import java.rmi.RemoteException; > public interface Endpoint extends Remote { > public String operation(Structure structure) throws ProblemException, > RemoteException; > } > --- my/ws/Structure.java --- > package my.ws; > import java.io.Serializable; > public class Structure implements Serializable { > private String String; > private int integer; > public Structure() { > this(null, 0); > } > public Structure(final String string, final int integer) { > setString(string); > setInteger(integer); > } > public void setString(final String string) { > String = string; > } > public String getString() { > return String; > } > public void setInteger(final int integer) { > this.integer = integer; > } > public int getInteger() { > return integer; > } > } > --- my/ws/ProblemException.java --- > package my.ws; > public class ProblemException extends Exception { > public ProblemException(final String message) { > super(message); > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://nagoya.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira