Friday, April 4, 2014

How To Add Soap Header Message To WSDL

Let's modify the wsdl generated here to include header message. To do this, we define an element, named requestHeader. Eg.
We create a wsdl complex data type for this element, with two parameters, username and password as shown below;


We add the new element and the complex type definition to the wsdl <type> tag, within the <schema> tag. Eg

We also defined the data or interface for our requestHeader via the <message>
   tag. Eg;






We add this data definition to the message part of the wsdl file; eg

Next, we define <soap:header> tag for our requestHeader type eg.


Finally, we add this tag as part of the input for the boom() and getDate() operations immediately after within the <binding> tag. Eg





This is all we need to add header message to our WSDL. The complete wsdl file is shown below.

You can check out the updated server example that handles the soap header request.



Did you find this tutorial useful? Kindly share your comments.


COMPLETE WSDL FILE :

4 comments:

  1. Hi !
    The link to the complete wsdl file is invalid, he is linked to your local computer.
    Is it possible to have the good one ?
    Thanks

    ReplyDelete
  2. Hello Anonymous,
    The wsdl file has been added to the tutorial page.

    Thanks for stopping by.

    ReplyDelete
  3. Hi,
    Opening tag (on line 68) porttype and closing tag (on line 77) portType are not same, PHP SOAPServer is giving error.
    Thank you for the useful post.

    ReplyDelete
    Replies
    1. Thanks for the observation. It should be portType too on line 68. The WSDL file has been updated.

      Delete

Related Posts Plugin for WordPress, Blogger...