Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

SOAP cfhttpparam header syntax

New Here ,
Dec 19, 2012 Dec 19, 2012

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.

480
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2012 Dec 19, 2012
LATEST

<cfhttpparam type="header"> identifies a header to the web service. So you might be duplicating things when you use it to send <soap:Header> ...</soap:Header>. Try sending it as XML type, thus

<cfhttpparam

    type="xml"

    name="Security"

    value="#trim(soapHeader)#"/>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources