Hi Dennis,

Thanks for the added explanations on the problems I was having with 
collections. 
I was able to clean things up, and decided to leave the namespace problem until 
I started developing off our formal schemas. I am using the -uw flag in WSDL, 
and it works extremely well. But once I add an extra layer of abstract 
mappings, 
the extra namespace shows up.

We've broken our schemas into a few separate pieces using a chameleon pattern; 
here is the current state of the binding for our schemas:

binding.xml:

<binding add-constructors="true" force-classes="true"
   xmlns:xsd="http://www.iris.edu/phasepick/xsd";>

   <namespace uri="http://www.iris.edu/phasepick/xsd";
     default="elements"/>

   <include path="base-binding.xml"/>
   <include path="core-binding.xml"/>
   <include path="wsdl-binding.xml"/>

</binding>

base-binding.xml:

<binding xmlns:xsd="http://www.iris.edu/phasepick/xsd";>

     <mapping abstract="true" class="edu.iris.ws.base.Author">
         <value name="Name" field="name" usage="optional"/>
         <value name="AuthorKey" field="authorKey" usage="optional"/>
         <structure name="Link" field="link" usage="optional"/>
         <structure name="Comment" field="comment" usage="optional"/>
         <structure name="Institution" field="institution" usage="optional"/>
         <value name="ID" field="ID" style="attribute"/>
     </mapping>

     <mapping abstract="true" class="edu.iris.ws.base.Link">
         <value name="Description" field="description" usage="optional"/>
         <value name="URL" field="url" style="attribute"/>
         <value name="title" field="title" style="attribute"/>
     </mapping>

     <mapping abstract="true" class="edu.iris.ws.base.Comment">
         <value name="Text" field="text" usage="optional"/>
         <structure name="Author" usage="optional"/>
         <structure name="Link" usage="optional"/>
     </mapping>

     <mapping abstract="true" class="edu.iris.ws.base.ErrorDescription">
         <value name="errorType" field="errorType" style="attribute"/>
         <value name="errorUnits" field="errorUnits" style="attribute" 
usage="optional"/>
         <value name="errorValue" field="errorValue" style="attribute"/>
     </mapping>

     <mapping abstract="true" class="edu.iris.ws.base.ExtraElements">
         <structure ordered="false" choice="true">
             <structure name="Comment" field="comment" usage="optional"/>
             <structure name="Link" field="link" usage="optional"/>
         </structure>
         <value name="CreateTime" field="createTime"/>
     </mapping>

</binding>

core-binding.xml:

<binding xmlns:xsd="http://www.iris.edu/phasepick/xsd";>

     <mapping type-name="xsd:MagnitudeType" abstract="true" 
class="edu.iris.ws.core.Magnitude">
         <value name="type" field="type" style="attribute"/>
         <value name="value" field="value" style="attribute"/>
         <structure name="Contributor" field="contributor" usage="optional"/>
         <value name="Version" field="version" usage="optional"/>
         <value name="NumStations" field="numStations" usage="optional"/>
         <structure name="Error" field="errorDescription" usage="optional"/>
         <structure field="extraElements" usage="optional"/>
     </mapping>

     <mapping type-name="xsd:OriginType" abstract="true" 
class="edu.iris.ws.core.Origin">
         <value name="Catalog" field="catalog" usage="optional"/>
         <structure name="Contributor" field="contributor"/>
         <structure name="Source" field="source" usage="optional"/>
         <collection field="magnitudes" >
              <structure name="Magnitude" map-as="xsd:MagnitudeType"/>
         </collection>
     </mapping>

</binding>

(not currently calling any of the bindings in wsdl-binding.xml)

The relevant part of the wsdl is:
<wsdl:definitions targetNamespace="http://www.iris.edu/phasepick/xsd";
     xmlns:xsd="http://www.iris.edu/phasepick/xsd";
     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
     xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/";
     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
     xmlns:xs="http://www.w3.org/2001/XMLSchema";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
     <wsdl:types>
         <schema elementFormDefault="qualified" 
targetNamespace="http://www.iris.edu/phasepick/xsd";
             xmlns="http://www.w3.org/2001/XMLSchema";>

             <include 
schemaLocation="http://www.iris.edu/schema/common/xml/coreDataTypes.xsd"/>

etc...

A call returning an array of OriginType puts in extra namespace declarations:

<response xmlns:xsi="http//...XMLSchema" xmlns="http://.../xsd";>
   <Origin>
     <Catalog>NEIC</Catalog>
     <Contributor xmlns="http://.../xsd>
        ...
     </Contributor>
     <Magnitude xmlns="http://.../xsd>
       <Contributor xmlns="http://.../xsd>
          ...
       </Contributor>
       ...
     </Magnitude>
   etc.

  Our schemas are available online:
   http://www.iris.edu/schema/common/xml/

I've re-read the documentation, and it seems as if it should work. Thanks for 
your help.

Joanna


Dennis Sosnoski wrote:
> Hi Joanna,
> 
> The extra layer of <arrival> is because you used name='arrival' on the 
> <collection> element in your binding. This says you want to use 
> <arrival> as a wrapper element around the items in the collection.
> 
> As to the namespace, isn't there a <namespace> definition in your 
> binding that you didn't show? I'd expect there to be one to create this 
> added namespace declaration. If you can show the <schema> element from 
> your WSDL (with targetNamespace and elementFormDefault attributes) along 
> with any <namespace> element in the binding it'd help.
> 
> You're using the -uw flag to unwrap the WSDL in WSDL2Java, right? Then 
> the abstract <mapping> for event-type is what you want.
> 
>   - Dennis
> 
> Dennis M. Sosnoski
> SOA and Web Services in Java
> Training and Consulting
> http://www.sosnoski.com - http://www.sosnoski.co.nz
> Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to