You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Rajal Shah <ra...@cisco.com> on 2003/05/01 20:07:43 UTC

RE: document style web services

Here is the example.. to use doc-style messaging but putting the entire XML
inside a CDATA element and avoid the DOM creation and potential memory
issues for large XMLs. Use it at your own risk!

The client expects 2 arguments, so make sure you pass some dummy data for
them..
--
Rajal


-----Original Message-----
From: Rajal Shah [mailto:rashah@cisco.com]
Sent: Tuesday, April 29, 2003 12:56 PM
To: axis-user@ws.apache.org
Subject: RE: document style web services


Give me a day or so and I will post my example.

Regards.
--
Rajal


-----Original Message-----
From: dumdum 420 [mailto:dumdum420@hotmail.com]
Sent: Tuesday, April 29, 2003 12:29 PM
To: axis-user@ws.apache.org
Subject: RE: document style web services


Hi Rajal,

Thanx a ton. If you have any example u have tried or something which can
help me understand how u are going to do it programtically it will really
help.

Bhanu Pabreja

Since in the examples there is no Document/Literal example . The
MessageService is also of style="message", so I was wondering where do i get
a head start for doing this stuff.

Also from your approach it looks you plan to embed your XML document in a
Element object ... that is what u meant by sending your document as a CDATA
inside an element.

If yu have any sample code it will really help,infact then we can assemble
an example which then can be used by users in axis-community,since lot of
people have similar postings which still are unanswered. Hoping to hear from
you soon.

From: "Rajal Shah" <ra...@cisco.com>
Reply-To: axis-user@ws.apache.org
To: <ax...@ws.apache.org>
Subject: RE: document style web services
Date: Tue, 29 Apr 2003 11:54:43 -0700

I've seen your postings in the past regarding this topic.. Anne had
mentioned using Doc style always even for large XMLs (Anne - thanks for all
your comments.. They do help a lot).. But I'd be cautious cause I've heard
"Out Of Memory" errors in this mailing list too due to the large DOMs that
get created for large XMLs.

Personally, I am still debating on which option to choose from the 2 that I
mentioned.. (Using Attachments or passing the entire XML as CDATA inside one
element.) I could possibly have thousands of records to return to the user
and hence have a huge XML for the server and client to process as DOM..

My current bias is to go for the CDATA technique simply because attachments
may not be supported by all engines and that it might be easier for me to
switch from CDATA hack to actually doing the pure DOC style messaging and
get the DOM elements directly.

Be wary, that I do not have enough experience on this topic yet.. so don't
know all the pitfalls. I am sharing all the info that I've gathered so far.

--
Rajal


-----Original Message-----
From: dumdum 420 [mailto:dumdum420@hotmail.com]
Sent: Tuesday, April 29, 2003 11:23 AM
To: axis-user@ws.apache.org
Subject: RE: document style web services


Hi Rajal'
I have a huge XML file to pass to my client and was planning to implement
Document/Literal type of webservice,but with what you are saying it seems
that attachments are a better choice to send over the wire.

Comments will really help.

BP


From: "Rajal Shah" <ra...@cisco.com>
Reply-To: axis-user@ws.apache.org
To: <ax...@ws.apache.org>
Subject: RE: document style web services
Date: Tue, 29 Apr 2003 10:57:41 -0700

Anamitra

(argument to choose Attachment over Doc-style)

Do realize that during Document Style, Axis returns the entire XML to you in
a DOM structure.. For very large XMLs this could be a huge issue and you
might have to revert to Attachments.. (though not supported as well by all
web services engines).

I've seen an application, where they put their entire XML inside one body
element as CDATA. That way they get the entire XML as a string and then run
it through the SAX parser instead and save on huge memory requirements.. So
this is a viable alternative to Attachments..

I'm learning along with you do regarding these topics.
--
Rajal




-----Original Message-----
From: Mitch Gitman [mailto:mgitman@usa.net]
Sent: Tuesday, April 29, 2003 9:54 AM
To: axis-user@ws.apache.org
Subject: Re: document style web services


Anamitra,
Not that this answer helps you directly.

"What else one can buy with using Doc/literal type service" (as opposed to
RPC/encoded or RPC/literal):
* Arguably a more comprehensible, transparent Web service description. Same
for the SOAP messages. (Of course, ideally with a Web services toolkit, you
might not be poring over the XML at all.)
* The ability to piggyback on the use of XML Schema elsewhere. For instance,
the XSD definitions of objects you're passing via SOAP could just as well be
used in a non-SOAP context. Likewise, document/literal lets you readily
perform XML Schema validation on the contents of the <soap:Body>. Also, if
you're going to be poring over the XML and you already need to know XML
Schema, then SOAP 1.1 Section 5 encoding is just one fewer thing you need to
be well-versed in. (Goes back to "more comprehensible.")
* Greater interoperability with Web service engines that only fully and
reliably support document/literal. (Yes, this is very much a political
matter.
Just stating facts, not necessarily applauding those facts.)

While you may certainly have valid reasons for wanting to deal with DOM/SAX
representations of your objects rather than the objects themselves, it is a
misconception to think that document/literal is necessarily associated with
XML representations.


Anamitra.Bhattacharyya@mro.com wrote:

Hi Davinder
I am going to try out what you suggested - but before that I would ask one
question - this Add and AddResponse which are the parameters [input and
return] of the services "add" method - can you invoke the add method from
the client just by passing XML and not dealing with the Add object? Because
I am not getting what else one can buy with using Doc/literal type service
if they are not able to pass XML and are forced to deal with Objects.
thanks
Anamitra




                        Davinder Singh

                        <dsingh@eGain.com        To:
