10

This question is regarding using the ExactTarget SOAP API. I am trying to use the SOAP envelope sample given in http://help.exacttarget.com/en/technical_library/web_service_guide/technical_articles/creating_an_email_via_the_web_service_api/ I replaced the USERNAME & PASSWORD fields with appropriate values and modified the reference to http://exacttarget.com/wsdl/partnerAPI to the S1 endpoint link https://webservice.exacttarget.com/Service.asmx. When I post the SOAP envelope using the Chrome plug-in POSTMAN, I get a response back with a Soap:Fault that reads

WSE012: The input was not a valid SOAP message because the following information is missing: action

What does this error signify and how do I correct this and proceed? I am using POSTMAN to test the flow before I code the process in nodes.js

Here is the SOAP packet (As I said earlier, the USERNAME & PASSWORD have been replaced with my credentials and reference to "http://exacttarget.com/wsdl/partnerAPI" has been changed to https://webservice.exacttarget.com/Service.asmx. I took this SOAP Packet from the sample given on the example). I am doing the POST to https://webservice.exacttarget.com/Service.asmx

<SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">   
    <SOAP-ENV:Header>
        <wsse:Security 
            xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
            xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                <wsse:UsernameToken>
                    <wsse:Username>USERNAME</wsse:Username>
                    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PASSWORD</wsse:Password>
                    <wsu:Created>2008-07-02T13:01:11Z</wsu:Created>
                </wsse:UsernameToken>
        </wsse:Security>    
    </SOAP-ENV:Header>    
    <SOAP-ENV:Body>
       <CreateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
            <Options/>
            <Objects xsi:type="Email">
                <ObjectID xsi:nil="true"/>
                <Name>Text Only in API</Name>
                <Description>Description</Description>
                <TextBody>Example email body for an email that is text only</TextBody>
                <Subject>Example Subject</Subject>
                <EmailType>Text Only</EmailType>
                <IsHTMLPaste>True</IsHTMLPaste>
            </Objects>
        </CreateRequest>    
    </SOAP-ENV:Body> 
</SOAP-ENV:Envelope>
  • 1
    Can you share the basic HTTP and SOAP message you're sending so we can help troubleshoot? – Mike Chale Jan 21 '14 at 17:44
12

POSTMAN is not sending any headers with the SOAP Packet. Try adding this to test:

POST https://webservice.exacttarget.com/Service.asmx HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "Create"
Content-Length: 1925
Host: webservice.exacttarget.com
Connection: Keep-Alive

ALSO during my testing of your packet I found that this:

<IsHTMLPaste>True</IsHTMLPaste>

Should be

<IsHTMLPaste>true</IsHTMLPaste>

Hope this helps you.

  • 2
    When I add the <wsa:Action>Create</wsa:Action> entry in the header and POST, I get a Bad Request as the response. BTW, I get the same Bad Request response, when I POST the sample SOAP packet given in help.exacttarget.com/en/technical_library/web_service_guide/… Can anyone post a valid SOAP packet? – user5336 Jan 21 '14 at 20:01
  • 1
    Do you have the full response SOAP packet? – Kelly J Andrews Jan 21 '14 at 20:51
  • 2
    After adding the SOAPAction to the header & changing the value of the IsHTMLPaste to true (from True), I am now able to POST the SOAP envelope successfully – user5336 Jan 23 '14 at 16:52
  • 1
    Awesome. Make sure you mark the question answered as well. – Kelly J Andrews Jan 23 '14 at 17:58
  • 1
    How do I mark the question answered. Also, I found the Sample SOAP envelope in help.exacttarget.com/en/technical_library/web_service_guide/… is missing the closing tag for <soap:Envelope. That is why, when you POST, you get a Bad Request Response. – user5336 Jan 23 '14 at 21:17
4

The action can be specified 2 different ways: in the header of the SOAP envelope or in the HTTP header.

If you want to pass it in the SOAP header, you will need to include the Action/MessageID/ReplyTo/To tags like this example:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <soap:Header>
      <wsa:Action>Create</wsa:Action>
      <wsa:MessageID>urn:uuid:491bf8a1-ac2b-4fe4-9f1c-56e45c9e497a</wsa:MessageID>
      <wsa:ReplyTo>
         <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
      </wsa:ReplyTo>
      <wsa:To>https://webservice.exacttarget.com/Service.asmx</wsa:To>
      <wsse:Security soap:mustUnderstand="1">
         <wsse:UsernameToken wsu:Id="SecurityToken-6421ac0b-a454-42a3-99f7-a77ace024446">
            <wsse:Username>ccc</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">ccc</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>
   </soap:Header>
   <soap:Body>
      <CreateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <!-- Removed for example -->
      </CreateRequest>
   </soap:Body>
</soap:Envelope>

Alternatively, it can be passed in the HTTP Header, an example working header for a Create call looks like:

POST https://webservice.exacttarget.com/Service.asmx HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "Create"
Content-Length: 1925
Host: webservice.exacttarget.com
Connection: Keep-Alive

I would recommend checking out SoapUI(www.soapui.org) as it makes testing SOAP envelopes a bit easier as it will automatically build out the HTTP header, also provides formatting a validation based on the WSDL.

  • 1
    I tested in Soap UI and the true error popped up. That explains the error in the database, it's not being passed with postman. – Kelly J Andrews Jan 21 '14 at 23:48
  • It appears that for passing the action in the header of the SOAP envelope only To element will be required. The MessageID and ReplyTo are not mandatory. – Vlad Apr 7 '18 at 16:14
0

I had this specific issue when trying to add a column to SFMC via the SOAP API. Same issues - Bad request when I added the standard action tag, and soap telling me I needed an action when I pasted the code from SFMC's help page verbatim. Specifically, I was trying to solve the problem of fixing it within Postman for automation purposes.

I've added this answer because I've not had any luck with adding the ReplyTo & To fields to enable an Action to be used in the Payload. The Bad Payload issue went away, but SFMC wasn't updating to show that there were new columns. I can confirm that the method below will add columns.

Bad Request

WSE012: The input was not a valid SOAP message because the following information is missing: action.

Thanks to the peeps above for the help. It looks like if you're creating a new column to an existing DE you only need to call out the action in the header:

What the help page tells you to do:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
    <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
        <wsse:UsernameToken wsu:Id="UsernameToken-5501096" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsse:Username>XXX</wsse:Username> 
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">XXX</wsse:Password> 
        </wsse:UsernameToken>
    </wsse:Security>
</soapenv:Header>
<soapenv:Body>
    <UpdateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
        <Options /> 
        <Objects xsi:type="ns1:DataExtension" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
            <CustomerKey>8533EC32-5E12-4599-B279-0369EFCB38E3</CustomerKey> 
            <Fields>
                <Field>
                    <Name>New Field</Name> 
                    <MaxLength>200</MaxLength> 
                    <IsRequired>true</IsRequired> 
                </Field>
            </Fields>
        </Objects>
    </UpdateRequest>
</soapenv:Body>

What you need to add to make the call valid:

URL: https://webservice.exacttarget.com/Service.asmx

In Postman's Headers, create a the folowing Key:value

SOAPAction: Update

(You're using update because you're adding a column to an existing DE)

Body:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
        <fueloauth xmlns="http://exacttarget.com">{{accessToken}}</fueloauth>
    </soapenv:Header>
    <soapenv:Body>
        <UpdateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
            <Options /> 
            <Objects xsi:type="ns1:DataExtension" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
                <CustomerKey>EXTERNAL_KEY</CustomerKey> 
                <Fields>
                    <Field>
                        <Name>HarroSquirrel5</Name> 
                        <MaxLength>200</MaxLength> 
                        <IsRequired>false</IsRequired> 
                    </Field>
                </Fields>
            </Objects>
        </UpdateRequest>
    </soapenv:Body>
</soapenv:Envelope>

Hopefully this helps someone out there! I've been pulling my hair out all day with this sucker!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.