<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../../web/sc2html.xsl" title="scenario"?>
<scenario xmlns="http://www.wstf.org">

 <metadata>
  <number>sc002</number>
  <title>Notify-Echo</title>
  <date>2008/11/03</date>
  <status>Published</status>
 </metadata>

 <abstract>
  This scenario is meant to serve several purposes:
  <item>
   As the first scenario done by the WSTF, it will test the processes
   and infrastructure of the WSTF initiative
  </item>
  <item>
   Test some very basic Web Service operations that can be used to
   build a set of regression tests for the WSTF set of scenarios
  </item>
  <item>
   Provide a baseline set of messages/operations that can then be used
   in subsequent, more complex, scenarios 
  </item>
  <p/>
  This scenario will make use of two operations: Notify and Echo.<br/>
  Notify will be a one-way operation, while Echo will be a two-way
  (request/response) operation. While only support for SOAP (v1.1 and v1.2) will be
  required, implementations may also choose to expose WSDL describing their
  endpoints. Sample WSDL is included below.
  <p/>
  Other operations are defined as part of this scenario but are not necessary
  for the tests themselves.  They are defined within this document to provide
  a full set of common operations that might be needed for future WSTF
  scenarios.
 </abstract>

 <section title="Dependencies">
  <scope>
   <technology name="SOAP 1.1" url="http://www.w3.org/TR/2000/NOTE-SOAP-20000508/"/>
   <technology name="SOAP 1.2" url="http://www.w3.org/TR/soap12-part1/"/>
  </scope>

  <namespaces>
   <namespace prefix="s" ns="(Either SOAP 1.1 or 1.2)"
                         name="(Either SOAP 1.1 or 1.2)"/>
   <namespace prefix="s11" ns="http://schemas.xmlsoap.org/soap/envelope/"
                           name="SOAP 1.1"/>
   <namespace prefix="s12" ns="http://www.w3.org/2003/05/soap-envelope"
                           name="SOAP 1.2"/>
   <namespace prefix="xs" ns="http://www.w3.org/2001/XMLSchema"
                           name="XML Schema"/>
   <namespace prefix="sc002" ns="http://www.wstf.org/docs/scenarios/sc002"
                           name="SC002 (this scenario)"/>
  </namespaces>

  <subheading title="Preconditions">
   The client must know the address of the service endpoint and whether it 
   supports SOAP 1.1 or SOAP 1.2. How it determines this is out of scope 
   for the scenario, but the most common mechanism will be through 
   examination of the list of endpoints provided with the scenario. In 
   subsequent, more advanced scenarios, it is expected that WSDL and 
   Policy will play a role in determining this type of information.
  </subheading>

  <!--
  <terms>
   <term term="addressable client">A client that..."</term>
   <term term="requset">A message that..."</term>
  </terms>
  -->

 </section>

 <section title="Scenario Description">
  In general this scenario involves the client sending a series of
  <code>Notify</code>
  and <code>Echo</code> messages to the service. The number of messages and
  types of messages may vary.
  <p/>
  Both <code>Notify</code> and <code>Echo</code> include two parameters, 
  '<code>ID</code>' and '<code>text</code>'. The '<code>ID</code>' parameter
  is a unique identifier that groups a series of messages together.
  The service is expected to concatenate all of the '<code>text</code>' values
  received for each '<code>ID</code>' - however, since <code>Notify</code> is a
  one-way operation, only <code>Echo</code> will return the value of this concatenation
  back to the client.
  <p/>
  When using HTTP as the transport, each non-faulting <code>Notify</code>
  should return an "HTTP 202 Accept" without any content. Each non-faulting
  <code>Echo</code> should return an "HTTP 200 OK" with the
  <code>EchoResponse</code> message as its content on the transport
  back-channel. In the faulting case, for the Notify operation the client
  should not expect to see any response at all - not even for SOAP processing
  faults. For the Echo operation an "HTTP 500 Internal
  Server Error" should be returned with the SOAP Fault in the content.
  <p/>
  The service is expected to maintain the state of the concatenated '<code>text</code>'
  values for each '<code>ID</code>' for a reasonable amount of time -
  e.g. 10 minutes since the last message for any particular '<code>ID</code>'.
  After that time it is free to reclaim any resources associated with that
  '<code>ID</code>'.
 </section>

 <section title="Scenario Details">
  This scenario defines the following operations:

  <operation name="Notify">
   A one-way operation with the following outline:

   <exemplar type="Request">
    <action>http://www.wstf.org/docs/scenarios/sc002/Notify</action>
    <headers>&lt;sc002:SessionData>
 &lt;sc002:ID> TestClient-1 &lt;/sc002:ID>
