When 5.5 came out, we were excited about its built in ws feature. That
lasted about a week. I spent a month or so, working out the best and
most efficient method for webservices in witango. I made a simple
template, that we used to make hundreds of webservices, all of them in
production in heavy load environments. This method is careful not to
use looping to generate xml. You can download the template, and a
document explaining my methodologies at:
http://www.bighead.net/tools/download.taf
Here is the meat of it:
<@assign local$outstyle '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform
">
<xsl:output method="xml" encoding="ISO-8859-1" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>'>
<@assign local$tempstyle '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform
">
<xsl:output method="xml" omit-xml-declaration ="yes" indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
<xsl:template match="event">
<xsl:for-each select="//event/Row">
<event>
<xsl:attribute name="rowid">
<xsl:value-of select="@id" />
</xsl:attribute>
<xsl:copy-of select="./*" />
</event>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>'>
<@comment>
The tempstyle above, and the local array to convert to dom needs to be
changed to match the name you want for Node name for your data.
</@comment>
<@assign local$labServiceInclusions <@var local$resultSet>>
<@arraytodom array=local$labServiceInclusions>
<@assign local$thexml <@dom '<EPXSWServiceResponse />'>>
<@dominsert local$thexml xpath="/EPXSWServiceResponse"
position=append><success>1</success></@dominsert>
<@dominsert local$thexml xpath="/EPXSWServiceResponse"
position=append><reason><@literal "Authorization Successful."
encoding=cdata></reason></@dominsert>
<@dominsert local$thexml xpath="/EPXSWServiceResponse"
position=append><status>1</status></@dominsert>
<@dominsert local$thexml xpath="/EPXSWServiceResponse"
position=append><rowCount><@numrows array=local$resultSet></rowCount></
@dominsert>
<@dominsert local$thexml xpath="/EPXSWServiceResponse"><@replace
str='<@xslt local$labServiceInclusions stylesheet="<@var local
$tempstyle>">' findstr='<\?.+\?>' replacestr='' type=regex></@dominsert>
<@! output of xslt is string, so it applies xslt and outputs as text >
<@assign local$result '<@xslt local$thexml stylesheet="<@var local
$outstyle>">'>
<@assign local$cLen <@length "<@var local$result>">>
<@assign local$httpResponse "false">
Then the next acction is the header, but notice the response variable
above, this must be set to false.
<@purgeresults><@assign local$httpHeader "HTTP/1.1 200
OK<@crlf>Server: WiTango 5.5.009<@crlf>MIME-Version: 1.0<@crlf>Content-
Type: text/xml;charset=utf-8<@crlf>Content-length: <@var local
$cLen><@crlf>X-Timer: <@timer><@CRLF><@CRLF>">
Then finally, return the data:
<@var local$result encoding=none>
We have a few old clients still running like this, but all the heavy
hitting ws's are now in php. But I can tell you the above worked, and
worked well, AS LONG AS you had no high byte characters in your xml
data.
NOTE: the template you download from my site, uses UTF-8 declaration,
but should be the above, ISO-8859-1. No matter what, you can't get
witango 5.5 to properly output UTF-8.
--
Robert Garcia
President - BigHead Technology
VP Application Development - eventpix.com
13653 West Park Dr
Magalia, Ca 95954
ph: 530.645.4040 x222 fax: 530.645.4040
[EMAIL PROTECTED] - [EMAIL PROTECTED]
http://bighead.net/ - http://eventpix.com/
On Mar 5, 2008, at 3:20 AM, Dale Graham wrote:
I have been using various tools (SOAPclient and HTTPtester) and
here's what I am getting
Request is OK, as follows
User-Agent: Mac OS X; WebServicesCore.framework (1.0.0)
Content-Type: text/xml
Soapaction: http://localhost/nees.wws
Host: localhost
But **response** is in error, sending back Content-Type: text/html
instead of text/xml
HTTP/1.1 200 OK
Connection: close
Server: Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.7l DAV/2
Content-Type: text/html
Date: Wed, 05 Mar 2008 11:15:54 GMT
Set-Cookie: Witango_UserReference=F4E923AA5841685247CE80EA; path=/
Transfer-Encoding: Identity
What I can't figure out is how to set up Witango (and/or Apache
2.2.6) to send back the RESPONSE to a .wws call as XML
The WSDL file starts out with
<?xml version="1.0" encoding="UTF-8" ?>
so I presumed that would be enough
I tried to add content-type headers for the tcfs providing the data,
but that corrupted the process
I experimented with the mime.types but only succeeded in killing all
webservices
Any ideas or solutions?
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf