From: Soti, Dheeraj [mailto:[EMAIL PROTECTED]
Sent: Monday, March 28, 2005 6:44p
To: '[email protected]'
Subject: The provider says java:RPC in server-config.wsdd file even though the style I choose is document/literal wrapped
I wrote a RPC/encoded style service and then based on my reading on interoperability and Anne's email (shown below) I changed the style to document/literal wrapped. After changing the WSDL and deploying the service I still see provider="java:RPC" in server-config.wsdd file. Although the service works fine and it does what it is supposed to do when I call it using a client.
Steps I
followed:
-----------------------
1. Changed the WSDL to use document/literal by
following proper rules.
2. Run
WSDL2Java to generate deploy.wsdd
3. Run AdminClient to deploy the service using the
.wsdd generated from Step-2
When I see the server-config.wsdd file the provider is RPC. Shouldn't this be 'document'. The server-config and WSDL are attached here:
Thanks
Dheeraj
Server-config.wsdd file
<service name="ContentServiceWS"
provider="java:RPC" style="wrapped" use="literal">
<operation name="createContent"
qname="ns1:createContent" returnQName="ns1:status" returnType="xsd:boolean"
soapAction="" xmlns:ns1="http://services.hrs.harris.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<parameter qname="ns1:arg1"
type="ns2:ProgramContentImpl" xmlns:ns2="http://impl.content.services.hrs.harris.com/"/>
</operation>
<parameter name="allowedMethods"
value="createContent"/>
<parameter name="wsdlPortType" value="ContentServiceWS"/>
<parameter name="className"
value="com.harris.hrs.services.ContentServiceSoapBindingImpl"/>
<parameter name="wsdlServicePort"
value="ContentServiceWS"/>
<parameter name="wsdlTargetNamespace" value="http://services.hrs.harris.com/"/>
<parameter name="wsdlServiceElement"
value="HRSWebService"/>
<typeMapping
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
encodingStyle="" qname="ns3:ProgramContentImpl"
serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
type="java:com.harris.hrs.services.content.impl.ProgramContentImpl"
xmlns:ns3="http://impl.content.services.hrs.harris.com/"/>
<typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns4:ImmutableFrameTime" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.harris.hrs.services.timecode.ImmutableFrameTime" xmlns:ns4="http://timecode.services.hrs.harris.com/"/>
</service>
WSDL
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://services.hrs.harris.com/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://services.hrs.harris.com/"
xmlns:intf="http://services.hrs.harris.com/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns1="http://services.hrs.harris.com/"
xmlns:content="http://impl.content.services.hrs.harris.com/"
xmlns:timecode="http://timecode.services.hrs.harris.com/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.2RC2 Built on
Nov 16, 2004 (12:19:44 EST)-->
<wsdl:types>
<schema targetNamespace="http://timecode.services.hrs.harris.com/"
xmlns="http://www.w3.org/2001/XMLSchema">
<complexType
name="ImmutableFrameTime">
<sequence>
<element name="frameCount"
type="xsd:long"/>
<element name="frameRate" type="xsd:double" />
</sequence>
</complexType>
</schema>
<schema elementFormDefault="qualified"
targetNamespace="http://impl.content.services.hrs.harris.com/"
xmlns="http://www.w3.org/2001/XMLSchema">
<complexType name="ProgramContentImpl">
<sequence>
<element name="description" nillable="true" type="xsd:string"/>
<element name="houseId" nillable="true" type="xsd:string"/>
<element name="id" type="xsd:long"/>
<element name="title" nillable="true" type="soapenc:string"/>
<element name="estimatedDuration" nillable="true"
type="timecode:ImmutableFrameTime"/>
<element name="episodeNumber" nillable="true" deafult=""
type="xsd:string"/>
<element name="umid" nillable="true" type="xsd:string" default=""/>
<element name="episodeTitle" nillable="true" type="xsd:string"
default=""/>
<element name="numberProgramSegments" nillable="true" default="1"
type="xsd:int"/>
</sequence>
</complexType>
</schema>
<schema elementFormDefault="qualified"
targetNamespace="http://services.hrs.harris.com/"
xmlns="http://www.w3.org/2001/XMLSchema">
<import
namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<!--The following four elements have to be defined for doc/literal
wrapped-->
<complexType
name="createContentInput">
<sequence>
<element name="arg1" type="content:ProgramContentImpl"/>
</sequence>
</complexType>
<complexType name="createContentOutput">
<sequence>
<element name="status" type="xsd:boolean"/>
</sequence>
</complexType>
<element name="createContent" type="impl:createContentInput"/>
<element name="createContentResponse"
type="impl:createContentOutput"/>
<!--The above four elements
have to be defined for doc/literal wrapped-->
</schema>
</wsdl:types>
<wsdl:message name="createContentRequest">
<wsdl:part name="in0" element='impl:createContent'/>
</wsdl:message>
<wsdl:message name="createContentResponse">
<wsdl:part name="createContentReturn" element='impl:createContentResponse'/>
</wsdl:message>
<wsdl:portType
name="ContentServiceWS">
<wsdl:operation name="createContent" parameterOrder="in0">
<wsdl:input message="impl:createContentRequest" name="createContentRequest"/>
<wsdl:output message="impl:createContentResponse" name="createContentResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ContentServiceSoapBinding"
type="impl:ContentServiceWS">
<wsdlsoap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<wsdl:operation name="createContent">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="createContentRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="createContentResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HRSWebService">
<wsdl:port binding="impl:ContentServiceSoapBinding" name="ContentServiceWS">
<wsdlsoap:address location="http://localhost:8080/hrsApp/services/ContentServiceWS"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
-----Original Message-----
From: Anne
Thomas Manes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 24, 2005 7:20
AM
To: [email protected]
Subject: Re: Which Style of WSDL should I use
One of the most important concepts to understand about the web services framework (WSF) is that it should not be used like a distributed object system. Web services communicate by exchanging messages -- it's more like JMS than RMI. The WSF doesn't support remote references, remote object garbage collection, or any of the other distributed object features you've come to rely upon in RMI. The fundamental purpose of the WSF is to enable interoperability across dissimilar systems that don't necessarily understand concepts such as method overloading, object inheritance, and polymorphism. Hence web service interfaces should not expose these OO concepts.
For best interoperability with .NET, you should use document/literal with the wrapped programming convention. (Axis "wrapped" style.) You should flatten your object graph. You should not expose Java collections, such as maps and lists. You should convert all your collections into arrays. And you should not use overloaded methods. Each operation should have a different operation name. You should also expose a "chunky" interface rather than a "chatty" interface -- in other words, you should not expose getter and setter operations for every member in your object class. This goes back to the differentiation between message exchange versus distributed object systems. When using distributed objects, the object resides on the server side, and the client invokes operations on the object using a proxy. The client does not have its own copy of the object. When using a message exchange system, the client side application should have its own object -- not just a proxy. (And -- btw -- that object may be different from the server's object.) When the client communicates with the server, it simply passes data, not behavior. It's much more loosely coupled.
You may find that it's necessary to build an abstraction layer between your WSDL interface and your middle tier applications. (This is a much better idea than trying to expose your rich datagraph directly.) This abstraction layer performs the necessary mapping between the document-oriented WSDL interface and the application's object model. It also provides much better insulation for flexibility and change.
The "wrapped" style is defined in the JAX-RPC 1.1 spec, in section 6.4.1 Java Mapping of Literal Representation. (note that JAX-RPC 1.1 was originally designed around rpc/encoded, and added only cursory support for rpc/literal and document/literal at the last minute. So I wouldn't rely on JAX-RPC for definite recommendations for best
practices.)
The "wrapped" style supports a programming model that makes document/literal feel like RPC style. "Wrapped" style is very similar to RPC/literal, except for two important distinctions:
1- .NET supports "wrapped" style, but it doesn't
support RPC/literal
2- "wrapped" style
defines a schema of the full soap body (which makes it very easy to validate),
while RPC/Literal defines a schema only of a portion of the soap body (which
makes validation slightly more complicated).
Please see my blog entry for a definition of the
"wrapped" style:
http://atmanes.blogspot.com/2005/03/wrapped-documentliteral-convention.html
Anne
On Wed, 23 Mar 2005 16:34:31 -0800, Tim K. (Gmane)
<[EMAIL PROTECTED]> wrote:
> Good
questions, I would like to know too ...
>
> In addition, is wrapped doc/literal Axis
specific? It doesn't seem to
> be standard
JAX-RPC. I guess my bigger question is: Is it possible to
> have RPC-like web services (exposing lots of methods the
client can
> call) and use doc/literal
encoding? If so, what's the approach?
>
> Tim
>
> Soti, Dheeraj wrote:
> > Hi,
> >
> > I have to expose
our middle-tier (J2EE) APIs as web service which
> > will be consumed by a .NET clients (and possibly Java clients
as
> > well). I came across an article
> > _http://www-128.ibm.com/developerworks/webservices/library/ws-whichw
> > sdl/_
> > that explained all the possible styles beautifully but also
raised few
> > questions in mind. I
will appreciate if someone will share his
> > experience with me.
>
>
> > * WS-I
says no to RPC/encoded but as per the article it has some
> > benefits like
Polymorphism and datagraph which is true in my
> > business case as well. I
have a class that can have members of
>
> itself. Will I have problems using
doc/literal(wrapped)
>
> * WS-I also advises not to use overloaded methods
but doesn't that
>
> put additional load on client. For
example I have a method
>
> createContent(Content ct). I have 3
different implementations of
>
> Content so I'll have to add three
methods
>
> createContentofType1/2/3. Or should I
consider this as a tradeoff
>
> for being interop?
> >
> >
Thanks
> >
> > Dheeraj
> >
>
>