"'axis-user@ws.apache.org'" <ax...@ws.apache.org>

                        >                        cc:

                                                 Subject:  RE: document
style
web services
                        04/29/2003 01:17

                        AM

                        Please respond to

                        axis-user









Hi Anamitra,
i have set up a doc/lit webservice using axis. i started with a wsdl file
and created the java impl using WSDL2java tool.


WSDL2java command: java org.apache.axis.wsdl.WSDL2Java -W -o . -d
Application -s -S false  -Nurn:CalculateNS packageName filename.wsdl


***************** WSDL **********************
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="
http://www.w3.org/2001/XMLSchema" xmlns:s0="urn:CalculateNS"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="
http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="
http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="urn:CalculateNS"
xmlns="http://schemas.xmlsoap.org/wsdl/">


    <types>
      <s:schema elementFormDefault="qualified"
targetNamespace="urn:CalculateNS">



        <s:element name="Add">
          <s:complexType>
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="arg1"
type="s:int"
/>
              <s:element minOccurs="0" maxOccurs="1" name="arg2"
type="s:int"
/>
            </s:sequence>
          </s:complexType>
        </s:element>


        <s:element name="AddResponse">
          <s:complexType>
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="addResult"
type="s:int" />
            </s:sequence>
          </s:complexType>
        </s:element>

      </s:schema>





    </types>
    <message name="AddSoapIn">
      <part name="parameters" element="s0:Add" />
    </message>
    <message name="AddSoapOut">
      <part name="parameters" element="s0:AddResponse" />
    </message>





    <portType name="CalculateSoap">
      <operation name="Add">
        <input message="s0:AddSoapIn" />
        <output message="s0:AddSoapOut" />
      </operation>
    </portType>


    <portType name="CalculateHttpGet" />


    <portType name="CalculateHttpPost" />


    <binding name="CalculateSoap" type="s0:CalculateSoap">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
      <operation name="Add">
        <soap:operation soapAction="" style="document" />
        <input>
          <soap:body use="literal" />
        </input>
        <output>
          <soap:body use="literal" />
        </output>
      </operation>
    </binding>


    <binding name="CalculateHttpGet" type="s0:CalculateHttpGet">
      <http:binding verb="GET" />
    </binding>


    <binding name="CalculateHttpPost" type="s0:CalculateHttpPost">
      <http:binding verb="POST" />
    </binding>


    <service name="Calculate">
      <port name="CalculateSoap" binding="s0:CalculateSoap">
        <soap:address location="http://axismachine/axis/services/Calculate"
/>
      </port>
      <port name="CalculateHttpGet" binding="s0:CalculateHttpGet">
        <http:address location="http://axismachine/axis/services/Calculate"
/>
      </port>
      <port name="CalculateHttpPost" binding="s0:CalculateHttpPost">
        <http:address location="http://axismachine/axis/services/Calculate"
/>
      </port>
    </service>
</definitions>


********************** WSDL *************************


After u run the command, it will generate Add.java, AddResponse.java
classes among others.
The method exposed is "public packageName.AddResponse add(packageName.Add
parameters){}"
This takes an Object as input param and gives an object as return value. U
will have to modify  Add.java and AddResponse.java as following:


U can see that in the type definition of these ser/deser classes, there is
an extra char (">") Search for '>AddResponse' and '>Add' and remove '>'
symbol. Similary for 'deploy.wsdd'. (I dont know why this character is
inserted , may be some bug in Axis)


Now u can insert ur code in CalculateSoapImpl.java and compile. After
compilation u can deploy the service using deploy command: java
org.apache.axis.client.AdminClient
-lhttp://axismachine/axis/services/AdminService deploy.wsdd


Regarding ur second query, yes it is possible if u use wrapped/literal
option given by axis. u can use it by using following command: java
org.apache.axis.wsdl.WSDL2Java -o . -d Application -s -S false
-Nurn:CalculateNS packageName filename.wsdl


Notice that only -W is removed. This turns off Wrapped feature.


HTH,
davin


-----Original Message-----
From: Anamitra.Bhattacharyya@mro.com
[mailto:Anamitra.Bhattacharyya@mro.com]
Sent: Monday, April 28, 2003 6:09 PM
To: axis-user@xml.apache.org
Subject: document style web services









Hi All
I need some pointers as to how to set up a document style web service using

apache axis. What I am trying to attempt is simple. I have a method like


public void processPo(POBean poBean)
in a class and I do have the schema representation of the POBean. I want
the client program to invoke the web service using XML and does not have to

bother abt the POBean. As per the Axix documentation goes - this is
possible. But ot doesnot explain how to generate the web service. Does
anyone has any sample document style web service? Any sample would be of
great help.


Also is it possible to have the method like


public void processPo(String poXML)


and still in the WSDL generated the user sees the schema for the poxml and
has a schema validation?


thanks
Anamitra













_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail




_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail



RE: document style web services

Posted by Rajal Shah <ra...@cisco.com>.
Axis 1.1Beta. why does it matter?

--
Rajal


-----Original Message-----
From: Nicolas Johnson [mailto:nicolas.johnson@e-markets.com]
Sent: Thursday, May 01, 2003 11:39 AM
To: axis-user@ws.apache.org
Subject: RE: document style web services


What version of Axis are you using for your example?

-----Original Message-----
From: Rajal Shah [mailto:rashah@cisco.com]
Sent: Thursday, May 01, 2003 1:08 PM
To: axis-user@ws.apache.org
Subject: RE: document style web services


Here is the example.. to use doc-style messaging but putting the entire XML
inside a CDATA element and avoid the DOM creation and potential memory
issues for large XMLs. Use it at your own risk!

