Jay-
That sounds like you've got your work cut out for you. A few caveats
before we go much further. I'm not sure how the various namespaces are
going to interact (do you have namespace processing turned on? do you
have validation turned on?). And I'm not sure how dynamic some of those
element names are... Will GET__CompIntfc__RC_CASE_SW_CIResponse ever
change?
If we can get past those issues, here's what I would do: In the mapping
file, I would declare USiPeopleSoftCase to map-to Envelope (or the
namespace qualified version, I'm not sure which would work). Then, in
the bind-xml elements, I would add the attribute
location="Body/GET__CompIntfc__RC_CASE_SW_CIResponse". That way Castor
will create a USiPeopleSoftCase object when it sees the Envelope root
element, and it will look within the nested elements for the fields.
The SOAP format is a little uglier than anything I've dealt with myself,
but I have played games similar to this before. Good luck, and let us
know how it goes.
Stephen
Stuart, Jay Cameron wrote:
Unfortunately I cannot use axis to handle the soap interaction because the
geniuses at PeopleSoft set the method to have approximately 300 parameters. It
seems Java has a limit on method parameters of about 250 (what were they thinking
:) ) This being the case I had to code the Soap interactions manually. That being
said I wanted to create an object based on the
GET__CompIntfc__RC_CASE_SW_CIResponse node but it(castor) wanted me to use the
root element. From what Stephen was saying, I guess I can map my class to the
root element and then somhow go the two levels down
(body->GET__CompIntfc__RC_CASE_SW_CIResponse) to get the elements I need? The
work around I used so far was to use dom4j and extract the node I needed then pipe
that into castor. If I can eliminate that extra step, that would be ideal.
-- Jay
-----Original Message-----
From: Werner Guttmann [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 25, 2006 9:12 AM
To: [email protected]
Subject: RE: [castor-user] FW: problem unmarshaling data
Stephen et alias,
I am still puzzled as to why Stuart has a requirement to unmarshal the complete
SOAP message envelop. Afair, Castor can be quite tightly integrated with Axis
in the way that Castor will be used as (De)Serializer from within Axis. In this
context, Axis will be taking care of handling with the SOAP artefacts, whereas
Castor's responsibility will be to deal with (de)serializing (akak
(un)marshalling)) the SOAP payload.
Just my 0.02 cents
Werner
-----Original Message-----
From: Stephen Bash [mailto:[EMAIL PROTECTED]
Sent: Mittwoch, 25. Jänner 2006 15:05
To: [email protected]
Subject: Re: [castor-user] FW: problem unmarshaling data
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/oa
sis/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]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the
following address:
[EMAIL PROTECTED]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------