HTTP Outbound Adapter and ContentType

85 views
Skip to first unread message

Newt

unread,
Nov 12, 2010, 9:08:03 AM11/12/10
to InterSystems: Ensemble in Healthcare
I'm trying send an XML message to a website (I tried using SOAP, but
that didn't appear to work).

I have the XML correct (as far as I can tell), and I've got the
outbound adapter set OK (again as far as I can tell).

The only part that doesn't work is the ContentType is going out at
text/html, but needs to be text/xml. How do I change the content type?

I can see that there is a property called SkipBodyAttrs, that prevents
copying of parameters to the Header, but I'm not sure what I should be
setting and where in order to get data to the header. Does anyone have
an example?


Dale du Preez

unread,
Nov 12, 2010, 9:17:43 AM11/12/10
to ensemble-in...@googlegroups.com
Hi Newt,

Have you tried using the SendFormDataArray method directly in the
EnsLib.HTTP.OutboundAdapter class? It allows you to set properties of
the %Net.HttpRequest instance that gets used to actually send the data
to the far end.

I am not sure whether this approach will get you the correct payload
format, however. It might be worth contacting the WRC to work through
the problems you saw with the actual SOAP classes -- the SOAP framework
is really flexible and handles a very wide range of options.

I hope that helps,
Dale

Newt

unread,
Nov 12, 2010, 9:51:37 AM11/12/10
to InterSystems: Ensemble in Healthcare
Hi Dale,

I started to drill down through the class, and realised that I could
use the SendFormDataArray directly.

I was a bit surprised that the SOAP classes didn't work.

If I chose to go down the current route, would I just do something
like

set HTTPReq = ##class(%Net.HttpRequest).%New()

set HTTPReq .ContentType = "text/xml"

and then

set tsc
= ..Adapter.SendFormDataArray(.pResponse,"POST",HTTPReq,,pRequest.xml)

to send the request?

Regards,

N.

Dale du Preez

unread,
Nov 12, 2010, 10:05:35 AM11/12/10
to ensemble-in...@googlegroups.com
Hi Newt,

That should get the data sent in the way you'd like. Depending on the
version of SOAP in use (it's most likely 1.1, but could be 1.2), you may
need to make further changes to the HTTP headers. I seem to recall SOAP
1.2 requiring at least one header specific to the standard, but I may be
wrong on that.

If you are moving towards writing your own XML, it may be worth
investigating the use of the %SOAP.WebRequest class, which takes care of
some of these issues for you. Admittedly, this won't necessarily make
use of the Ensemble adapters, but could be easier to implement overall.

I hope that helps,
Dale

Reply all
Reply to author
Forward
0 new messages