The client expects 2 arguments, so make sure you pass some dummy data for
them..
--
Rajal


-----Original Message-----
From: Rajal Shah [mailto:rashah@cisco.com]
Sent: Tuesday, April 29, 2003 12:56 PM
To: axis-user@ws.apache.org
Subject: RE: document style web services


Give me a day or so and I will post my example.

Regards.
--
Rajal


-----Original Message-----
From: dumdum 420 [mailto:dumdum420@hotmail.com]
Sent: Tuesday, April 29, 2003 12:29 PM
To: axis-user@ws.apache.org
Subject: RE: document style web services


Hi Rajal,

Thanx a ton. If you have any example u have tried or something which can
help me understand how u are going to do it programtically it will really
help.

Bhanu Pabreja

Since in the examples there is no Document/Literal example . The
MessageService is also of style="message", so I was wondering where do i get
a head start for doing this stuff.

Also from your approach it looks you plan to embed your XML document in a
Element object ... that is what u meant by sending your document as a CDATA
inside an element.

If yu have any sample code it will really help,infact then we can assemble
an example which then can be used by users in axis-community,since lot of
people have similar postings which still are unanswered. Hoping to hear from
you soon.

From: "Rajal Shah" <ra...@cisco.com>
Reply-To: axis-user@ws.apache.org
To: <ax...@ws.apache.org>
Subject: RE: document style web services
Date: Tue, 29 Apr 2003 11:54:43 -0700

I've seen your postings in the past regarding this topic.. Anne had
mentioned using Doc style always even for large XMLs (Anne - thanks for all
your comments.. They do help a lot).. But I'd be cautious cause I've heard
"Out Of Memory" errors in this mailing list too due to the large DOMs that
get created for large XMLs.

Personally, I am still debating on which option to choose from the 2 that I
mentioned.. (Using Attachments or passing the entire XML as CDATA inside one
element.) I could possibly have thousands of records to return to the user
and hence have a huge XML for the server and client to process as DOM..

My current bias is to go for the CDATA technique simply because attachments
may not be supported by all engines and that it might be easier for me to
switch from CDATA hack to actually doing the pure DOC style messaging and
get the DOM elements directly.

Be wary, that I do not have enough experience on this topic yet.. so don't
know all the pitfalls. I am sharing all the info that I've gathered so far.

--
Rajal


-----Original Message-----
From: dumdum 420 [mailto:dumdum420@hotmail.com]
Sent: Tuesday, April 29, 2003 11:23 AM
To: axis-user@ws.apache.org
Subject: RE: document style web services


Hi Rajal'
I have a huge XML file to pass to my client and was planning to implement
Document/Literal type of webservice,but with what you are saying it seems
that attachments are a better choice to send over the wire.

Comments will really help.

BP


From: "Rajal Shah" <ra...@cisco.com>
Reply-To: axis-user@ws.apache.org
To: <ax...@ws.apache.org>
Subject: RE: document style web services
Date: Tue, 29 Apr 2003 10:57:41 -0700

Anamitra

(argument to choose Attachment over Doc-style)

Do realize that during Document Style, Axis returns the entire XML to you in
a DOM structure.. For very large XMLs this could be a huge issue and you
might have to revert to Attachments.. (though not supported as well by all
web services engines).

I've seen an application, where they put their entire XML inside one body
element as CDATA. That way they get the entire XML as a string and then run
it through the SAX parser instead and save on huge memory requirements.. So
this is a viable alternative to Attachments..

I'm learning along with you do regarding these topics.
--
Rajal




-----Original Message-----
From: Mitch Gitman [mailto:mgitman@usa.net]
Sent: Tuesday, April 29, 2003 9:54 AM
To: axis-user@ws.apache.org
Subject: Re: document style web services


Anamitra,
Not that this answer helps you directly.

"What else one can buy with using Doc/literal type service" (as opposed to
RPC/encoded or RPC/literal):
* Arguably a more comprehensible, transparent Web service description. Same
for the SOAP messages. (Of course, ideally with a Web services toolkit, you
might not be poring over the XML at all.)
* The ability to piggyback on the use of XML Schema elsewhere. For instance,
the XSD definitions of objects you're passing via SOAP could just as well be
used in a non-SOAP context. Likewise, document/literal lets you readily
perform XML Schema validation on the contents of the <soap:Body>. Also, if
you're going to be poring over the XML and you already need to know XML
Schema, then SOAP 1.1 Section 5 encoding is just one fewer thing you need to
be well-versed in. (Goes back to "more comprehensible.")
* Greater interoperability with Web service engines that only fully and
reliably support document/literal. (Yes, this is very much a political
matter.
Just stating facts, not necessarily applauding those facts.)

While you may certainly have valid reasons for wanting to deal with DOM/SAX
representations of your objects rather than the objects themselves, it is a
misconception to think that document/literal is necessarily associated with
XML representations.


Anamitra.Bhattacharyya@mro.com wrote:

Hi Davinder
I am going to try out what you suggested - but before that I would ask one
question - this Add and AddResponse which are the parameters [input and
return] of the services "add" method - can you invoke the add method from
the client just by passing XML and not dealing with the Add object? Because
I am not getting what else one can buy with using Doc/literal type service
if they are not able to pass XML and are forced to deal with Objects.
thanks
Anamitra




                        Davinder Singh

                        <dsingh@eGain.com        To:
"'axis-user@ws.apache.org'" <ax...@ws.apache.org>

                        >                        cc:

                                                 Subject:  RE: document
