You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Pratik Datta <pr...@peregrine.com> on 2002/04/24 22:47:18 UTC
Exception in parsing xsi types with a Body only Message style ser
vice in axis Beta1
I have created a message style service, in which I have implemented the
function
public Document processRequest(MessageContext msgContext, Document
inputDoc)
It all works fine, unless I have xsi:type in the document. In that case it
says undeclared prefix "xsi". I did some digging around and saw that it is
putting the xmlns:xsi declaration at each element level rather than at the
top.
E.g. for this input SOAP message
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://tempuri.org/"
xmlns:types="http://tempuri.org/encodedTypes"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<q1:OpCreate xmlns:q1="urn:EVOLUTION:WSForm1">
<Assigned_To xsi:type="xsd:string">Demo</Assigned_To>
<Short_Description xsi:type="xsd:string">Hello</Short_Description>
<Status xmlns:q2="urn:EVOLUTION:WSFormRpcEnc"
xsi:type="q2:StatusType">Assigned</Status>
<Submitter xsi:type="xsd:string">Pratik</Submitter>
</q1:OpCreate>
</soap:Body>
</soap:Envelope>
It extracts the SOAP body element into this:
<q1:OpCreate xmlns:q1="urn:EVOLUTION:WSForm1">
<Assigned_To xsi:type="xsd:string"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Demo</Assigned_To>
<Short_Description xsi:type="xsd:string"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Hello</Short_Descripti
on>
<Status xsi:type="q2:StatusType" xmlns:q2="urn:EVOLUTION:WSFormRpcEnc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Assigned</Status>
<Submitter xsi:type="xsd:string"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Pratik</Submitter>
</q1:OpCreate>
Notice how the xmlns:xsi declaration is present in each element, rather than
at the OpCreate level. Crimson parser doesn't like this and throws an
exception:
Error: URI=null Line=2: Undeclared prefix: "xsi:type".
at org.apache.axis.utils.XMLUtils$ParserErrorHandler.error(Unknown Source)
at org.apache.crimson.parser.Parser2.error(Parser2.java:3018)
at org.apache.crimson.parser.Parser2.processName(Parser2.java:1581)
at org.apache.crimson.parser.Parser2.processAttributeNS(Parser2.java:1553)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1410)
at org.apache.crimson.parser.Parser2.content(Parser2.java:1700)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1468)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:499)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:304)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
at
org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:1
79)
at org.apache.axis.utils.XMLUtils.newDocument(Unknown Source)
at org.apache.axis.message.MessageElement.getAsDocument(Unknown Source)
at org.apache.axis.message.MessageElement.getAsDOM(Unknown Source)
at org.apache.axis.providers.java.MsgProvider.processMessage(Unknown Source)
at org.apache.axis.providers.java.JavaProvider.invoke(Unknown Source)
at org.apache.axis.strategies.InvocationStrategy.visit(Unknown Source)
at org.apache.axis.SimpleChain.doVisiting(Unknown Source)
at org.apache.axis.SimpleChain.invoke(Unknown Source)
at org.apache.axis.server.AxisServer.invoke(Unknown Source)
at org.apache.axis.transport.http.AxisServlet.doPost(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.newatlanta.servletexec.ServletExec.CallServletService(ServletExec.java:1
582)
at
com.newatlanta.servletexec.SERequestDispatcher.forwardServlet(SERequestDispa
tcher.java:212)
at
com.newatlanta.servletexec.SERequestDispatcher.forward(SERequestDispatcher.j
ava:134)
at
com.newatlanta.servletexec.ApplicationInfo.processApplRequest(ApplicationInf
o.java:1016)
at
com.newatlanta.servletexec.ServerHostInfo.processApplRequest(ServerHostInfo.
java:817)
at
com.newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.java:1116)
at
com.newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.java:995)
Is this something that will fixed soon?
As a workaround I am using a full message service instead of a body only
service, and then extract out the soap body element myself.
Pratik