Actually, we do want to process arbitrary XML documents.  I have been leaning 
towards the <xsd:anyType> type but am still unclear as to WHAT the argument 
type is in the method for the webservice?  I have seen the suggesting of making 
it a java.lang.Object but we would probably be dealing with some class that 
represents our XML document. My second question is, what *is* this XML Document 
java class type is the best to use for passing to this webservices method?

Your message based idea is intriguing as well.  I will probably spike out a 
variety of methods to see which fits best with what we want to do.

Sorry if these are obvious questions, I am new to all of this.

Thanks,

-Marc

-----Original Message-----
From: Anne Thomas Manes [mailto:[EMAIL PROTECTED]
Sent: Friday, April 08, 2005 9:46 AM
To: [email protected]
Subject: Re: Document style web services


Actually, I don't think Marc wants to use <xsd:any> or <xsd:anyType>.
You only want to use <xsd:any> if you want to be able to process
arbitrary XML documents. But from what Marc describes, I think he
plans to exchange XML documents with predefined schemas.

Marc, 

If your goal is security and interoperability, then I suggest you use
the Axis "wrapped" style. It will produce a document/literal message
which contains the method name and the arguments. But it also allows
your Java application to work with Java objects, and Axis
automatically maps the Java to the XML documents for you.

If you look through the archives, you'll see that I recommend a WSDL
First (tm) approach to web services. What that means is that you
should start your application design by defining the XML Schema
definitions of your request and response messages, then import those
schemas into your WSDL document, then generating your client and
server code from the WSDL.

See my blog for a description of the "wrapped" style: 
http://atmanes.blogspot.com/2005/03/wrapped-documentliteral-convention.html 

Here's an example of a wrapped document/literal WSDL file:

<wsdl:definitions name='HelloWorld' 
    targetNamespace='urn:samples/HelloWorld' 
    xmlns:tns='urn:samples/HelloWorld'
    xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
    xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' 
    xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
 
    <wsdl:types>
       <xsd:schema targetNamespace='urn:samples/HelloWorld'
            xmlns:types='urn:samples/HelloWorld/types'>
          <xsd:import namespace="urn:samples/HelloWorld/types'/>
          <xsd:element name='hello'>
             <xsd:complexType>
                <xsd:sequence>          
                   <xsd:element ref='types:In'/>
                </xsd:sequence>
             </xsd:complexType>
          </xsd:element>
          <xsd:element name='helloReturn'>
             <xsd:complexType>
                <xsd:sequence>          
                   <xsd:element ref='types:Out'/>
                </xsd:sequence>
             </xsd:complexType>
          </xsd:element>
       </xsd:schema>
       <xsd:schema targetNamespace='urn:samples/HelloWorld/types'>
          <xsd:element name='In' type='xsd:string'/>  
          <xsd:element name='Out' type='xsd:string'/>
       </xsd:schema> 
    </wsdl:types>
 
    <wsdl:message name='helloRequest'>
        <wsdl:part name='parameters' element='tns:hello'/>
    </wsdl:message>
    <wsdl:message name='helloResponse'>
        <wsdl:part name='parameters' element='tns:helloReturn'/>
    </wsdl:message>
 
    <wsdl:portType name='HelloWorldPT'>
        <wsdl:operation name='hello'>
            <wsdl:input message='tns:helloRequest'/>
            <wsdl:output message='tns:helloResponse'/>
        </wsdl:operation>
    </wsdl:portType>
 
    <wsdl:binding name='HelloWorldSOAPBinding' type='tns:HelloWorldPT'>
        <soap:binding 
            transport='http://schemas.xmlsoap.org/soap/http' 
            style='document'/>
        <wsdl:operation name='hello'>
            <soap:operation  
              soapAction='urn:samples/Helloworld/hello'
              style='document'/>
            <wsdl:input>
                <soap:body use='literal'/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use='literal'/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
 
    <wsdl:service name='HelloWorldService'>
        <wsdl:port name='HelloWorldPort' binding='tns:HelloWorldBinding'>
            <soap:address location='http://your.company.com/HelloWorld/'/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

Now, if in fact you don't want to use the wrapped style, and instead
you want complete control over the processing of your messages, then I
still recommend that you define your WSDL in exactly the same way, but
from a programming perspective, you should use the Axis "message"
style.

Message style services can support any of the following four signatures:

public Element [] method(Element [] bodies);
public SOAPBodyElement [] method (SOAPBodyElement [] bodies);
public Document method(Document body);
public void method(SOAPEnvelope req, SOAPEnvelope resp); 

Regards,
Anne

On Apr 7, 2005 6:21 PM, Soti, Dheeraj <[EMAIL PROTECTED]> wrote:
> Marc,
> 
> See if the following link can help you.
> 
> https://bpcatalog.dev.java.net/nonav/soa/doc-anytype/
> 
> Dheeraj
> 
> -----Original Message-----
> From: Marc Lefebvre [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 07, 2005 1:28 PM
> To: [email protected]
> Subject: Document style web services
> 
> In my current project I am going to be using AXIS with TOMCAT using Java to
> develop some Webservices.  Rather than using the typical RPC methods, like the
> examples in the documentation, we want to pass an XML Document back and forth
> between server and client.  This is for two reasons, security, and
> interoperability with existing XML services.  This XML document would have the
> method calls and args in body.
> 
> So, the questions I have are:
> 
> 1) What is the datatype of the argument and return type that represents the 
> XML
> document in our Request and Response methods that we are going to expose 
> through
> AXIS Web Services?
> 
> 2) When generating the WSDL and WSDD, how do we specify to the utility that we
> are gong to be using this document style rather than the typical RPC style.  I
> somewhat understand the idea of:
> 
> <soap:binding style="document" transport="uri">
> 
> or the use of:
> 
> <soap:operation soapAction="uri" style="document">
> 
> but HOW do we enable this mode in AXIS without tweaking the generated WSDL 
> file,
> specifically when we use the auto generation utility: Java2WSDL and then
> WSDL2Java to generate the web service stubs?
> 
> I appreciate any advice or pointers.
> 
> Regards,
> 
> Marc

Reply via email to