Hey there,
I can have a HTTP Post request working perfectly fine with the tool Postman, although after mirgrating it over too Knime, I no longer get a valid return value.
Instead of the return body being XML and returning the 125709 characters as promised in the header, I instead recieve a binary body with just the value "?".
Has anyone encountered this before?
In case it helps, this is ulitizing the Salesforce Marketing Cloud SOAP API via POST request and see below some example headers.
Request Headers:
Content-Type → text/xml
SOAPAction → Retrieve
Return Headers:
Status → 200
content-encoding → UTF-8
Cache-Control → private, max-age=0
Connection → close
Content-Length → 125709
Content-Type → application/soap+xml; charset=utf-8
Date → Wed, 23 Nov 2016 07:27:20 GMT
Server → Microsoft-IIS/7.5
X-AspNet-Version → 4.0.30319
X-Powered-By → ASP.NET
thor
November 23, 2016, 11:15am
2
"?" stands for a missing value. Either the request was not successful or it could not be converted into XML. Are there any warning/error messages? You should also extract all reponse headers into columns and check whether they match the ones from Postman.
Response gets a lovely "200" success status code and no errors in Knime.
The response headers are 100% identical in both tools.
See an example of the XML response below:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/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">
<env:Header xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<wsa:Action>RetrieveResponse</wsa:Action>
<wsa:MessageID>urn:uuid:f64b8450-6e7d-4e6e-bhec-9725686338cb</wsa:MessageID>
<wsa:RelatesTo>urn:uuid:ed46ef87b-7dc5-4407-af13-81e23421c1d1</wsa:RelatesTo>
<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
<wsse:Security>
<wsu:Timestamp wsu:Id="Timestamp-ae35dc1d-e7f5-493e-d915-3h840414581e">
<wsu:Created>2016-11-23T13:52:19Z</wsu:Created>
<wsu:Expires>2016-11-23T13:57:19Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</env:Header>
<soap:Body>
<RetrieveResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<OverallStatus>OK</OverallStatus>
<RequestID>f8a5238d-ba9e-4d5d-8322-04a34685bd94</RequestID>
<Results xsi:type="SentEvent">
<Client>
<ID>123123</ID>
</Client>
<PartnerKey xsi:nil="true" />
<PartnerProperties>
<Name>ListID</Name>
<Value>15231</Value>
</PartnerProperties>
<ObjectID xsi:nil="true" />
<SendID>15356043</SendID>
<SubscriberKey>123123</SubscriberKey>
<EventDate>2016-10-21T09:43:00.853</EventDate>
<EventType>Sent</EventType>
<TriggeredSendDefinitionObjectID />
<BatchID>1</BatchID>
</Results>
<Results xsi:type="SentEvent">
<Client>
<ID>123123</ID>
</Client>
<PartnerKey xsi:nil="true" />
<PartnerProperties>
<Name>ListID</Name>
<Value>15231</Value>
</PartnerProperties>
<ObjectID xsi:nil="true" />
<SendID>15356043</SendID>
<SubscriberKey>123123</SubscriberKey>
<EventDate>2016-10-21T09:43:00.853</EventDate>
<EventType>Sent</EventType>
<TriggeredSendDefinitionObjectID />
<BatchID>1</BatchID>
</Results>
<Results xsi:type="SentEvent">
<Client>
<ID>123123</ID>
</Client>
<PartnerKey xsi:nil="true" />
<PartnerProperties>
<Name>ListID</Name>
<Value>15231</Value>
</PartnerProperties>
<ObjectID xsi:nil="true" />
<SendID>15356043</SendID>
<SubscriberKey>123123</SubscriberKey>
<EventDate>2016-10-21T09:43:00.853</EventDate>
<EventType>Sent</EventType>
<TriggeredSendDefinitionObjectID />
<BatchID>1</BatchID>
</Results>
</RetrieveResponseMsg>
</soap:Body>
</soap:Envelope>
thor
November 23, 2016, 6:32pm
4
I just tried with a faked service and everything works as expected, see attached screenshot. The content type isn't recognized as XML therefore it's read as binary data. However, you can use the Binary Object to Strings node and then String to XML if you want to have it as real XML.
Thank you for the continued swift responses :)
Although now I'm even more confused. See below two screenshots of what I see as a response:
Screenshot 1
Screenshot 2
Is there something more fundamental that I'm missing perhaps? Some sort of settings / preference?
thor
November 23, 2016, 10:24pm
6
Why do you have to different content-type columns in your output table. Is it possible for me to test this web service?
Not too sure why there is two cotent-type columns actually, Postman only pulls back one.
Just noticed I get a similar scenerio with a failed requests, so yes, I suppose you could.
The only difference with this scenerio is Knime's output is now considered XML, although the value is still "?". Screenshot.
Postman Example:
Header:
POST /Service.asmx HTTP/1.1
Host: webservice.exacttarget.com
Content-Type: text/xml
SOAPAction: Retrieve
Body:
<?xml version="1.0" encoding="UTF-8"?>
http://www.w3.org/2003/05/soap-envelope " xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing " xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd ">
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd " s:mustUnderstand="1">
http://www.w3.org/2001/XMLSchema " xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance ">
http://exacttarget.com/wsdl/partnerAPI ">
true
SentEvent
Client.ID
TriggeredSendDefinitionObjectID
SendID
SubscriberKey
EventDate
EventType
BatchID
ListID
Return Header:
Cache-Control → private
Connection → close
Content-Length → 1348
Content-Type → text/xml; charset=utf-8
Date → Thu, 24 Nov 2016 07:36:07 GMT
Server → Microsoft-IIS/7.5
X-AspNet-Version → 4.0.30319
X-Powered-By → ASP.NET
Return Body:
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 ">
http://schemas.xmlsoap.org/ws/2004/08/addressing/fault
urn:uuid:d7f659b2-8f2c-43ba-b0f3-c1f912f6662e
urn:uuid:3c9cfb2e-05ef-409c-87f5-646267cc1435
http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
2016-11-24T07:36:07Z
2016-11-24T07:41:07Z
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">q0:InvalidSecurityToken
An invalid security token was provided
https://webservice.exacttarget.com/Service.asmx
thor
November 24, 2016, 11:11am
8
I tried your example and it works for me as expected, see the attached workflow.
Works perfectly, Thank you Thor!
The only difference is I included the request body via the "Constant body" within the POST Request node iteself.
Is that an expected behaviour for the request to react differently depending on source of input?
Either way, lesson learnt, happy it works and thank you again.
thor
November 24, 2016, 1:10pm
10
Hm, it also works with a constant body for me, see the attached workflow. Can you post your workflow that doesn't work (including data)?
Must be something my side then, as I literally just reset and then excuted your attachment and was provided with the same error.
Before
After
Using Knime Analytics Platform 3.2.1