You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-auto@ws.apache.org by "Marcelo Grassi (JIRA)" <xm...@ws.apache.org> on 2007/03/16 20:23:09 UTC
[jira] Created: (XMLRPC-138) Error in xml write
Error in xml write
------------------
Key: XMLRPC-138
URL: https://issues.apache.org/jira/browse/XMLRPC-138
Project: XML-RPC
Issue Type: Bug
Components: Source
Affects Versions: 3.0
Environment: Java
Reporter: Marcelo Grassi
There is a issue in StringSerializer.java.
The problem is when a parameter is an array of objects.
When a object of this array is a String, the xmlrpc does not insert the <string></string> tag.
The xmp-rpc specification says that the tag must be inserted !
I found the method where is the problem.
public void write(ContentHandler pHandler, Object pObject) throws SAXException {
write(pHandler, null, pObject.toString());
}
I changed the null parameter to constant STRING_TAG and then the tag was inserted well.
Thanks.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (XMLRPC-138) Error in xml write
Posted by "Jochen Wiedmann (JIRA)" <xm...@ws.apache.org>.
[ https://issues.apache.org/jira/browse/XMLRPC-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12481758 ]
Jochen Wiedmann commented on XMLRPC-138:
----------------------------------------
The xml-rpc specification says, in the section on scalar values:
If no type is indicated, the type is string.
In other words, the <string> tag is optional. The section on arrays contains no indication, that scalar values within an array are treated different.
The concept of serializers was specifically developed so that you can create your own serializers, add them to a custom type factory and have it as you like.
> Error in xml write
> ------------------
>
> Key: XMLRPC-138
> URL: https://issues.apache.org/jira/browse/XMLRPC-138
> Project: XML-RPC
> Issue Type: Bug
> Components: Source
> Affects Versions: 3.0
> Environment: Java
> Reporter: Marcelo Grassi
>
> There is a issue in StringSerializer.java.
> The problem is when a parameter is an array of objects.
> When a object of this array is a String, the xmlrpc does not insert the <string></string> tag.
> The xmp-rpc specification says that the tag must be inserted !
> I found the method where is the problem.
> public void write(ContentHandler pHandler, Object pObject) throws SAXException {
> write(pHandler, null, pObject.toString());
> }
> I changed the null parameter to constant STRING_TAG and then the tag was inserted well.
> Thanks.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (XMLRPC-138) Error in xml write
Posted by "Marcelo Grassi (JIRA)" <xm...@ws.apache.org>.
[ https://issues.apache.org/jira/browse/XMLRPC-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12482070 ]
Marcelo Grassi commented on XMLRPC-138:
---------------------------------------
Jochen,
Thanks for the help.
But, how can i create a serializer and add to a custom type factory ? Can you give me a example of code?
Thanks
> Error in xml write
> ------------------
>
> Key: XMLRPC-138
> URL: https://issues.apache.org/jira/browse/XMLRPC-138
> Project: XML-RPC
> Issue Type: Bug
> Components: Source
> Affects Versions: 3.0
> Environment: Java
> Reporter: Marcelo Grassi
>
> There is a issue in StringSerializer.java.
> The problem is when a parameter is an array of objects.
> When a object of this array is a String, the xmlrpc does not insert the <string></string> tag.
> The xmp-rpc specification says that the tag must be inserted !
> I found the method where is the problem.
> public void write(ContentHandler pHandler, Object pObject) throws SAXException {
> write(pHandler, null, pObject.toString());
> }
> I changed the null parameter to constant STRING_TAG and then the tag was inserted well.
> Thanks.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (XMLRPC-138) Error in xml write
Posted by "Marcelo Grassi (JIRA)" <xm...@ws.apache.org>.
[ https://issues.apache.org/jira/browse/XMLRPC-138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marcelo Grassi closed XMLRPC-138.
---------------------------------
Resolution: Fixed
The last comment shows the solution.
> Error in xml write
> ------------------
>
> Key: XMLRPC-138
> URL: https://issues.apache.org/jira/browse/XMLRPC-138
> Project: XML-RPC
> Issue Type: Bug
> Components: Source
> Affects Versions: 3.0
> Environment: Java
> Reporter: Marcelo Grassi
>
> There is a issue in StringSerializer.java.
> The problem is when a parameter is an array of objects.
> When a object of this array is a String, the xmlrpc does not insert the <string></string> tag.
> The xmp-rpc specification says that the tag must be inserted !
> I found the method where is the problem.
> public void write(ContentHandler pHandler, Object pObject) throws SAXException {
> write(pHandler, null, pObject.toString());
> }
> I changed the null parameter to constant STRING_TAG and then the tag was inserted well.
> Thanks.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (XMLRPC-138) Error in xml write
Posted by "Jochen Wiedmann (JIRA)" <xm...@ws.apache.org>.
[ https://issues.apache.org/jira/browse/XMLRPC-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12482074 ]
Jochen Wiedmann commented on XMLRPC-138:
----------------------------------------
See the section on "Custom data type" in http://ws.apache.org/xmlrpc/advanced.html. In your special case, you wouldn't introduce a new type, but override the handling for an existing type.
Btw, if you are done, I'd be thankful, if you would be able to contribute some text describing what you did, so that I could add this to the same document.
> Error in xml write
> ------------------
>
> Key: XMLRPC-138
> URL: https://issues.apache.org/jira/browse/XMLRPC-138
> Project: XML-RPC
> Issue Type: Bug
> Components: Source
> Affects Versions: 3.0
> Environment: Java
> Reporter: Marcelo Grassi
>
> There is a issue in StringSerializer.java.
> The problem is when a parameter is an array of objects.
> When a object of this array is a String, the xmlrpc does not insert the <string></string> tag.
> The xmp-rpc specification says that the tag must be inserted !
> I found the method where is the problem.
> public void write(ContentHandler pHandler, Object pObject) throws SAXException {
> write(pHandler, null, pObject.toString());
> }
> I changed the null parameter to constant STRING_TAG and then the tag was inserted well.
> Thanks.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (XMLRPC-138) Error in xml write
Posted by "Marcelo Grassi (JIRA)" <xm...@ws.apache.org>.
[ https://issues.apache.org/jira/browse/XMLRPC-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12482079 ]
Marcelo Grassi commented on XMLRPC-138:
---------------------------------------
Here is what i did:
First, i extends the StringSerializer and override the write method and passed the TAG parameter:
import org.apache.xmlrpc.serializer.StringSerializer;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
public class StringSerializer2 extends StringSerializer {
/* (não-Javadoc)
* @see org.apache.xmlrpc.serializer.StringSerializer#write(org.xml.sax.ContentHandler, java.lang.Object)
*/
public void write(ContentHandler pHandler, Object pObject)
throws SAXException {
write(pHandler, STRING_TAG, pObject.toString());
}
}
After that, i created a custom factory.
If the instance of the parameter is String, i use the nem Serializer that i override:
import org.apache.xmlrpc.common.TypeFactoryImpl;
import org.apache.xmlrpc.common.XmlRpcController;
import org.apache.xmlrpc.common.XmlRpcStreamConfig;
import org.apache.xmlrpc.serializer.TypeSerializer;
import org.xml.sax.SAXException;
public class MyTypeFactory extends TypeFactoryImpl {
public MyTypeFactory(XmlRpcController pController) {
super(pController);
}
public TypeSerializer getSerializer(XmlRpcStreamConfig pConfig, Object pObject) throws SAXException {
if (pObject instanceof String) {
return new StringSerializer2();
} else {
return super.getSerializer(pConfig, pObject);
}
}
}
And then, in my client class, i set the factory that i created:
client.setTypeFactory(new MyTypeFactory(client));
Now the tag <String> is always writed in xml.
I have to do that because the Service that i´m using needs to receive the Tag always.
Thanks for the help.
[]´s
> Error in xml write
> ------------------
>
> Key: XMLRPC-138
> URL: https://issues.apache.org/jira/browse/XMLRPC-138
> Project: XML-RPC
> Issue Type: Bug
> Components: Source
> Affects Versions: 3.0
> Environment: Java
> Reporter: Marcelo Grassi
>
> There is a issue in StringSerializer.java.
> The problem is when a parameter is an array of objects.
> When a object of this array is a String, the xmlrpc does not insert the <string></string> tag.
> The xmp-rpc specification says that the tag must be inserted !
> I found the method where is the problem.
> public void write(ContentHandler pHandler, Object pObject) throws SAXException {
> write(pHandler, null, pObject.toString());
> }
> I changed the null parameter to constant STRING_TAG and then the tag was inserted well.
> Thanks.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (XMLRPC-138) Error in xml write
Posted by "Marcelo Grassi (JIRA)" <xm...@ws.apache.org>.
[ https://issues.apache.org/jira/browse/XMLRPC-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12482077 ]
Marcelo Grassi commented on XMLRPC-138:
---------------------------------------
Jochen,
i found a example in xml rpc apache web page.
It worked well !
Thanks !!
> Error in xml write
> ------------------
>
> Key: XMLRPC-138
> URL: https://issues.apache.org/jira/browse/XMLRPC-138
> Project: XML-RPC
> Issue Type: Bug
> Components: Source
> Affects Versions: 3.0
> Environment: Java
> Reporter: Marcelo Grassi
>
> There is a issue in StringSerializer.java.
> The problem is when a parameter is an array of objects.
> When a object of this array is a String, the xmlrpc does not insert the <string></string> tag.
> The xmp-rpc specification says that the tag must be inserted !
> I found the method where is the problem.
> public void write(ContentHandler pHandler, Object pObject) throws SAXException {
> write(pHandler, null, pObject.toString());
> }
> I changed the null parameter to constant STRING_TAG and then the tag was inserted well.
> Thanks.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.