style
web services
                        04/29/2003 01:17

                        AM

                        Please respond to

                        axis-user









Hi Anamitra,
i have set up a doc/lit webservice using axis. i started with a wsdl file
and created the java impl using WSDL2java tool.


WSDL2java command: java org.apache.axis.wsdl.WSDL2Java -W -o . -d
Application -s -S false  -Nurn:CalculateNS packageName filename.wsdl


***************** WSDL **********************
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="
http://www.w3.org/2001/XMLSchema" xmlns:s0="urn:CalculateNS"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="
http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="
http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="urn:CalculateNS"
xmlns="http://schemas.xmlsoap.org/wsdl/">


    <types>
      <s:schema elementFormDefault="qualified"
targetNamespace="urn:CalculateNS">



        <s:element name="Add">
          <s:complexType>
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="arg1"
type="s:int"
/>
              <s:element minOccurs="0" maxOccurs="1" name="arg2"
type="s:int"
/>
            </s:sequence>
          </s:complexType>
        </s:element>


        <s:element name="AddResponse">
          <s:complexType>
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="addResult"
type="s:int" />
            </s:sequence>
          </s:complexType>
        </s:element>

      </s:schema>





    </types>
    <message name="AddSoapIn">
      <part name="parameters" element="s0:Add" />
    </message>
    <message name="AddSoapOut">
      <part name="parameters" element="s0:AddResponse" />
    </message>





    <portType name="CalculateSoap">
      <operation name="Add">
        <input message="s0:AddSoapIn" />
        <output message="s0:AddSoapOut" />
      </operation>
    </portType>


    <portType name="CalculateHttpGet" />


    <portType name="CalculateHttpPost" />


    <binding name="CalculateSoap" type="s0:CalculateSoap">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
      <operation name="Add">
        <soap:operation soapAction="" style="document" />
        <input>
          <soap:body use="literal" />
        </input>
        <output>
          <soap:body use="literal" />
        </output>
      </operation>
    </binding>


    <binding name="CalculateHttpGet" type="s0:CalculateHttpGet">
      <http:binding verb="GET" />
    </binding>


    <binding name="CalculateHttpPost" type="s0:CalculateHttpPost">
      <http:binding verb="POST" />
    </binding>


    <service name="Calculate">
      <port name="CalculateSoap" binding="s0:CalculateSoap">
        <soap:address location="http://axismachine/axis/services/Calculate"
/>
      </port>
      <port name="CalculateHttpGet" binding="s0:CalculateHttpGet">
        <http:address location="http://axismachine/axis/services/Calculate"
/>
      </port>
      <port name="CalculateHttpPost" binding="s0:CalculateHttpPost">
        <http:address location="http://axismachine/axis/services/Calculate"
/>
      </port>
    </service>
</definitions>


********************** WSDL *************************


After u run the command, it will generate Add.java, AddResponse.java
classes among others.
The method exposed is "public packageName.AddResponse add(packageName.Add
parameters){}"
This takes an Object as input param and gives an object as return value. U
will have to modify  Add.java and AddResponse.java as following:


U can see that in the type definition of these ser/deser classes, there is
an extra char (">") Search for '>AddResponse' and '>Add' and remove '>'
symbol. Similary for 'deploy.wsdd'. (I dont know why this character is
inserted , may be some bug in Axis)


Now u can insert ur code in CalculateSoapImpl.java and compile. After
compilation u can deploy the service using deploy command: java
org.apache.axis.client.AdminClient
-lhttp://axismachine/axis/services/AdminService deploy.wsdd


Regarding ur second query, yes it is possible if u use wrapped/literal
option given by axis. u can use it by using following command: java
org.apache.axis.wsdl.WSDL2Java -o . -d Application -s -S false
-Nurn:CalculateNS packageName filename.wsdl


Notice that only -W is removed. This turns off Wrapped feature.


HTH,
davin


-----Original Message-----
From: Anamitra.Bhattacharyya@mro.com
[mailto:Anamitra.Bhattacharyya@mro.com]
Sent: Monday, April 28, 2003 6:09 PM
To: axis-user@xml.apache.org
Subject: document style web services









Hi All
I need some pointers as to how to set up a document style web service using

apache axis. What I am trying to attempt is simple. I have a method like


public void processPo(POBean poBean)
in a class and I do have the schema representation of the POBean. I want
the client program to invoke the web service using XML and does not have to

bother abt the POBean. As per the Axix documentation goes - this is
possible. But ot doesnot explain how to generate the web service. Does
anyone has any sample document style web service? Any sample would be of
great help.


Also is it possible to have the method like


public void processPo(String poXML)


and still in the WSDL generated the user sees the schema for the poxml and
has a schema validation?


thanks
Anamitra













_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail




_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail





RE: document style web services

Posted by Nicolas Johnson <ni...@e-markets.com>.
What version of Axis are you using for your example?

-----Original Message-----
From: Rajal Shah [mailto:rashah@cisco.com]
Sent: Thursday, May 01, 2003 1:08 PM
To: axis-user@ws.apache.org
Subject: RE: document style web services


Here is the example.. to use doc-style messaging but putting the entire XML
inside a CDATA element and avoid the DOM creation and potential memory
issues for large XMLs. Use it at your own risk!

The client expects 2 arguments, so make sure you pass some dummy data for
them..
--
Rajal


-----Original Message-----
From: Rajal Shah [mailto:rashah@cisco.com]
Sent: Tuesday, April 29, 2003 12:56 PM
To: axis-user@ws.apache.org
Subject: RE: document style web services


Give me a day or so and I will post my example.

Regards.
--
Rajal