&lt;/sc002:SessionData></headers>
    <body>&lt;sc002:Notify>
 &lt;sc002:text> Hello World &lt;sc002:text>
&lt;/sc002:Notify></body>
   </exemplar>

   <note>
    Has two pieces of data:
    <note>
     <code>ID</code>:<br/>
     a string representing a unique identifier used to group
     a series of <code>Notify</code> and <code>Echo</code> messages.
    </note>
    <note>
     <code>text</code>: <br/>
     a string of the client's choosing.
    </note>
   </note>
   <note>
    All calls to <code>Notify</code> and <code>Echo</code> will concatenate the 
    '<code>text</code>' values for matching <code>ID</code>s.
   </note>
   <note>
    An empty string or "fault" for the '<code>text</code>' parameter must
    cause the service to generate a fault.
   </note>
  </operation>

  <operation name="Echo">
   A two-way operation with the following outline:

   <exemplar type="Request">
    <action>http://www.wstf.org/docs/scenarios/sc002/Echo</action>
    <headers>&lt;sc002:SessionData>
 &lt;sc002:ID> TestClient-1 &lt;/sc002:ID>
&lt;/sc002:SessionData></headers>
    <body>&lt;sc002:Echo>
 &lt;sc002:text> Hello World &lt;sc002:text>
&lt;/sc002:Echo></body>
   </exemplar>

   <exemplar type="Response">
    <action>http://www.wstf.org/docs/scenarios/sc002/EchoResponse</action>
    <body>&lt;sc002:EchoResponse>
 &lt;sc002:text> Hello World &lt;sc002:text>
