Webservice request soap Header

One of the examples I have seen in the post is below, why
SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/ is defined at three places 1) at envlope level, header lever,Security level?

Can’t we have wemthods to use one at envelope level??
Actually its causing problems to my client server side?


<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><wsse:Security xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" SOAP-ENV:mustUnderstand="1">
<wsu:Timestamp wsu:Id="foo_id_1">
<wsse:UsernameToken wsu:Id="foo_id_2">
<wsse:Password wsse:Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password123</wsse:Password>

Just change the sample code. Don’t blame me if it doesn’t work for you, I spent an entire 15 minutes on it.

sorry, I am not blaming you at all, some reason webmethods generates a soap header just like you mentioned , since it has duplicate name spaces , my client is having problmes with it. How much complicated it is inside webmethods to fix the soap header message? Thats my question…

The header containing the username token contains the mustUnderstand attribute which must be namespace-qualified with the soap envelope namespace. The sample uses the “SOAP-ENV” prefix to do this when creating an XML string from the document holding the token.

If you want to use a different prefix, just change it.

Again, this is a sample, don’t just blindly copy it into your application and expect it to work for your project-specific needs. Dig into it, understand how it works and then create your own utility service to do what you need.


Thank you Mark.