1 Reply Latest reply on Dec 19, 2012 1:00 PM by BKBK

    SOAP cfhttpparam header syntax

    totalpackage612

      I have been working for days trying to figure out this web service header issue.

       

       

      Format I need to send Header in:

       

      <soap:Header>
       <wsse:Security soap:mustUnderstand="1">
        <wsse:UsernameToken namespaces>
                  <wsse:Username>username</wsse:Username>
                  <wsse:Password Type="type info">password</wsse:Password>
                  <wsse:Nonce>nonce</wsse:Nonce>
                  <wsu:Created>date created</wsu:Created>
              </wsse:UsernameToken>
          <wsse:Security>
      </soap:Header>
      

       

       

      What I have

       

      <cfsavecontent variable="soapHeader">
          <cfoutput>
          <soap:Header>
              <wsse:Security soap:mustUnderstand="1">
                  <wsse:UsernameToken namespaces>
                      <wsse:Username>myUsername</wsse:Username>
                      <wsse:Password Type="type info">myPassword</wsse:Password>
                      <wsse:Nonce>blahblah</wsse:Nonce> 
                      <wsu:Created>2012-12-18</wsu:Created>
                  </wsse:UsernameToken>
              <wsse:Security>
          </soap:Header> 
          </cfoutput>
      </cfsavecontent>
      
      <cfhttp 
          method="post"
          url="https://Website.asmx?wsdl"
          result="httpResponse">
      
          <cfhttpparam
           type="header"
           name="Security"
              value="#trim( soapHeader )#"/> 
          <cfhttpparam
          type="body"
              value="#trim( soapBody )#"/>
      </cfhttp>
      

       

      It's connecting to the destination but my header syntax isn't correct. I feel like I should be using cfhttpparam's to include the header data, but I'm not sure of the syntax I should be using there.  Because in the 'Format I need to send Header in' it's written like 'wsse:Security' and within that 'wsse:UsernameToken namespaces'.

       

      How do I format my httpparams to include my fields correctly?

      I tried :

      cfhttpparam      type="header"      name="Security:UsernameToken"

      But it didn't work.

       

      Any help would be appreciated.

      Thank you.