I have a question I am hoping to get a bit of clarification on.

I am using a spring-ws client (Version: 2.0.1)
And Castor as my marshaller (Version: 1.3)
Running on Oracle Linux 5
Eclipse Version Helios

I have an XSD Defined for a fairly complex Object model. I have castor
working and marshalling properly on the Endpoint. But 
Here is where the use case gets tricky. The endpoint that is invoked is
at the trailing edge of our SOA implementation.
The message is run through an Oracle Service Bus as well as an Oracle
Mediator (Both doing XSLT typed transformations) prior to the message 
reaching the endpoint. The client definition is stated as follows.

Spring Client:

        <bean id="marshaller"
                class="org.springframework.oxm.castor.CastorMarshaller">
                        <property name="mappingLocation"
value="castor-mapping.xml" />
        </bean> 
        
        <bean id="webServiceClient"
                class=" finance.util.WebServiceClient">
                <property name="defaultUri"
        
value="/FinanceSystemsOSB/FinanceProxyService" />
                <property name="marshaller" ref="marshaller" />
                <property name="unmarshaller" ref="marshaller" />
        </bean> 


Java WebServiceClient:


        /**
         * Sends the message to the Finance Mediator Located on the OSB.
         * @param request
         * @return
         */
        public FinanceMediatorResponse doExecute(FinanceMediatorRequest
request) {
                return (FinanceMediatorResponse)
getWebServiceTemplate().marshalSendAndReceive(request);
        }

Castor mapping:

        <!-- 
                This is the declaration of the Finance Mediator request
object
        -->
        <class name="finance.util.FinanceMediatorRequest">
                <map-to xml="FinanceMediatorInput" ns-prefix="inp1"
ns-uri="http://www.suny.edu"/>
                <field name="contract" >
                        <bind-xml name="SUNY-CONTRACT-DOCUMENT"
node="element" type="string"/>
                </field>
                <field name="docType">
                        <bind-xml name="DocType" node="element"
type="String"/>
                </field>                
        </class>
        <!-- 
                This is the declaration of the Finance Mediator response
object
        -->
        <class name="finance.util.FinanceMediatorResponse">
                <map-to xml="FinanceMediatorOutput" ns-prefix="out"
ns-uri="http://www.suny.edu"/>
                <field name="contract" container="true">
                        <bind-xml name="SUNY-CONTRACT-DOCUMENT"
node="element" type="string" />
                </field>
                <field name="docType">
                        <bind-xml name="DocType" node="element"
type="String"/>
                </field>        
        </class>
        <!-- 
                This is the declaration of the suny contract object
        -->
        <class name="finance.procurement.dto.SunyContractDTO"
extends="finance.common.dto.BaseDTO" >
                <map-to xml="SUNY-CONTRACT-DOCUMENT"
ns-uri="/xsd/procurement/document/contract/" ns-prefix="con"/>
                <field name="id" type="integer" >
                        <bind-xml name="IDENTIFIER" node="element"
type="integer"/>
                </field>
                <field name="documentNumber" type="string">
                        <bind-xml name="CONTRACT-NUMBER" node="element"
type="string"/>
                </field>
        </class>

Resulting XML:

        <message>
                <properties>
                        <property  name="tracking.compositeInstanceId"
value="60036"/>
                        <property  name="tracking.ecid"
value="11d1def534ea1be0:-72b2844e:1318f710609:-8000-000000000003ebe3"/>
                        <property  name="transport.http.remoteAddress"
value="127.0.0.1"/>
                </properties>
                <parts>
                        <part  name="request">
                                <inp1:FinanceMediatorInput>
                                        <con:SUNY-CONTRACT-DOCUMENT>
        
<ns1:CONTRACT-NUMBER>T080511</ns1:CONTRACT-NUMBER>
                                        </con:SUNY-CONTRACT-DOCUMENT>
                                        <inp1:DocType>CT</inp1:DocType>
                                </inp1:FinanceMediatorInput>
                        </part>
                </parts>
        </message>

XSD Snippit:

  Mediator:
   <?xml version="1.0" encoding="UTF-8" ?>
   <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:fm="http://www.suny.edu"; targetNamespace="http://www.suny.edu";
     xmlns:contract="/xsd/procurement/document/contract/">
    <xsd:import namespace="/xsd/procurement/document/contract/"
 
schemaLocation="/xsd/procurement/document/contract/SunyContract.xsd"/>
    <xsd:element name="FinanceMediatorInput" type="fm:FinanceType"/>
    <xsd:element name="FinanceMediatorOutput" type="fm:FinanceType"/>
    <xsd:complexType name="FinanceType">
        <xsd:sequence>
            <xsd:element name="DocType">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">

                        <xsd:enumeration value="CT"/>
                        <xsd:enumeration value="PO"/>
                        <xsd:enumeration value="RQ"/>
                        <xsd:enumeration value="T"/>
                        <xsd:enumeration value="S"/>
                        <xsd:enumeration value="R"/>
                        <xsd:enumeration value="RE"/>
                    </xsd:restriction>
                </xsd:simpleType>

            </xsd:element>
            <xsd:element ref="contract:SUNY-CONTRACT-DOCUMENT"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:schema>

 Contract:
  <?xml version="1.0" encoding="UTF-8"?>
        <xsd:schema
        targetNamespace=" /xsd/procurement/document/contract/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema";
        xmlns:tns="/xsd/procurement/document/contract/"
        xmlns:base="/xsd/base/"
        xmlns:address="/xsd/address/"
        xmlns:campus="/xsd/campus/"
        xmlns:error="/xsd/error/"
        xmlns:version="/xsd/procurement/document/contract/version/"
        xmlns:vendor="/xsd/vendor/"
        xmlns:shipinfo="/xsd/shippinginfo"
        xmlns:commodity="/xsd/commodity">

         
      <xsd:element name="SUNY-CONTRACT-DOCUMENT">
                <xsd:complexType>
                        <xsd:all>
                                <xsd:element name="IDENTIFIER"
type="xsd:integer"
                                        nillable="true" />
                                <xsd:element name="CONTRACT-NUMBER"
type="base:DOCUMENT-NUMBER"
                                        nillable="false" />
                        </xsd:all>
                </xsd:complexType>
        </xsd:element>





We have chose to hide/localize namespaces for ease of the XSLT
transformations. But when castor marshalls these object even though the
XSD 
states that the prefixes should not be put on the children of the root
element they are being added. This throws the XSLT mappings off causing
empty 
Queries on the transformations. If anyone could shed some insight into
this or a workaround I would greatly appreciate it.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to