axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rajal Shah" <ras...@cisco.com>
Subject RE: document style web services
Date Tue, 29 Apr 2003 17:57:41 GMT
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'" <axis-user@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












Mime
View raw message