Jay-
Without running your example and doing some debugging, I'm not certain
what the problem is, but I'll take a guess... I don't think Castor can
ignore the root element. Looking at your example, if you were able to
create some sort of mapping for the root element (Envelope I guess), and
then use location attributes to specify where the fields you are
interested reside, you can probably get Castor to unmarshal this
example. Since the two fields you are interested in reside in the
USiPeopleSoftCase class (while it wouldn't make a lot of sense to
someone reading the mapping file) you could make things work by mapping
that class to Envelope.
Hope the gets you somewhere at least close to the right track...
Stephen
Stuart, Jay Cameron wrote:
I am having an issue trying to unmarshal some SOAP data from an XML
file. So far I have created a mapping file and I have set the
setIgnoreExtraElements to true. I am getting the following error: "The
class for the root element 'Envelope' could not be found."
Here is the xml:
<?xml version="1.0"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<GET__CompIntfc__RC_CASE_SW_CIResponse xmlns="http://psfttemp.org">
<MARKET_0>GBL</MARKET_0>
<EXTENSION/>
<RC_BU_DESCR>Enterprise Resource Planning</RC_BU_DESCR>
<BO_ID>100063040</BO_ID>
<ROLE_TYPE_ID>8</ROLE_TYPE_ID>
</GET__CompIntfc__RC_CASE_SW_CIResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
My mapping file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<mapping>
<class name="net.usi.oasis.crm.Case.USiPeopleSoftCase"
auto-complete="true">
<description>Default mapping for class
net.usi.oasis.crm.Case.USiPeopleSoftCase</description>
<map-to xml="USiPeopleSoftCase"/>
<field name="caseID" type="integer" required="true"
direct="false" transient="false">
<bind-xml name="BO_ID" node="element" reference="false"/>
</field>
<field name="customerRoleTypeID" type="integer" required="true"
direct="false" transient="false">
<bind-xml name="ROLE_TYPE_ID" node="element" reference="false"/>
</field>
</class>
</mapping>
and my code is as follows:
mapping.loadMapping(
"C:/development/java/USiMaven/ps_case/src/main/java/net/usi/oasis/crm/USiPeopleSoftMap.xml"
);
Unmarshaller unmar = new Unmarshaller(mapping);
unmar.setIgnoreExtraElements(true);
unmar.setValidation(false);
retCase = (IntCase)unmar.unmarshal(new
InputSource(element.asXML()));
I am not sure why I am getting this error. Any help would be greatly
appreciated....
Jay Stuart
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------