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

Reply via email to