Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi guys.
im very new with window phone, and i want to call a webservice with a custom soap header.

my code:
C#
vtputil.UtilSoapClient util = new vtputil.UtilSoapClient();
using (new OperationContextScope(util.InnerChannel))
            {

                // Add a SOAP Header to an outgoing request
                MessageHeader aMessageHeader = MessageHeader.CreateHeader("ServiceAuthHeader", "http://viettelpost.org/", new vtputil.ServiceAuthHeader() { Token = "40872835345345D7A3DBEEC5213062F1" });
                OperationContext.Current.OutgoingMessageHeaders.Add(aMessageHeader);

                util.ListBKCompleted += BindDSBKCompleted;
                util.ListBKAsync("");

            }


use fiddler and i got this
XML
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <ServiceAuthHeader xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://viettelpost.org/">
         <Token xmlns="http://schemas.datacontract.org/2004/07/PanoramaApp1.vtputil">4087283037AAC3D7A3DBEEC5213062F1</Token>
      </ServiceAuthHeader>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <ListBK xmlns="http://viettelpost.org/">
         <FIND/>
      </ListBK>
   </s:Body>
</s:Envelope>

but what i expect is
XML
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:viet="http://viettelpost.org/"> 
   <s:Header>
      <ServiceAuthHeader xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://viettelpost.org/">
         <viet:Token xmlns="http://schemas.datacontract.org/2004/07/PanoramaApp1.vtputil">4087283037AAC3D7A3DBEEC5213062F1</viet:Token>
      </ServiceAuthHeader>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <ListBK xmlns="http://viettelpost.org/">
         <FIND/>
      </ListBK>
   </s:Body>
</s:Envelope>


difference is:
XML
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:viet="http://viettelpost.org/">

<Token xmlns="http://schemas.datacontract.org/2004/07/PanoramaApp1.vtputil">4087283037AAC3D7A3DBEEC5213062F1</Token>
<viet:Token xmlns="http://schemas.datacontract.org/2004/07/PanoramaApp1.vtputil">4087283037AAC3D7A3DBEEC5213062F1</viet:Token>



please help me T - T!
Posted
Updated 9-Nov-14 16:03pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900