&lt;/sc002:EchoResponse></body>
   </exemplar>

   <note>
    Has two pieces of data:
    <note>
     <code>ID</code>:<br/>
     a string representing a unique identifier used to group
     a series of <code>Notify</code> and <code>Echo</code> messages.
    </note>
    <note>
     <code>text</code>: <br/>
     a string of the client's choosing.
    </note>
   </note>
   <note>
    All calls to <code>Notify</code> and <code>Echo</code> will concatenate the 
    '<code>text</code>' values for matching <code>ID</code>'s.
   </note>
   <note>
    An empty string or "fault" for the '<code>text</code>' parameter must
    cause the service to generate a fault.
   </note>
  </operation>

  <p/>
  Note: leading and trailing spaces in the '<code>text</code>' parameter will
  be ignored. While this scenario does not require the use of higher-level
  WS specifications (such as WS-Addressing), it is designed such that
  additional scenarios can built upon this scenario to add-in, and test,
  those more advanced features.
  <p/>

  <subheading title="Success Criteria">
   Overall success criteria will be determined as follows:
   <item>
    Upon receipt of the <code>Notify</code> message, the service will
    return an HTTP response code indicating the message was delivered.
    Due to there being a variety of possible HTTP response codes
    the exact value may vary.  For example, a value of 200 or 202 is
    a clear indication of success.  Whether other values indicate
    success or not will depend on the client implementation.
    In many cases a value of 404 (Not Found) would be an error that
    would be returned back to the application.  However, another
    implementation, that takes a much more strict view on the
    fire-n-forget aspect of one-way messages, may view a 404 as
    a success.
   </item>
   <item>
    Upon receipt of the <code>Echo</code> message, the service will
    return a string whose value will be the concatenation of all
    <code>Notify</code> and <code>Echo</code>
    '<code>text</code>' values that also included the same
    '<code>ID</code>'.
   </item>
   <item>
    Upon receipt of a <code>Notify</code> or <code>Echo</code> message
    whose '<code>text</code>' value is '<code>fault</code>', or an
    empty string, the service will generate a Fault. For
    <code>Echo</code> requests, the service will return the SOAP Fault
    message in the entity-body of the HTTP response. The details of
    this fault message are defined by the <code>wsdl:fault</code>
    element named '<code>InvalidInputFault</code>' in the <a
    href="#sec5">WSDL</a> for this scenario. Examples of SOAP 1.1 and
    SOAP 1.2 Fault responses can be found in the <a
    href="#sec7">Sample Messages</a> section.
   </item>
   <item>
    Per Basic Profile 1.2 R1127, a service must not rely on the value of
    the SOAPAction HTTP header field. So, a service must not generate a fault
    due to the lack of this header on a SOAP 1.1 <code>Notify</code> or 
    <code>Echo</code> message.
   </item>
   <item>
    Per Basic Profile 2.0 R2757, a service must not
    require the presence of the 'action' parameter on the Content-Type
    HTTP header field. So, a service must not generate a fault
    due to the lack of an 'action' parameter on a
    SOAP 1.2 <code>Notify</code> or <code>Echo</code>
    message.
   </item>
   <item>
    In the Notify case, MustUnderstand and VersionMismatch faults must
    be generated but, due to the fire-n-forget nature of one-way messages,
    the service is not required to transmit the these faults back to the
    client.  Therefore, simply returning an HTTP response code of 202
    is all that is expected.  If the service chooses to return the
    MustUnderstand or VersionMismatch faults, that is acceptable as well.
   </item>
  </subheading>
 </section>


 <section title="Tests">
  The specific tests for this scenario are broken up into two.
  The first set focuses on testing from an end-user's point of view - one
  where all they want to do is send a Notify or Echo and are not concerned
  with the SOAP aspects of the test. The second set of tests focus on
  a low-level testing of SOAP itself. These tests will be more explicit
  about the SOAP features being tested, and would typically not be of
  concern for an end-user but would be of interest to SOAP stack implementers.

  <part title="Simple Notify/Echo">
   <subheading title="Notify">
    The Notify operation will have two variants in this part of the scenario.
    The following table summarizes the tests and the expected results.

    <tests>
     <test name="Notify">
      <desc>Client sends the Notify message</desc>
      <succ>
        Service responds with an HTTP 202.<br/>
        See 'Success Criteria' section for other possible responses.
      </succ>
     </test>
     <test name="Faulting Notify">
      <desc>Client sends a faulting Notify message</desc>
      <succ>
        Service responds with an HTTP 202.<br/>
        See 'Success Criteria' section for other possible responses.
      </succ>     
     </test>
    </tests>
   </subheading>

   <subheading title="Echo">
    The Echo operation will have several variants.
    The following table summarizes the tests and the expected results.
     
    <tests>
     <test name="Echo">
      <desc>Client sends the Echo message</desc>
      <succ>
       Service responds with the appropriate EchoResponse on the
       HTTP back-channel
      </succ>
     </test>
     <test name="Faulting Echo">
      <desc>Client sends a faulting Echo message</desc>
      <succ>Service responds with a fault on the HTTP back-channel</succ>
     </test>
    </tests>
   </subheading>
  </part>

  <part title="Advanced Notify/Echo">
   The following test will focus on interoperability testing of SOAP from 
   a lower technical point of view.

   <tests>
    <test name="Notify+mU">
     <desc>
      Client sends the Notify message with an unknown SOAP Header with 
      the mustUnderstand flag set to 'true'.
     </desc>
     <succ>
       Service responds with an HTTP 202.<br/>
       See 'Success Criteria' section for other possible responses.
     </succ>    
    </test>
    <test name="Faulting Notify+mU">
     <desc>
      Client sends a faulting Notify message and an unknown SOAP Header 
      with the mustUnderstand flag set to 'true'
     </desc>
     <succ>
       Service responds with an HTTP 202.<br/>
       See 'Success Criteria' section for other possible responses.
     </succ> 
    </test>
    <test name="Echo+mU">
     <desc>
      Client sends the Echo message with an unknown SOAP Header with the 
      mustUnderstand flag set to 'true'
     </desc>
     <succ>
      Service responds with a mustUnderstand fault on the HTTP back-channel
     </succ>
    </test>
    <test name="Faulting Echo+mU">
     <desc>
      Client sends a faulting Echo message and an unknown SOAP Header with 
      the mustUnderstand flag set to 'true'
     </desc>
     <succ>
      Service responds with a mustUnderstand fault on the HTTP back-channel
     </succ>
    </test>
   </tests>
  </part>
 </section>

 <section title="WSDL">
  Implementers of this scenario are not required to use WSDL
  but if they choose to do so it is included here for reference.
  It can also be found at:
  <a href="http://www.wstf.org/docs/scenarios/sc002/sc002.wsdl">
   http://www.wstf.org/docs/scenarios/sc002/sc002.wsdl</a>.
  <populate url="sc002.wsdl"/>
 </section>

 <section title="Schema">
  For reference, the associated XSD (
  <a href="http://www.wstf.org/docs/scenarios/sc002/sc002.xsd">
   http://www.wstf.org/docs/scenarios/sc002/sc002.xsd</a>) is:
  <populate url="sc002.xsd"/>
 </section>

 <section title="Sample Messages">
  <subsection title="Exchange #1">
   <xml title="Request">&lt;soap:Envelope ...>
 &lt;soap:Header>
  &lt;sc002:SessionData>
   &lt;sc002:ID> Client-1 &lt;/sc002:ID>
  &lt;/sc002:SessionData>
 &lt;/soap:Header>
 &lt;soap:Body>
  &lt;sc002:Notify>
   &lt;sc002:text>Hello&lt;/sc002:text>
  &lt;/sc002:Notify>
 &lt;/soap:Body>
&lt;/soap:Envelope></xml>
   <xml title="Response">202 Accept</xml>
  </subsection>

  <subsection title="Exchange #2">
   <xml title="Request">&lt;soap:Envelope ...>
 &lt;soap:Header>
  &lt;sc002:SessionData>
   &lt;sc002:ID> Client-1 &lt;/sc002:ID>
  &lt;/sc002:SessionData>
 &lt;/soap:Header>
 &lt;soap:Body>
  &lt;sc002:Echo>
   &lt;sc002:text>-World&lt;/sc002:text>
  &lt;/sc002:Echo>
 &lt;/soap:Body>
&lt;/soap:Envelope></xml>
   <xml title="Response">200 OK
&lt;soap:Envelope ...>
 &lt;soap:Header>
 &lt;/soap:Header>
 &lt;soap:Body>
  &lt;sc002:EchoResponse>
   &lt;sc002:text>Hello-World&lt;/sc002:text>
  &lt;/sc002:EchoResponse>
 &lt;/soap:Body>
&lt;/soap:Envelope></xml>
  </subsection>

  <subsection title="SOAP 1.1 Faulting Echo">
    <xml title="Request">
&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:sc002="http://www.wstf.org/docs/scenarios/sc002"&gt;
   &lt;soap:Header&gt;
      &lt;sc002:SessionData&gt;
         &lt;sc002:ID&gt; Client-1 &lt;/sc002:ID&gt;
      &lt;/sc002:SessionData&gt;
   &lt;/soap:Header&gt;
   &lt;soap:Body&gt;
      &lt;sc002:Echo&gt;
         &lt;sc002:text&gt;fault&lt;/sc002:text&gt;
      &lt;/sc002:Echo&gt;
   &lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;
    </xml>
    <xml title="Response">
&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
   &lt;soap:Body&gt;
      &lt;soap:Fault&gt;
         &lt;faultcode&gt;soap:Server&lt;/faultcode&gt;
         &lt;faultstring&gt;invalid input: "fault"&lt;/faultstring&gt;
         &lt;detail&gt;
            &lt;sc002:InvalidInput xmlns:sc002="http://www.wstf.org/docs/scenarios/sc002"/&gt;
         &lt;/detail&gt;
      &lt;/soap:Fault&gt;
   &lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;
    </xml>
  </subsection>

  <subsection title="SOAP 1.2 Faulting Echo">
    <xml title="Request">
&lt;soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
               xmlns:sc002="http://www.wstf.org/docs/scenarios/sc002"&gt;
   &lt;soap:Header&gt;
      &lt;sc002:SessionData&gt;
         &lt;sc002:ID&gt; Client-1 &lt;/sc002:ID&gt;
      &lt;/sc002:SessionData&gt;
   &lt;/soap:Header&gt;
   &lt;soap:Body&gt;
      &lt;sc002:Echo&gt;
         &lt;sc002:text&gt;fault&lt;/sc002:text&gt;
      &lt;/sc002:Echo&gt;
   &lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;
    </xml>
    <xml title="Response">
&lt;soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"&gt;
   &lt;soap:Body&gt;
      &lt;soap:Fault&gt;
         &lt;soap:Code&gt;
            &lt;soap:Value&gt;soap:Receiver&lt;/soap:Value&gt;
         &lt;/soap:Code&gt;
         &lt;soap:Reason&gt;
            &lt;soap:Text&gt;invalid input: "fault"&lt;/soap:Text&gt;
         &lt;/soap:Reason&gt;
         &lt;soap:Detail&gt;
            &lt;sc002:InvalidInput xmlns:sc002="http://www.wstf.org/docs/scenarios/sc002"/&gt;
         &lt;/soap:Detail&gt;
      &lt;/soap:Fault&gt;
   &lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;
    </xml>
  </subsection>
 </section>

 <section title="Findings">
   <num>
     This scenario exposed some ambiguity about what is expected when
     a fault is generated for one-way operations. The consensus of the
     group is that one-way messages should be treated as fire-n-forget
     messages.  This means that the sending application should not
     expect to see any faults.
     <p/>
     That being said, it is recommended that a SOAP processor at least
     return MustUnderstand and VersionMismatch faults if possible and
     regardless of the message exchange pattern being used.  This allows
     the sender to be aware of such critical errors.  However, as stated
     in the previous paragraph, the sender should not rely on other
     implementations to follow this recommendation.
     <p/>
   </num>
   <num>
     This scenario includes the use of both SOAP 1.1 and SOAP 1.2; the
     WSDL for this scenario defines a service that includes a SOAP 1.1
     port and a SOAP 1.1 port. However, it is not clear is whether or
     not a service that implements two ports shares state between the
     implementations of those ports. For example, if you send a Notify
     message for session 'A' to the soap11port will a subsequent Echo
     for session 'A', when sent to the soap12port, result in an
     EchoResponse that contains the data from the first Notify? This
     is considered to be important because of the following use case:
     Suppose there is an organization that, for the usual reasons, has
     built and deployed a number of services using SOAP 1.1. Further
     suppose that this organization has made the strategic decision to
     standardize on the use of SOAP 1.2. As part of the migration
     strategy there will be a period of time in which all new services
     will be required to support both SOAP 1.1 (to support the older
     clients) and SOAP 1.2 (to support the newer clients). Clearly it
     is important that any service supporting "dual-mode" ports share
     any state changes resulting from the messages sent to either
     port. It must be possible to implement a "single service" that
     can be interacted with using either SOAP 1.1 or SOAP 1.2.
     <p/>
     Note that there are no existing WSDL constructs or
     WS-Policy-based assertions for indicating whether or not two
     ports share state. Some people may feel that, because the two
     ports are grouped together under a common service, that shared
     state is implied. However, the WSDL 1.1 specification is not
     explicit about this behavior, say merely "Each port provides
     semantically equivalent behavior". Neither does the Basic Profile
     provide any guidance on this subject.
     <p/>
     For the purposes of this scenario implementers are free to share
     state or not share state between their SOAP 1.1 and SOAP 1.2
     ports (assuming they implement both ports). It is recommended
     that any descriptions provided by implementers should note
     whether or not state is shared. Further extensions of this
     scenario may be devised to test the ability of implementations to
     share state between two ports.
     <p/>
   </num>
   <num>
   It was found that certain WSDL to Java tools generated incorrect artifacts
   due to the lower case binding names. The lower case names mapped to lower case
   classes in Java. Java typically uses upper case class names are standard practice.
   In some cases this lower case class names did deploy correctly.
   It either is possible to map the lower case binding names to upper case
   class names using a custom name file before generating these artifacts, or simply 
   capitalize the binding names in the WSDL.
   </num>
 </section>

 <section title="Change History">
  <changes>
   <change date="2007/10/07" who="Doug Davis">Initial Draft</change>
   <change date="2007/10/09" who="Doug Davis">
    Added WSDL and some additional 'scenario details'
   </change>
   <change date="2007/11/13" who="Doug Davis">
    s/groupID/appID/<br/>
    Added some text about WS-Addressing
   </change>
   <change date="2007/12/04" who="Doug Davis">
    Pull out xsd from wsdl<br/>
    Make sure the namespace and URLs are .../docs/scenarios/sc002...
   </change>
   <change date="2007/12/10" who="Doug Davis">
    Moved the appID to a SessionData header<br/>
    Misc cleanup
   </change>
   <change date="2008/01/15" who="Doug Davis">
    Use absolute, instead of relative, path for css/js files
   </change>
   <change date="2008/02/28" who="Doug Davis">
    Be more explicit about the various tests people should run.
    Add a comment about how mU faults are not required to be returned
    for one-ways.
   </change>
   <change date="2008/06/28" who="Doug Davis">
    Converted to XML.
   </change>
   <change date="2008/09/11" who="Gilbert Pilz">
    Add finding on sharing state between SOAP 1.1 and SOAP 1.2 ports.
   </change>
   <change date="2008/10/20" who="Doug Davis">
    Minor typos
   </change>
   <change date="2008/10/20" who="Doug Davis">
    Minor tweaks/edits
   </change>
   <change date="2009/05/22" who="Gilbert Pilz">
    Minor edits to Success Criteria section.
   </change>
   <change date="2009/07/01" who="Gilbert Pilz">
    Clarify expected behavior for application-level faults.
    Remove Begin, End, and SendMessages operations as the new test infrastructure has made
    them redundant.
   </change>
  </changes>
 </section>

</scenario>
