List Info

Thread: Created: (XMLRPC-138) Error in xml write




Created: (XMLRPC-138) Error in xml write
country flaguser name
United States
2007-03-16 14:23:09
Error in xml write
------------------

                 Key: XMLRPC-138
                 URL: http
s://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.


Commented: (XMLRPC-138) Error in xml write
country flaguser name
United States
2007-03-16 15:41:09
    [ https://issues.apache.org/jira/browse/
XMLRPC-138?page=com.atlassian.jira.plugin.system.issuetabpan
els: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: http
s://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.


Commented: (XMLRPC-138) Error in xml write
country flaguser name
United States
2007-03-19 07:50:32
    [ https://issues.apache.org/jira/browse/
XMLRPC-138?page=com.atlassian.jira.plugin.system.issuetabpan
els: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: http
s://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.


Commented: (XMLRPC-138) Error in xml write
country flaguser name
United States
2007-03-19 08:04:32
    [ https://issues.apache.org/jira/browse/
XMLRPC-138?page=com.atlassian.jira.plugin.system.issuetabpan
els: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: http
s://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.


Commented: (XMLRPC-138) Error in xml write
country flaguser name
United States
2007-03-19 08:08:32
    [ https://issues.apache.org/jira/browse/
XMLRPC-138?page=com.atlassian.jira.plugin.system.issuetabpan
els: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: http
s://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.


Commented: (XMLRPC-138) Error in xml write
country flaguser name
United States
2007-03-19 08:14:32
    [
HTTPS://ISSUES.APACHE.ORG/JIRA/BROWSE/XMLRPC-138?PAGE=COM.AT
LASSIAN.JIRA.PLUGIN.SYSTEM.ISSUETABPANELS:COMMENT-TABPANEL#A
CTION_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.


Closed: (XMLRPC-138) Error in xml write
country flaguser name
United States
2007-03-20 11:38:32
     [ 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: http
s://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.


[1-7]

about | contact  Other archives ( Real Estate discussion Medical topics )