Monday, 24 November 2014

How to define XML namespaces to be incuded in the header of XML request which will be send via invoke of a Web Service call?



I have developed a C# Class in VS 2012 from which I have to call (consume) through https, a remote web service method. I have already apply code to create custom headers for security tag, however I must apply in the root a declaration of namespace like


xmlns:ns1="http://ift.tt/LRW8Ij"


The complete XML request that must be send through web service method invoke will be ( and has been tested successfully with SOAP UI ) as of the following :



<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://ift.tt/sVJIaE"
xmlns:xsi="http://ift.tt/ra1lAU"
xmlns:xsd="http://ift.tt/tphNwY" xmlns:ns1="http://ift.tt/LRW8Ij">
<env:Header>
<ns1:Security>
<ns1:UsernameToken>
<ns1:Username>XXXXXXXXXXXXXXXXXXXX</ns1:Username>
<ns1:Password>ZZZZZZZZZZZZZZZZZZZZ</ns1:Password>
</ns1:UsernameToken>
</ns1:Security>
</env:Header>
<env:Body>
<ns:vhWsVersion/>
</env:Body>
</env:Envelope>


for this, to work the namespace


xmlns:ns1="http://ift.tt/LRW8Ij"


must be include via the invoke of web service method.


Any assistance of how to achieve this is kindly appreciated


Thanx J.


No comments:

Post a Comment