-----Original Message-----
From: dumdum 420 [mailto:dumdum420@hotmail.com]
Sent: Tuesday, April 29, 2003 12:29 PM
To: axis-user@ws.apache.org
Subject: RE: document style web services


Hi Rajal,

Thanx a ton. If you have any example u have tried or something which can
help me understand how u are going to do it programtically it will really
help.

Bhanu Pabreja

Since in the examples there is no Document/Literal example . The
MessageService is also of style="message", so I was wondering where do i get
a head start for doing this stuff.

Also from your approach it looks you plan to embed your XML document in a
Element object ... that is what u meant by sending your document as a CDATA
inside an element.

If yu have any sample code it will really help,infact then we can assemble
an example which then can be used by users in axis-community,since lot of
people have similar postings which still are unanswered. Hoping to hear from
you soon.

From: "Rajal Shah" <ra...@cisco.com>
Reply-To: axis-user@ws.apache.org
To: <ax...@ws.apache.org>
Subject: RE: document style web services
Date: Tue, 29 Apr 2003 11:54:43 -0700

I've seen your postings in the past regarding this topic.. Anne had
mentioned using Doc style always even for large XMLs (Anne - thanks for all
your comments.. They do help a lot).. But I'd be cautious cause I've heard
"Out Of Memory" errors in this mailing list too due to the large DOMs that
get created for large XMLs.

Personally, I am still debating on which option to choose from the 2 that I
mentioned.. (Using Attachments or passing the entire XML as CDATA inside one
element.) I could possibly have thousands of records to return to the user
and hence have a huge XML for the server and client to process as DOM..

My current bias is to go for the CDATA technique simply because attachments
may not be supported by all engines and that it might be easier for me to
switch from CDATA hack to actually doing the pure DOC style messaging and
get the DOM elements directly.

Be wary, that I do not have enough experience on this topic yet.. so don't
know all the pitfalls. I am sharing all the info that I've gathered so far.

--
Rajal


-----Original Message-----
From: dumdum 420 [mailto:dumdum420@hotmail.com]
Sent: Tuesday, April 29, 2003 11:23 AM
To: axis-user@ws.apache.org
Subject: RE: document style web services


Hi Rajal'
I have a huge XML file to pass to my client and was planning to implement
Document/Literal type of webservice,but with what you are saying it seems
that attachments are a better choice to send over the wire.

Comments will really help.

BP


From: "Rajal Shah" <ra...@cisco.com>
Reply-To: axis-user@ws.apache.org
To: <ax...@ws.apache.org>
Subject: RE: document style web services
Date: Tue, 29 Apr 2003 10:57:41 -0700

Anamitra

(argument to choose Attachment over Doc-style)

Do realize that during Document Style, Axis returns the entire XML to you in
a DOM structure.. For very large XMLs this could be a huge issue and you
might have to revert to Attachments.. (though not supported as well by all
web services engines).

I've seen an application, where they put their entire XML inside one body
element as CDATA. That way they get the entire XML as a string and then run
it through the SAX parser instead and save on huge memory requirements.. So
this is a viable alternative to Attachments..

I'm learning along with you do regarding these topics.
--
Rajal




-----Original Message-----
From: Mitch Gitman [mailto:mgitman@usa.net]
Sent: Tuesday, April 29, 2003 9:54 AM
To: axis-user@ws.apache.org
Subject: Re: document style web services


Anamitra,
Not that this answer helps you directly.

"What else one can buy with using Doc/literal type service" (as opposed to
RPC/encoded or RPC/literal):
* Arguably a more comprehensible, transparent Web service description. Same
for the SOAP messages. (Of course, ideally with a Web services toolkit, you
might not be poring over the XML at all.)
* The ability to piggyback on the use of XML Schema elsewhere. For instance,
the XSD definitions of objects you're passing via SOAP could just as well be
used in a non-SOAP context. Likewise, document/literal lets you readily
perform XML Schema validation on the contents of the <soap:Body>. Also, if
you're going to be poring over the XML and you already need to know XML
Schema, then SOAP 1.1 Section 5 encoding is just one fewer thing you need to
be well-versed in. (Goes back to "more comprehensible.")
* Greater interoperability with Web service engines that only fully and
reliably support document/literal. (Yes, this is very much a political
matter.
Just stating facts, not necessarily applauding those facts.)

While you may certainly have valid reasons for wanting to deal with DOM/SAX
representations of your objects rather than the objects themselves, it is a
misconception to think that document/literal is necessarily associated with
XML representations.


Anamitra.Bhattacharyya@mro.com wrote:

Hi Davinder
I am going to try out what you suggested - but before that I would ask one
question - this Add and AddResponse which are the parameters [input and
return] of the services "add" method - can you invoke the add method from
the client just by passing XML and not dealing with the Add object? Because
I am not getting what else one can buy with using Doc/literal type service
if they are not able to pass XML and are forced to deal with Objects.
thanks
Anamitra




                        Davinder Singh

                        <dsingh@eGain.com        To:
"'axis-user@ws.apache.org'" <ax...@ws.apache.org>

                        >                        cc:

                                                 Subject:  RE: document
style
web services
                        04/29/2003 01:17

                        AM

                        Please respond to

                        axis-user









Hi Anamitra,
i have set up a doc/lit webservice using axis. i started with a wsdl file
and created the java impl using WSDL2java tool.


WSDL2java command: java org.apache.axis.wsdl.WSDL2Java -W -o . -d
Application -s -S false  -Nurn:CalculateNS packageName filename.wsdl


