1

Does anyone see why this SOAP Request would return a 500 Internal Server Error? If I just pull out the payload test and run it in SOAP UI I get a correct response?

<script language="javascript" runat="server">
Platform.Load('core', '1');
var username = 'xxxxx';
var password = 'xxxxx';
var payload = '';
var endpoint = "https://webservice.s7.exacttarget.com/Service.asmx";
var result;

payload += '<?xml version="1.0" encoding="utf-8"?>';
payload += '<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">';
payload += '   <soapenv:Header>';
payload += '      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">';
payload += '         <wsse:UsernameToken wsu:Id="UsernameToken-32259181" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">';
payload += '            <wsse:Username>' + username + '</wsse:Username>';
payload += '            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">' + password + '</wsse:Password>';
payload += '         </wsse:UsernameToken>';
payload += '      </wsse:Security>';
payload += '   </soapenv:Header>';
payload += '   <soapenv:Body>';
payload += '        <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">';
payload += '            <RetrieveRequest>';                     
payload += '                <ObjectType>Automation</ObjectType>';
payload += '                <Properties>ProgramID</Properties>';
payload += '                <Properties>CustomerKey</Properties>';
payload += '                <Properties>Status</Properties>';
payload += '                <Filter xsi:type="SimpleFilterPart">';
payload += '                    <Property>CustomerKey</Property>';
payload += '                    <SimpleOperator>equals</SimpleOperator>';
payload += '                    <Value>17148d1e-827e-6d58-b037-194b9e13a2b1</Value>';
payload += '                </Filter>';
payload += '            </RetrieveRequest>';
payload += '        </RetrieveRequestMsg>';
payload += '   </soapenv:Body>';
payload += '</soapenv:Envelope>';

try {
    result = HTTP.Post(endpoint,"text/xml",payload,null,null);
} catch(e) { 
    result = {StatusCode:500,Response:Stringify(e)};
}

if (result.StatusCode != 200) {
    //Bad response
    Write(Stringify(result));
} else {
    //Good response
    Write(Stringify(result));
}
</script>

Here's the error I get:

{"message":"An error occurred when attempting to evaluate a HTTPPost   function call. See inner exception for details.","description":"ExactTarget.OMM.FunctionExecutionException: An error occurred when attempting to evaluate a HTTPPost function call. See inner exception for details.\r\n Error Code: OMM_FUNC_EXEC_ERROR\r\n - from Jint --> \r\n\r\n --- inner exception 1---\r\n\r\nSystem.Net.WebException: The remote server returned an error: (500) Internal Server Error. - from System\r\n\r\n\r\n\r\n"}
2

You need to specify the SOAPAction in the header of your SOAP request.

Change the line:

result = HTTP.Post(endpoint,"text/xml",payload,null,null);

To:

result = HTTP.Post(endpoint,"text/xml",payload,["SOAPAction"],["Retrieve"]);
| improve this answer | |

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.