• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Mock exam question: SOAP doubt

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SOAP Message :
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
<soap:Body>
<p:Process xmlns:p='http://example.org/Operations'>
<m:Envelope xmlns:m='http://schemas.xmlsoap.org/soap/envelope/'>
.......
</m:Envelope>
</p:Process>
</soap:Body>
</soap:Envelope>
What is going to happen when a Web service (whose implementation conforms to WS-I Basic Profile 1.0a) receives the following SOAP message?
Ans:
  • Generate a fault for the SOAP Message
  • Process the message for the SOAP Message

  • What will be the answer?

    Actually I'm not sure whether a soap:Header or soap:Body can have child elements which belongs to this 'http://schemas.xmlsoap.org/soap/envelope/' namespace. Can we have an 'soap:Envelope' within 'soap:Body' or 'soap:Body' within another 'soap:Body'? Is there any restrictions on that? While searching BP rules, I only got this,
    R1003 A RECEIVER MUST accept fault messages that have any number of qualified or unqualified attributes, including zero, appearing on the detail element. The namespace of qualified attributes can be anything other than "http://schemas.xmlsoap.org/soap/envelope/".

    Is there any other restrictions like this? Please clarify.
     
    Ranch Hand
    Posts: 2198
    1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi!
    From the WS-I Basic Profile:

    R1009 An ENVELOPE MUST NOT contain Processing Instructions.


    The envelope you enclosed contains a processing instruction, thus a fault will be generated.
    Best wishes!

    Edit: This is wrong, see below!
     
    Ranch Hand
    Posts: 63
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Please, take a look at the correct example related to R1011:

    CORRECT:

    <soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' >
    <soap:Body>
    <p:Process xmlns:p='http://example.org/Operations' >
    <m:Data xmlns:m='http://example.org/information' >
    Here is some data with the message
    </m:Data>
    </p:Process>
    </soap:Body>
    </soap:Envelope>



    Best Regards
    Adam
     
    Ivan Krizsan
    Ranch Hand
    Posts: 2198
    1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi!
    I certainly was tricked! :-)
    XML processing instructions begin with <? and ends with ?>.
    Thus, in the question, there are no processing instructions.
    Reference: http://www.w3.org/TR/REC-xml/#sec-pi
    Best wishes!
     
    Asit Baran
    Greenhorn
    Posts: 25
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    So is the message valid?
    <soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
    <soap:Body>
    <p:Process xmlns:p='http://example.org/Operations'>
    <m:Envelope xmlns:m='http://schemas.xmlsoap.org/soap/envelope/'>
    ..............
    Will not this line[marked in bold] cause a problem? Can we have child elements under <soap:Body> which belongs to 'http://schemas.xmlsoap.org/soap/envelope/' namespace?

     
    Ivan Krizsan
    Ranch Hand
    Posts: 2198
    1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi again!
    I find this related to the SOAP Body and this question in the Basic Profile:


    R9981 An ENVELOPE MUST have exactly zero or one child elements of the soap:Body element.
    R1014 The children of the soap:Body element in an ENVELOPE MUST be namespace qualified.
    R2712 A document-literal binding MUST be serialized as an ENVELOPE with a soap:Body whose child element is an instance of the global element declaration referenced by the corresponding wsdl:message part.


    But I do not find anything saying that a child element of the SOAP Body cannot belong to the namespace of the SOAP Envelope.
    As far as I understand, you can declare the element being the contents of the SOAP Body to be a wrapper element that contains only an entry of anyType, which would allow the wrapper element to contain any legal XML contents, including other SOAP messages.
    Would be very interesting to hear if anyone finds anything that forbids usage such as this in the BP etc.
    Best wishes
     
    Blood pressure normal? What do I change to get "magnificent"? Maybe this tiny ad?
    We need your help - Coderanch server fundraiser
    https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
    reply
      Bookmark Topic Watch Topic
    • New Topic