***************** WSDL **********************
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="
http://www.w3.org/2001/XMLSchema" xmlns:s0="urn:CalculateNS"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="
http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="
http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="urn:CalculateNS"
xmlns="http://schemas.xmlsoap.org/wsdl/">


    <types>
      <s:schema elementFormDefault="qualified"
targetNamespace="urn:CalculateNS">



        <s:element name="Add">
          <s:complexType>
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="arg1"
type="s:int"
/>
              <s:element minOccurs="0" maxOccurs="1" name="arg2"
type="s:int"
/>
            </s:sequence>
          </s:complexType>
        </s:element>


        <s:element name="AddResponse">
          <s:complexType>
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="1" name="addResult"
type="s:int" />
            </s:sequence>
          </s:complexType>
        </s:element>

      </s:schema>





    </types>
    <message name="AddSoapIn">
      <part name="parameters" element="s0:Add" />
    </message>
    <message name="AddSoapOut">
      <part name="parameters" element="s0:AddResponse" />
    </message>





    <portType name="CalculateSoap">
      <operation name="Add">
        <input message="s0:AddSoapIn" />
        <output message="s0:AddSoapOut" />
      </operation>
    </portType>


    <portType name="CalculateHttpGet" />


    <portType name="CalculateHttpPost" />


    <binding name="CalculateSoap" type="s0:CalculateSoap">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
      <operation name="Add">
        <soap:operation soapAction="" style="document" />
        <input>
          <soap:body use="literal" />
        </input>
        <output>
          <soap:body use="literal" />
        </output>
      </operation>
    </binding>


    <binding name="CalculateHttpGet" type="s0:CalculateHttpGet">
      <http:binding verb="GET" />
    </binding>


    <binding name="CalculateHttpPost" type="s0:CalculateHttpPost">
      <http:binding verb="POST" />
    </binding>


    <service name="Calculate">
      <port name="CalculateSoap" binding="s0:CalculateSoap">
        <soap:address location="http://axismachine/axis/services/Calculate"
/>
      </port>
      <port name="CalculateHttpGet" binding="s0:CalculateHttpGet">
        <http:address location="http://axismachine/axis/services/Calculate"
/>
      </port>
      <port name="CalculateHttpPost" binding="s0:CalculateHttpPost">
        <http:address location="http://axismachine/axis/services/Calculate"
/>
      </port>
    </service>
</definitions>


********************** WSDL *************************


After u run the command, it will generate Add.java, AddResponse.java
classes among others.
The method exposed is "public packageName.AddResponse add(packageName.Add
parameters){}"
This takes an Object as input param and gives an object as return value. U
will have to modify  Add.java and AddResponse.java as following:


U can see that in the type definition of these ser/deser classes, there is
an extra char (">") Search for '>AddResponse' and '>Add' and remove '>'
symbol. Similary for 'deploy.wsdd'. (I dont know why this character is
inserted , may be some bug in Axis)


Now u can insert ur code in CalculateSoapImpl.java and compile. After
compilation u can deploy the service using deploy command: java
org.apache.axis.client.AdminClient
-lhttp://axismachine/axis/services/AdminService deploy.wsdd


Regarding ur second query, yes it is possible if u use wrapped/literal
option given by axis. u can use it by using following command: java
org.apache.axis.wsdl.WSDL2Java -o . -d Application -s -S false
-Nurn:CalculateNS packageName filename.wsdl


Notice that only -W is removed. This turns off Wrapped feature.


HTH,
davin


-----Original Message-----
From: Anamitra.Bhattacharyya@mro.com
[mailto:Anamitra.Bhattacharyya@mro.com]
Sent: Monday, April 28, 2003 6:09 PM
To: axis-user@xml.apache.org
Subject: document style web services









Hi All
I need some pointers as to how to set up a document style web service using

apache axis. What I am trying to attempt is simple. I have a method like


public void processPo(POBean poBean)
in a class and I do have the schema representation of the POBean. I want
the client program to invoke the web service using XML and does not have to

bother abt the POBean. As per the Axix documentation goes - this is
possible. But ot doesnot explain how to generate the web service. Does
anyone has any sample document style web service? Any sample would be of
great help.


Also is it possible to have the method like


public void processPo(String poXML)


and still in the WSDL generated the user sees the schema for the poxml and
has a schema validation?


thanks
Anamitra













_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail




_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail




RE: document style web services

Posted by John Chen <jc...@parasoft.com>.
Seems like you are using style=messaging, then doing something with the 
XML. Do you have an example where you deploy a Java Service using 
style=document?

John

