axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Dean" <Tony.D...@sas.com>
Subject RE: [axis2] dynamic client invocation w/o intermediate classgeneration
Date Thu, 15 Jun 2006 15:49:56 GMT
Sanjiva,

Can you speak to what Dims eluded to... how to use complexTypes w/o generating helper classes
to perform serialization/deserialization.  I want to do what WSIF and JROM started out to
do.

Also, with the current ServiceClient API, I don't see a way distinquish between the style
of service that you want to invoke.  Basically, you just pass in an OMElement as the payload.
 I used WSDL2Java to see what kind of code would be generated from a simple RPC stockquote
wsdl.  The wsdl is as follows:

<?xml version='1.0' encoding='UTF-8'?>
<definitions name='net.xmethods.services.stockquote.StockQuote' 
	     targetNamespace='http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.StockQuote/'

	     xmlns:tns='http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.StockQuote/'

             xmlns:electric='http://www.themindelectric.com/' 
             xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' 
             xmlns:xsd='http://www.w3.org/2001/XMLSchema' 
             xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' 
             xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' 
             xmlns='http://schemas.xmlsoap.org/wsdl/'>

   <message name='getQuoteResponse1'>
      <part name='Result' type='xsd:float'/>
   </message>

   <message name='getQuoteRequest1'>
      <part name='symbol' type='xsd:string'/>
   </message>

   <portType name='net.xmethods.services.stockquote.StockQuotePortType'>
      <operation name='getQuote' parameterOrder='symbol'>
         <input message='tns:getQuoteRequest1'/>
         <output message='tns:getQuoteResponse1'/>
      </operation>
   </portType>

   <binding name='net.xmethods.services.stockquote.StockQuoteBinding' 
            type='tns:net.xmethods.services.stockquote.StockQuotePortType'>
      <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
      <operation name='getQuote'>
         <soap:operation soapAction='urn:xmethods-delayed-quotes#getQuote'/>
         <input>
            <soap:body use='encoded' 
                       namespace='urn:xmethods-delayed-quotes' 
                       encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
         </input>
         <output>
            <soap:body use='encoded' 
                       namespace='urn:xmethods-delayed-quotes' 
                       encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
         </output>
      </operation>
   </binding>

   <service name='net.xmethods.services.stockquote.StockQuoteService'>
      <documentation>net.xmethods.services.stockquote.StockQuote web service</documentation>
      <port name='net.xmethods.services.stockquote.StockQuotePort' 
            binding='tns:net.xmethods.services.stockquote.StockQuoteBinding'>
         <soap:address location='http://64.124.140.30:9090/soap'/>
         <!-- <soap:address location='http://localhost:9999/soap'/> -->
      </port>
   </service>
</definitions>

Axis2 ADB generated coded that produces the following client invocation stream:

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
 <soapenv:Header />
 <soapenv:Body>
  <ns1:getQuote xmlns:ns1="http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.StockQuote/">
   <symbol>IBM</symbol>
  </ns1:getQuote>
 </soapenv:Body>
</soapenv:Envelope>

This is wrong.  First, for rpc style services, the namespace of the wrapper element (operation)
must be specified with the binding soap:body extension namespace attribute.  In the wsdl above,
this namespace is 
"urn:xmethods-delayed-quotes".  Second, since use is encoded, don't you have to encode the
data that you send?  A correct stream would look something like this:


<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <ns1:getQuote soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:xmethods-delayed-quotes">
   <ns1:symbol xsi:type="xsd:string">IBM</ns1:symbol>
  </ns1:getQuote>
 </soapenv:Body>
</soapenv:Envelope>



It seems that with Axis2 everything is treated as a document with literal encoding.  That
is, both input/output of ServiceClient invocation is OMElement.  And is it the user's responsibility
to encode the data if necessary (use="encoded") within the payload?  Hopefully, not.  In the
old Axis 1.x codebase, you could pass in input data (along with type) and set the operation
style that you wanted to use. How do you do this in Axis2?  What is the new paradigm here
for client invocation such that I can code a client with a given set of data and work with
services that are designed as rpc/literal, rpc/encoded, doc/literal, or doc/literal/wrapped?

And my initial question was... if I have custom complexTypes, can I get Axis2 to interact
with them some way without generating the helper classes.  I want to perform dynamic generation.

Please, help to clear this up a bit for me.

Much appreciated!!!

-Tony

-----Original Message-----
From: Sanjiva Weerawarana [mailto:sanjiva@opensource.lk] 
Sent: Wednesday, June 14, 2006 11:44 PM
To: axis-dev@ws.apache.org
Cc: axis-user@ws.apache.org
Subject: Re: [axis2] dynamic client invocation w/o intermediate classgeneration

Hi Tony,

Have you looked at the ServiceClient API? That's precisely what that's for .. sorry for not
noticing your question earlier. 

Sanjiva.

On Wed, 2006-06-14 at 18:42 -0400, Tony Dean wrote:
> Hi,
> 
> I had previously sent a request to determine the best way to perform  
> dynamic client invocation with axis2 or with any client framework for  
> that matter, but received no replies.  So, I will send this request  
> once again. :-)
> 
> I know that invoking a web service on the fly without performing any  
> intermediate step (wsdl2java) is needed by more than just me.  Can  
> anyone speak to this subject?
> 
> I have briefly looked at WSIF and JROM.  They do not seem to be  
> actively updated at this time so they may be woefully out of date.
>  Although, it seems as though I could add an axis2 provider to WSIF 
> and  use JROM to handle complexType serialization/deserialization, is 
> this  the way to go?  Has anyone crossed this bridge recently?
> 
> Thanks for any insight on this issue.  It is greatly appreciated.
> 
> -Tony Dean
> 
> Tony Dean
> SAS Institute Inc.
> 919.531.6704
> tony.dean@sas.com
> 
> SAS... The Power to Know
> http://www.sas.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message