[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: JLDAP's DSML Reader In-compatible with JNDI's dsmlv2 provider?
Here is the problem and solution:
The problem is that the jndi provider supplies a namespace for dsml,
but not se causing crimson to crash. As the namespace is ignored in
the DSMLReader, namespace validation can be turned off. This causes
the tag name to include the prefix. To compensate for this, in
startElement and endElement add the following code:
//this allows for namespace prefix's to be present but ignored
int colonIndex = strQName.indexOf(':');
if (colonIndex != -1) {
strSName = strQName.substring(colonIndex + 1);
strQName = strSName;
}
else {
strSName = strQName;
}
to trim off the prefix if it's there.
This brought me to another problem, I am trying to write a search
response by creating an LDAPEntry object then writing it using the
writeEntry method, but this isn't creating the searchResponse tags. I
tried writing "new LDAPRespone(LDAPMessage.SEARCH_RESPONSE)" but this
causes a NullPointerException:
java.lang.NullPointerException
at com.novell.ldap.rfc2251.RfcLDAPMessage.getType(Unknown Source)
at com.novell.ldap.LDAPMessage.getType(Unknown Source)
at com.novell.ldap.LDAPResponse.getType(Unknown Source)
at
com.octetstring.vde.dsmlv2.jldap.DSMLWriter.writeMessage(DSMLWriter.java
:194)
at com.octetstring.vde.dsmlv2.ImportExport.doGet(ImportExport.java:212)
at
com.octetstring.vde.dsmlv2.ImportExport.process(ImportExport.java:113)
at com.octetstring.vde.dsmlv2.DsmlService.doPost(DsmlService.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:356)
at
org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplic
ationHandler.java:342)
at
com.octetstring.webgateway.filters.DOSFilter.doFilter(DOSFilter.java:
70)
at
org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplic
ationHandler.java:334)
at
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationH
andler.java:286)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
567)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1808)
at
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationCon
text.java:525)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1758)
at org.mortbay.http.HttpServer.service(HttpServer.java:879)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:952)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:
197)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:496)
Thanks for the help!
------------------------------------------------------------------------
---------------------------
Marc Boorshtein
Software Engineer, Octet String
marc.boorshtein@octetstring.com
(847)-466-1884
On Jan 6, 2004, at 9:28 PM, Marc Boorshtein wrote:
Just to add some followup, here is the xml being sent:
POST /services/dsmlv2/service HTTP/1.1
SOAPAction: "#batchRequest"
Content-Type: text/xml; charset="utf-8"
Content-Length: 463
Authorization: Basic Y249QWRtaW46bWFuYWdlcg==
User-Agent: Java/1.4.1_01
Host: 127.0.0.1
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
<se:Envelope>
<se:Body>
<dsml:batchRequest xmlns="urn:oasis:names:tc:DSML:2:0:core"
xmlns:dsml="urn:oasis:names:tc:DSML:2:0:core"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<dsml:searchRequest derefAliases="derefAlways"
dn="ou=peons,dc=idrs,dc=com" requestID="1" scope="singleLevel">
<dsml:filter>
<dsml:present name="objectclass"/>
</dsml:filter>
</dsml:searchRequest>
</dsml:batchRequest>
</se:Body></se:Envelope>
The stack trace:
[2004-01-06 21:25:48,443] ERROR - DsmlService: Could not parse dsml
[PoolThread-1]
LDAPLocalException: The following error occured while parsing DSML:
org.xml.sax.SAXParseException: Undeclared prefix: "se:Envelope". (84)
Decoding Error
org.xml.sax.SAXParseException: Undeclared prefix: "se:Envelope".
at
com.octetstring.vde.dsmlv2.jldap.DSMLReader.<init>(DSMLReader.java:
130)
at
com.octetstring.vde.dsmlv2.jldap.DSMLReader.<init>(DSMLReader.java:83)
at com.octetstring.vde.dsmlv2.DsmlService.doPost(DsmlService.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:356)
at
org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebAppli
cationHandler.java:342)
at
com.octetstring.webgateway.filters.DOSFilter.doFilter(DOSFilter.java:
70)
at
org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebAppli
cationHandler.java:334)
at
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplication
Handler.java:286)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
567)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1808)
at
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationCo
ntext.java:525)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1758)
at org.mortbay.http.HttpServer.service(HttpServer.java:879)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:952)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:
197)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:496)
Caused by: org.xml.sax.SAXParseException: Undeclared prefix:
"se:Envelope".
at org.apache.crimson.parser.Parser2.error(Parser2.java:3160)
at org.apache.crimson.parser.Parser2.processName(Parser2.java:1660)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1487)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at
com.octetstring.vde.dsmlv2.jldap.DSMLReader.<init>(DSMLReader.java:
112)
... 20 more
On Jan 6, 2004, at 6:01 PM, Marc Boorshtein wrote:
Hello,
I am working with the DSMLv2 Reader and have found the following
issue with JNDI's dsmlv2 provider as a client:
The JNDI DSMLv2 provider uses "se" as a prefix for the soap
envelope's xml tags. The dsmlv2 reader generates an exception saying
it can't recognize the "se:Envelope" prefix. If i remove the "se",
it works. It also works if I remove the SOAP envelope entirely. I
looked at the dsmlv2 servlet in CVS and saw that it wasn't stripping
out the envelope before creating the reader. It appears that the
dsml reader will ignore the soap envelope as long as it doesn't have
a prefix.
----------------------------------------------------------------------
----------------------------
Marc Boorshtein
Software Engineer, Octet String
marc.boorshtein@octetstring.com