At 11:07 AM 5/1/2003 -0700, you wrote:
>Here is the example.. to use doc-style messaging but putting the entire XML
>inside a CDATA element and avoid the DOM creation and potential memory
>issues for large XMLs. Use it at your own risk!
>
>The client expects 2 arguments, so make sure you pass some dummy data for
>them..
>--
>Rajal
>
>
>-----Original Message-----
>From: Rajal Shah [mailto:rashah@cisco.com]
>Sent: Tuesday, April 29, 2003 12:56 PM
>To: axis-user@ws.apache.org
>Subject: RE: document style web services
>
>
>Give me a day or so and I will post my example.
>
>Regards.
>--
>Rajal
>
>
>-----Original Message-----
>From: dumdum 420 [mailto:dumdum420@hotmail.com]
>Sent: Tuesday, April 29, 2003 12:29 PM
>To: axis-user@ws.apache.org
>Subject: RE: document style web services
>
>
>Hi Rajal,
>
>Thanx a ton. If you have any example u have tried or something which can
>help me understand how u are going to do it programtically it will really
>help.
>
>Bhanu Pabreja
>
>Since in the examples there is no Document/Literal example . The
>MessageService is also of style="message", so I was wondering where do i get
>a head start for doing this stuff.
>
>Also from your approach it looks you plan to embed your XML document in a
>Element object ... that is what u meant by sending your document as a CDATA
>inside an element.
>
>If yu have any sample code it will really help,infact then we can assemble
>an example which then can be used by users in axis-community,since lot of
>people have similar postings which still are unanswered. Hoping to hear from
>you soon.
>
>From: "Rajal Shah" <ra...@cisco.com>
>Reply-To: axis-user@ws.apache.org
>To: <ax...@ws.apache.org>
>Subject: RE: document style web services
>Date: Tue, 29 Apr 2003 11:54:43 -0700
>
>I've seen your postings in the past regarding this topic.. Anne had
>mentioned using Doc style always even for large XMLs (Anne - thanks for all
>your comments.. They do help a lot).. But I'd be cautious cause I've heard
>"Out Of Memory" errors in this mailing list too due to the large DOMs that
>get created for large XMLs.
>
>Personally, I am still debating on which option to choose from the 2 that I
>mentioned.. (Using Attachments or passing the entire XML as CDATA inside one
>element.) I could possibly have thousands of records to return to the user
>and hence have a huge XML for the server and client to process as DOM..
>
>My current bias is to go for the CDATA technique simply because attachments
>may not be supported by all engines and that it might be easier for me to
>switch from CDATA hack to actually doing the pure DOC style messaging and
>get the DOM elements directly.
>
>Be wary, that I do not have enough experience on this topic yet.. so don't
>know all the pitfalls. I am sharing all the info that I've gathered so far.
>
>--
>Rajal
>
>
>-----Original Message-----
>From: dumdum 420 [mailto:dumdum420@hotmail.com]
>Sent: Tuesday, April 29, 2003 11:23 AM
>To: axis-user@ws.apache.org
>Subject: RE: document style web services
>
>
>Hi Rajal'
>I have a huge XML file to pass to my client and was planning to implement
>Document/Literal type of webservice,but with what you are saying it seems
>that attachments are a better choice to send over the wire.
>
>Comments will really help.
>
>BP
>
>
>From: "Rajal Shah" <ra...@cisco.com>
>Reply-To: axis-user@ws.apache.org
>To: <ax...@ws.apache.org>
>Subject: RE: document style web services
>Date: Tue, 29 Apr 2003 10:57:41 -0700
>
>Anamitra
>
>(argument to choose Attachment over Doc-style)
>
>Do realize that during Document Style, Axis returns the entire XML to you in
>a DOM structure.. For very large XMLs this could be a huge issue and you
>might have to revert to Attachments.. (though not supported as well by all
>web services engines).
>
>I've seen an application, where they put their entire XML inside one body
>element as CDATA. That way they get the entire XML as a string and then run
>it through the SAX parser instead and save on huge memory requirements.. So
>this is a viable alternative to Attachments..
>
>I'm learning along with you do regarding these topics.
>--
>Rajal
>
>
>
>
>-----Original Message-----
>From: Mitch Gitman [mailto:mgitman@usa.net]
>Sent: Tuesday, April 29, 2003 9:54 AM
>To: axis-user@ws.apache.org
>Subject: Re: document style web services
>
>
>Anamitra,
>Not that this answer helps you directly.
>
>"What else one can buy with using Doc/literal type service" (as opposed to
>RPC/encoded or RPC/literal):
>* Arguably a more comprehensible, transparent Web service description. Same
>for the SOAP messages. (Of course, ideally with a Web services toolkit, you
>might not be poring over the XML at all.)
>* The ability to piggyback on the use of XML Schema elsewhere. For instance,
>the XSD definitions of objects you're passing via SOAP could just as well be
>used in a non-SOAP context. Likewise, document/literal lets you readily
>perform XML Schema validation on the contents of the <soap:Body>. Also, if
>you're going to be poring over the XML and you already need to know XML
>Schema, then SOAP 1.1 Section 5 encoding is just one fewer thing you need to
>be well-versed in. (Goes back to "more comprehensible.")
>* Greater interoperability with Web service engines that only fully and
>reliably support document/literal. (Yes, this is very much a political
>matter.
>Just stating facts, not necessarily applauding those facts.)
>
>While you may certainly have valid reasons for wanting to deal with DOM/SAX
>representations of your objects rather than the objects themselves, it is a
>misconception to think that document/literal is necessarily associated with
>XML representations.
>
>
>Anamitra.Bhattacharyya@mro.com wrote:
>
>Hi Davinder
>I am going to try out what you suggested - but before that I would ask one
>question - this Add and AddResponse which are the parameters [input and
>return] of the services "add" method - can you invoke the add method from
>the client just by passing XML and not dealing with the Add object? Because
>I am not getting what else one can buy with using Doc/literal type service
>if they are not able to pass XML and are forced to deal with Objects.
>thanks
>Anamitra
>
>
>
>
>                         Davinder Singh
>
>                         <dsingh@eGain.com        To:
>"'axis-user@ws.apache.org'" <ax...@ws.apache.org>
>
>                         >                        cc:
>
>                                                  Subject:  RE: document
>style
>web services
>                         04/29/2003 01:17
>
>                         AM
>
>                         Please respond to
>
>                         axis-user
>
>
>
>
>
>
>
>
>
>Hi Anamitra,
>i have set up a doc/lit webservice using axis. i started with a wsdl file
>and created the java impl using WSDL2java tool.
>
>
>WSDL2java command: java org.apache.axis.wsdl.WSDL2Java -W -o . -d
>Application -s -S false  -Nurn:CalculateNS packageName filename.wsdl
>
>
>***************** WSDL **********************
><?xml version="1.0" encoding="utf-8"?>
><definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
>xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="
>http://www.w3.org/2001/XMLSchema" xmlns:s0="urn:CalculateNS"
>xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="
>http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="
>http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="urn:CalculateNS"
>xmlns="http://schemas.xmlsoap.org/wsdl/">
>
>
>     <types>
>       <s:schema elementFormDefault="qualified"
>targetNamespace="urn:CalculateNS">
>
>
>
>         <s:element name="Add">
>           <s:complexType>
>             <s:sequence>
>               <s:element minOccurs="0" maxOccurs="1" name="arg1"
>type="s:int"
>/>
>               <s:element minOccurs="0" maxOccurs="1" name="arg2"
>type="s:int"
>/>
>             </s:sequence>
>           </s:complexType>
>         </s:element>
>
>
>         <s:element name="AddResponse">
>           <s:complexType>
>             <s:sequence>
>               <s:element minOccurs="0" maxOccurs="1" name="addResult"
>type="s:int" />
>             </s:sequence>
>           </s:complexType>
>         </s:element>
>
>       </s:schema>
>
>
>
>
>
>     </types>
>     <message name="AddSoapIn">
>       <part name="parameters" element="s0:Add" />
>     </message>
>     <message name="AddSoapOut">
>       <part name="parameters" element="s0:AddResponse" />
>     </message>
>
>
>
>
>
>     <portType name="CalculateSoap">
>       <operation name="Add">
>         <input message="s0:AddSoapIn" />
>         <output message="s0:AddSoapOut" />
>       </operation>
>     </portType>
>
>
>     <portType name="CalculateHttpGet" />
>
>
>     <portType name="CalculateHttpPost" />
>
>
>     <binding name="CalculateSoap" type="s0:CalculateSoap">
>       <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
>style="document" />
>       <operation name="Add">
>         <soap:operation soapAction="" style="document" />
>         <input>
>           <soap:body use="literal" />
>         </input>
>         <output>
>           <soap:body use="literal" />
>         </output>
>       </operation>
>     </binding>
>
>
>     <binding name="CalculateHttpGet" type="s0:CalculateHttpGet">
>       <http:binding verb="GET" />
>     </binding>
>
>
>     <binding name="CalculateHttpPost" type="s0:CalculateHttpPost">
>       <http:binding verb="POST" />
>     </binding>
>
>
>     <service name="Calculate">
>       <port name="CalculateSoap" binding="s0:CalculateSoap">
>         <soap:address location="http://axismachine/axis/services/Calculate"
>/>
>       </port>
>       <port name="CalculateHttpGet" binding="s0:CalculateHttpGet">
>         <http:address location="http://axismachine/axis/services/Calculate"
>/>
>       </port>
>       <port name="CalculateHttpPost" binding="s0:CalculateHttpPost">
>         <http:address location="http://axismachine/axis/services/Calculate"
>/>
>       </port>
>     </service>
></definitions>
>
>
>********************** WSDL *************************
>
>
>After u run the command, it will generate Add.java, AddResponse.java
>classes among others.
>The method exposed is "public packageName.AddResponse add(packageName.Add
>parameters){}"
>This takes an Object as input param and gives an object as return value. U
>will have to modify  Add.java and AddResponse.java as following:
>
>
>U can see that in the type definition of these ser/deser classes, there is
>an extra char (">") Search for '>AddResponse' and '>Add' and remove '>'
>symbol. Similary for 'deploy.wsdd'. (I dont know why this character is
>inserted , may be some bug in Axis)
>
>
>Now u can insert ur code in CalculateSoapImpl.java and compile. After
>compilation u can deploy the service using deploy command: java
>org.apache.axis.client.AdminClient
>-lhttp://axismachine/axis/services/AdminService deploy.wsdd
>
>
>Regarding ur second query, yes it is possible if u use wrapped/literal
>option given by axis. u can use it by using following command: java
>org.apache.axis.wsdl.WSDL2Java -o . -d Application -s -S false
>-Nurn:CalculateNS packageName filename.wsdl
>
>
>Notice that only -W is removed. This turns off Wrapped feature.
>
>
>HTH,
>davin
>
>
>-----Original Message-----
>From: Anamitra.Bhattacharyya@mro.com
>[mailto:Anamitra.Bhattacharyya@mro.com]
>Sent: Monday, April 28, 2003 6:09 PM
>To: axis-user@xml.apache.org
>Subject: document style web services
>
>
>
>
>
>
>
>
>
>Hi All
>I need some pointers as to how to set up a document style web service using
>
>apache axis. What I am trying to attempt is simple. I have a method like
>
>
>public void processPo(POBean poBean)
>in a class and I do have the schema representation of the POBean. I want
>the client program to invoke the web service using XML and does not have to
>
>bother abt the POBean. As per the Axix documentation goes - this is
>possible. But ot doesnot explain how to generate the web service. Does
>anyone has any sample document style web service? Any sample would be of
>great help.
>
>
>Also is it possible to have the method like
>
>
>public void processPo(String poXML)
>
>
>and still in the WSDL generated the user sees the schema for the poxml and
>has a schema validation?
>
>
>thanks
>Anamitra
>
>
>
>
>
>
>
>
>
>
>
>
>
>_________________________________________________________________
>The new MSN 8: smart spam protection and 2 months FREE*
>http://join.msn.com/?page=features/junkmail
>
>
>
>
>_________________________________________________________________
>Add photos to your e-mail with MSN 8. Get 2 months FREE*.
>http://join.msn.com/?page=features/featuredemail
>
>
>
>
>