You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by "nodep@libero.it" <no...@libero.it> on 2002/10/01 13:22:53 UTC
custom (de)serializer using JSX
Hi, I'm a student (University of Padova, Italy) and I would like to use
JSX for replace Apache-SOAP's serialization (version 2.3.1). I know
that I must write a custom serializer but I dont know how to bind it
with JSX (generic XML Serializer e.g.
http://www.csse.monash.edu.au/~bren/JSX/).
I tried and I wrote a marshall() method as:
public void marshall(String inScopeEncStyle, Class javaType,
Object src, Object context, Writer sink,
NSStack nsStack, XMLJavaMappingRegistry xjmr,
SOAPContext ctx)
throws IllegalArgumentException, IOException
{
if(!javaType.equals(DataFeedMessage.class)) {
throw new IllegalArgumentException(
"Can only serialize DataFeedMessage instances");
}
nsStack.pushScope();
if (src != null)
{
SoapEncUtils.generateStructureHeader(inScopeEncStyle,
javaType, context,
sink, nsStack, xjmr);
ObjOut out=new ObjOut(sink);
out.writeObject(src);
ObjOut out2=new ObjOut();
out2.writeObject(src);
sink.write("</" + context + '>');
}
else
{
SoapEncUtils.generateNullStructure(inScopeEncStyle,
javaType, context,
sink, nsStack, xjmr);
}
nsStack.popScope();
}
It's correct?
And ... how to write the unmarshall() method?
The problem is: it doesn't work. Although it send something like
this:
POST /soap/servlet/rpcrouter HTTP/1.0
Host: localhost:8080
Content-Type: text/xml; charset=utf-8
Content-Length: 837
SOAPAction: ""
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:sendMessage xmlns:ns1="urn:DataFeedService" SOAP-
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<msg xsi:type="ns1:DataFeedMessage">
<?jsx version="1"?>
<DataFeedMessage alias-ID="0">
<java.util.Hashtable alias-ID="1" obj-name="_fields">
<java.lang.String alias-ID="2" valueOf="REQUEST"/>
<java.lang.String alias-ID="3" valueOf="PRICE"/>
<java.lang.String alias-ID="4" valueOf="SYMBOL"/>
<java.lang.String alias-ID="5" valueOf="XYZ"/>
</java.util.Hashtable>
</DataFeedMessage>
</msg>
</ns1:sendMessage>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
(DataFeedMessage is the object i would to send)
But Tomcat (v4.0.4) reply with:
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=utf-8
Content-Length: 480
Date: Mon, 30 Sep 2002 18:00:05 GMT
Server: Java Web Services Developer Pack/1.0-ea1 (HTTP/1.1 Connector)
Set-Cookie: JSESSIONID=59FC124A77DF15420E03650C088E6259;Path=/soap
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server.Exception:</faultcode>
<faultstring>org/apache/soap/util/xml/Serializer</faultstring>
<faultactor>/soap/servlet/rpcrouter</faultactor>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I think the problem are the namespaces ... maybe.
Someone can helpme?
Thanks! :)
Stefano Pedon
Re: custom (de)serializer using JSX
Posted by Scott Nichol <sn...@scottnichol.com>.
If you want to use JSX to serialize and de-serialize, you will have to
define your own proprietary encodingStyle. The XML below generated by
JSX does not follow SOAP serialization.
Scott Nichol
----- Original Message -----
From: <no...@libero.it>
To: "soap-user" <so...@xml.apache.org>
Sent: Tuesday, October 01, 2002 7:22 AM
Subject: custom (de)serializer using JSX
Hi, I'm a student (University of Padova, Italy) and I would like to use
JSX for replace Apache-SOAP's serialization (version 2.3.1). I know
that I must write a custom serializer but I dont know how to bind it
with JSX (generic XML Serializer e.g.
http://www.csse.monash.edu.au/~bren/JSX/).
I tried and I wrote a marshall() method as:
public void marshall(String inScopeEncStyle, Class javaType,
Object src, Object context, Writer sink,
NSStack nsStack, XMLJavaMappingRegistry xjmr,
SOAPContext ctx)
throws IllegalArgumentException, IOException
{
if(!javaType.equals(DataFeedMessage.class)) {
throw new IllegalArgumentException(
"Can only serialize DataFeedMessage instances");
}
nsStack.pushScope();
if (src != null)
{
SoapEncUtils.generateStructureHeader(inScopeEncStyle,
javaType, context,
sink, nsStack, xjmr);
ObjOut out=new ObjOut(sink);
out.writeObject(src);
ObjOut out2=new ObjOut();
out2.writeObject(src);
sink.write("</" + context + '>');
}
else
{
SoapEncUtils.generateNullStructure(inScopeEncStyle,
javaType, context,
sink, nsStack, xjmr);
}
nsStack.popScope();
}
It's correct?
And ... how to write the unmarshall() method?
The problem is: it doesn't work. Although it send something like
this:
POST /soap/servlet/rpcrouter HTTP/1.0
Host: localhost:8080
Content-Type: text/xml; charset=utf-8
Content-Length: 837
SOAPAction: ""
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:sendMessage xmlns:ns1="urn:DataFeedService" SOAP-
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<msg xsi:type="ns1:DataFeedMessage">
<?jsx version="1"?>
<DataFeedMessage alias-ID="0">
<java.util.Hashtable alias-ID="1" obj-name="_fields">
<java.lang.String alias-ID="2" valueOf="REQUEST"/>
<java.lang.String alias-ID="3" valueOf="PRICE"/>
<java.lang.String alias-ID="4" valueOf="SYMBOL"/>
<java.lang.String alias-ID="5" valueOf="XYZ"/>
</java.util.Hashtable>
</DataFeedMessage>
</msg>
</ns1:sendMessage>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
(DataFeedMessage is the object i would to send)
But Tomcat (v4.0.4) reply with:
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=utf-8
Content-Length: 480
Date: Mon, 30 Sep 2002 18:00:05 GMT
Server: Java Web Services Developer Pack/1.0-ea1 (HTTP/1.1 Connector)
Set-Cookie: JSESSIONID=59FC124A77DF15420E03650C088E6259;Path=/soap
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server.Exception:</faultcode>
<faultstring>org/apache/soap/util/xml/Serializer</faultstring>
<faultactor>/soap/servlet/rpcrouter</faultactor>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I think the problem are the namespaces ... maybe.
Someone can helpme?
Thanks! :)
Stefano Pedon
--
To unsubscribe, e-mail: <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>
Re: custom (de)serializer using JSX
Posted by Scott Nichol <sn...@scottnichol.com>.
If you want to use JSX to serialize and de-serialize, you will have to
define your own proprietary encodingStyle. The XML below generated by
JSX does not follow SOAP serialization.
Scott Nichol
----- Original Message -----
From: <no...@libero.it>
To: "soap-user" <so...@xml.apache.org>
Sent: Tuesday, October 01, 2002 7:22 AM
Subject: custom (de)serializer using JSX
Hi, I'm a student (University of Padova, Italy) and I would like to use
JSX for replace Apache-SOAP's serialization (version 2.3.1). I know
that I must write a custom serializer but I dont know how to bind it
with JSX (generic XML Serializer e.g.
http://www.csse.monash.edu.au/~bren/JSX/).
I tried and I wrote a marshall() method as:
public void marshall(String inScopeEncStyle, Class javaType,
Object src, Object context, Writer sink,
NSStack nsStack, XMLJavaMappingRegistry xjmr,
SOAPContext ctx)
throws IllegalArgumentException, IOException
{
if(!javaType.equals(DataFeedMessage.class)) {
throw new IllegalArgumentException(
"Can only serialize DataFeedMessage instances");
}
nsStack.pushScope();
if (src != null)
{
SoapEncUtils.generateStructureHeader(inScopeEncStyle,
javaType, context,
sink, nsStack, xjmr);
ObjOut out=new ObjOut(sink);
out.writeObject(src);
ObjOut out2=new ObjOut();
out2.writeObject(src);
sink.write("</" + context + '>');
}
else
{
SoapEncUtils.generateNullStructure(inScopeEncStyle,
javaType, context,
sink, nsStack, xjmr);
}
nsStack.popScope();
}
It's correct?
And ... how to write the unmarshall() method?
The problem is: it doesn't work. Although it send something like
this:
POST /soap/servlet/rpcrouter HTTP/1.0
Host: localhost:8080
Content-Type: text/xml; charset=utf-8
Content-Length: 837
SOAPAction: ""
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:sendMessage xmlns:ns1="urn:DataFeedService" SOAP-
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<msg xsi:type="ns1:DataFeedMessage">
<?jsx version="1"?>
<DataFeedMessage alias-ID="0">
<java.util.Hashtable alias-ID="1" obj-name="_fields">
<java.lang.String alias-ID="2" valueOf="REQUEST"/>
<java.lang.String alias-ID="3" valueOf="PRICE"/>
<java.lang.String alias-ID="4" valueOf="SYMBOL"/>
<java.lang.String alias-ID="5" valueOf="XYZ"/>
</java.util.Hashtable>
</DataFeedMessage>
</msg>
</ns1:sendMessage>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
(DataFeedMessage is the object i would to send)
But Tomcat (v4.0.4) reply with:
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=utf-8
Content-Length: 480
Date: Mon, 30 Sep 2002 18:00:05 GMT
Server: Java Web Services Developer Pack/1.0-ea1 (HTTP/1.1 Connector)
Set-Cookie: JSESSIONID=59FC124A77DF15420E03650C088E6259;Path=/soap
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server.Exception:</faultcode>
<faultstring>org/apache/soap/util/xml/Serializer</faultstring>
<faultactor>/soap/servlet/rpcrouter</faultactor>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I think the problem are the namespaces ... maybe.
Someone can helpme?
Thanks! :)
Stefano Pedon
--
To unsubscribe, e-mail: <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>
--
To unsubscribe, e-mail: <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>