Peter,

Your approach is great. To answer your questions:

#3: Assuming that your Messages.xsd imports your CommonTypes.xsd, then
all you [should] need to do is import the Message.xsd schema into your
<wsdl:types> section. As long as you declare the namespace in the
<wsdl:definitions> root, and you import the Messgae.xsd namespace into
a schema in the <wsdl:types>, you can reference elements in the
Messages.xsd schema from the <wsdl:part> definitions.  e.g.,

<wsdl:definitions 
   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
   xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
   xmlns:tns="this-namespace"
   xmlns:mns="messages-namespace"
   targetNamespace="this-namespace">
<wsdl:types>
   <xs:schema targetNamespace="this-namespace" >
      <xs:import namespace="messages-namespace 
            schemaLocation="messages.xsd"/>
   </xs:schema>
</wsdl:types>
<wsdl:message name="updateUserInformationRequest">
  <wsdl:part name="parameters" element="mns:updateUserInformation"/>
</wsdl:message>
...

Unfortunately, .NET has a little trouble dealing with imports, so you
may need to include your schemas inline in the WSDL <types> section.

#4: Correct (except that .NET has this schema import problem)

#5: True schema validation does not happen automatically -- for
example, if you have a string restriction defining a required
patttern, Axis won't automatically validate the string -- but Axis
does a certain amount of implicit validation as it converts XML into
Java. It will generate an error if it encounters unexpected data.

You can also configure the system to perform schema validation of
incoming and outgoing messages. You request validation using a handler
in the input and/or output messaging pipeline.

Schema validation can be a pretty expensive process, so you might want
to use it sparingly. You need to make the call whether your
application requires method validation.

Anne

On 7/28/05, Peter <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I am completely new to web services and have a few questions to get me
> started on the right track. To give a little background, the project
> involves integration between two enterprise systems (J2EE and .NET)
> and corresponding databases. So both parties involved will be acting
> in both a server & client role.
> 
> 1. After playing around a bit it seems to me most logical to start
> with a XSD to define my types and also define a schema for my messages
> (is this common practice? I am not even sure messages themselves can
> get validated or if it's a good idea). So for simplicity's sake I have
> two XSDs: CommonTypes.xsd and Messages.xsd. Former contains various
> complex and simple types (and possible elemens? see comments below)
> such as AccountType and PersonType. The Messages.xsd imports
> CommonTypes.xsd and contains elements for each message, for example
> UpdateUserInformation element with elements Person and Account of
> PersonType and AccountType respectively. I did this primarily to
> generate sample messages to establish required and optional fields and
> have a clearer picture of what is (not) exchanged.
> 
> 2. Next I wrote a simple interface using mock/empty domain objects
> (such as Account and Person) with a method
> UpdateUserInformation(Account account, Person person). I did this to
> generate a starting point WSDL. Next I started editing the generated
> WSDL, my first goal is to remove the schema definition inside the WSDL
> and import my external schemas directly to allow for a more modular
> (and hopefully more maintainable) approach. I am trying to avoid each
> side of the integration generating WSDL from domain objects and we end
> up having to do domain object translation between each side's version
> as apposed to starting from a common schema & WSDL and generating
> domain objects.
> 
> 3. ** Here my trouble started, I was able to easily enough include the
> CommonTypes.xsd but how do I reference the nested elements inside my
> Message schema (such as Person & Account above)? ** For now I had to
> define them again in my WSDL, which I am trying to avoid, I want my
> entire schema externalized.
> My understanding is I need to reference these _elements_ (not types,
> right?) in the <wsdl:message> section, specifcally in the <wsdl:part>
> element.
> 
> 4. So from here on, once I get the WSDL fixed, I aim to use WSDL2Java
> to generate my domain objects, this will replace my interface and mock
> domain objects. Is this correct? The other team can hopefully use
> their .NET infrastructure and achieve the same thing using the common
> schema & WSDL?
> 
> 5. For additional benefit, is it possible and/or practical to validate
> and message with some of the schemas above? Is this done implcitely?
> 
> In addition to the questions I am trying to solicit some comments
> regarding my overall approach, obviously one needs to do this a few
> times to get a firm grip on the best practices/best approach etc and I
> hope to draw from the wide experience base here on the mailing list. I
> have found very little information out there on the bigger picture
> such as these questions.
> 
> Thank you,
> Peter
>

Reply via email to