Attributes are mapped to properties. The wrapped style doesn't permit attributes at the top level (no complex content in the wrapper element). The wrapper element must be defined as a type comprising a sequence of elements. But these elements within the wrapper element may contain attributes.
In a situation where you require attributes at the top level, then you must use either "document" style or "message" style. With "document" style, Axis maps the entire contents of the SOAP body to a Java object. With "message" style, Axis maps the contents to a DOM. Anne -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, October 01, 2004 7:49 PM To: [EMAIL PROTECTED] Subject: RE: RPC vs. building your own SOAP messages Ok, that makes sense. And Axis' "wrapped" style will support nested tags by creating nested Java objects? If so, how does it handle attributes that are on tags? Like: <member type="1"> <name> <firstname>john</firstname> <lastname> doe</name> </name> <age>24</age> </member> I would imagine that the "wrapped" style would create a Member object that has an age, but also contains a Name object. And then the Name object contains the firstname and lastname. But, how would it represent the "type=1" in the java objects? (Assuming I'm right about how it would represent the nested objects.) Thank you for your help! Axis is very exciting... I wish I had converted over sooner. -Raiden Johnson On Fri, 1 Oct 2004, Anne Thomas Manes wrote: > As a rule of thumb, you should use the Axis "wrapped" style. (Sometimes you > can't, but the example you cite below is fine.) The "wrapped" generates > document/literal messages, and it manages the message building process for > you. Axis automatically maps the XML message to Java objects based on the > schema of the message. When developing a "wrapped" style service, you should > start by defining the XML schema of your input and output messages. > > Anne > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Friday, October 01, 2004 10:39 AM > To: [EMAIL PROTECTED] > Subject: RPC vs. building your own SOAP messages > > Hello, > > I am having a hard time grasping when to use RPC calls and when to build > your own messages. I used to use Apache SOAP, and I used to build my own > SOAP message via JAXM. > > However, I am now trying to upgrade to AXIS, and to make full use of its > feature set... which seems to have a huge emphasis on using RPC, and > seems to abstract out message building. > > Every guide and tutorial that I have read seems to revolve around RPC, and > how easy it is to implement in AXIS. I can see the benefits of RPC for > simple calls (pass in a few arguments, get back a single result... even > if the result is a complex type). RPC seems great for that. > > However, I need to pass much more complex messages, and receive much more > complex results. Does that mean that RPC is not the best solution for me? > > For example, here is a typical message that I will send to a SOAP server: > > <soap-env:Envelope > xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> > <soap-env:Header> > <t:Transaction xmlns:t="xxs"> > <iden u="user" p="password"/> > </t:Transaction> > </soap-env:Header> > <soap-env:Body> > <ns1:ProviderTransaction xmlns:ns1="xxs"> > <REQ> > <action entryDate="20040919">1</action> > <memberInfo nvid="1234567"> > <externalID>4001775</externalID> > <name><first>Maggie</first><last>Duke</last></name> > <companyName/> > <address>123 Test St.</address> > <address2/> > <city>City</city> > <state>CT</state> > <country>US</country> > <postalCode>06524</postalCode> > <email>[EMAIL PROTECTED]</email> > <ssn></ssn> > </memberInfo> > <orderInfo> > <effectiveDate>20040928</effectiveDate> > <items count="2"> > <item><itc>2973</itc><qty>1</qty><pc>Y</pc></item> > <item><itc>1234</itc><qty>1</qty><pc>Y</pc></item> > </items> > </orderInfo> > </REQ> > </ns1:ProviderTransaction> > </soap-env:Body>< > /soap-env:Envelope> > > > and here is a typical response: > > > <SOAP-ENV:Envelope > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > xmlns:xsd="http://www.w3.org/1999/XMLSchema/" > xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance/"> > <SOAP-ENV:Header> > <t:Transaction xmlns:t="xxs" /> > </SOAP-ENV:Header> > <SOAP-ENV:Body> > <ns1:ProviderTransaction xmlns:ns1="xxs"> > <RSP> > <responseNode> > <nvid new="1">863262802</nvid> > <orderNumber>9136214</orderNumber> > <asOrderNumber>961704</asOrderNumber> > </responseNode> > </RSP> > </ns1:ProviderTransaction> > </SOAP-ENV:Body> > </SOAP-ENV:Envelope> > > > Are complex SOAP packets like these not appropriate for RPC? It seems to > me, like you really need to build your own requests, and parse your own > responses to make something like this work. Am I correct in that? > > Thank you, > -Raiden Johnson >
