You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Haszlakiewicz, Eric" <EH...@transunion.com> on 2009/02/02 20:26:14 UTC

RE: special character escaping in adb requests

(I'm switching this thread to the axis-c-dev list, because that seems
more appropriate for the level of detail I'm asking about)

So if axutil_stream_write actually writes the xml out, why does the
generated foo_serialize() function return a node, and why does that get
passed to axis2_svc_client_send_receive_with_op_qname?  Is that actually
necessary for something, or would it work to pass a NULL there, or some
other dummy node?

eric

>-----Original Message-----
>From: Dimuthu Gamage [mailto:dimuthuc@gmail.com] 
>Sent: Saturday, January 31, 2009 2:36 AM
>To: Apache AXIS C User List
>Subject: Re: special character escaping in adb requests
>
>Hi Eric,
>
>Yea we have the stream write function which directly write the 
>xml in the generated code. So fixing it axiom_node_serialize 
>is not enough, we have to change the generated code a little 
>bit. But for your custom need it is better setting data after 
>escaping special characters.
>
>
>
>On Sat, Jan 31, 2009 at 3:25 AM, Haszlakiewicz, Eric 
><EH...@transunion.com> wrote:
>
>
>
>	hmm... I had assumed that the adb code would just generate an
>	appropriately structured axiom_node_t, and it seems 
>like it does return
>	a node, but it's also generating xml directly and 
>writing it out (with
>	axutil_stream_write).  huh?  I think I'm missing 
>something with how this
>	works.
>	
>	I tried to read through the 
>axis2_svc_client_send_receive_with_op_qname
>	call that uses the axiom_node_t (which is called from 
>the stub "myOp"
>	call), hoping that that might provide some insight, but 
>quickly got
>	lost.  It seems the figuring out what this code does 
>will take more time
>	than I have available right now. :(
>	
>
>	>-----Original Message-----
>	>From: Haszlakiewicz, Eric [mailto:EHASZLA@transunion.com]
>	>Sent: Friday, January 30, 2009 3:04 PM
>	>To: Apache AXIS C User List
>	
>	>Subject: RE: special character escaping in adb requests
>	>
>	>
>	>Until you try to send some data that contains "]]>".  There is
>	>no way to
>	>avoid to the need to escape the data.  This should be 
>handled by the
>	>serialization methods.  I'm very surprised that it 
>isn't.  I haven't
>	>looked at the code that does the serialization yet, 
>but if there's a
>	>general axion serialize-an-element routine, this 
>probably won't be too
>	>hard to fix.
>	>
>	>>-----Original Message-----
>	>>From: Dumindu Pallewela [mailto:pallewela@gmail.com]
>	>>Sent: Friday, January 30, 2009 12:27 PM
>	>>To: Apache AXIS C User List
>	>>Subject: Re: special character escaping in adb requests
>	>>
>	>>Does AXIOM support CDATA sections?
>	>>
>	>>If so I think this can simply be solved by using a 
>CDATA section.
>	>>
>	>>Thanks,
>	>>Dumindu.
>	>>
>	>>On Fri, Jan 30, 2009 at 9:20 AM, Dimuthu Gamage
>	>><di...@gmail.com> wrote:
>	>>> Unfortunately we don't have such a function in the axutil
>	>>yet. But it is
>	>>> trival to implement.
>	>>> I just did a google and found this, [1]. We can use the
>	>>algorithm for the
>	>>> parse data.
>	>>>
>	>>>
>	>>> [1] http://www.hdfgroup.org/HDF5/XML/xml_escape_chars.htm
>	>>>
>	>>> Thanks
>	>>> Dimuthu
>	>>>
>	>>> On Thu, Jan 29, 2009 at 10:48 PM, Haszlakiewicz, Eric
>	>>> <EH...@transunion.com> wrote:
>	>>>>
>	>>>> hmm... well that sucks.  Is there an axis function to do
>	>>this easily, or
>	>>>> do I need to find one somewhere else?
>	>>>>
>	>>>> Also, how do I know what kind of escaping to do?  It's
>	>>possible to have
>	>>>> axis send the request as a soap doc, or as a json message,
>	>>so I can't
>	>>>> use the same escaping for each, right?
>	>>>>
>	>>>> eric
>	>>>>
>	>>>> >-----Original Message-----
>	>>>> >From: Dimuthu Gamage [mailto:dimuthuc@gmail.com]
>	>>>> >Sent: Wednesday, January 28, 2009 9:01 PM
>	>>>> >To: Apache AXIS C User List
>	>>>> >Subject: Re: special character escaping in adb requests
>	>>>> >
>	>>>> >Hi Eric,
>	>>>> >Unfortunately You have to set the texts after 
>escaping these
>	>>>> >characters at least for now. It is apparently a bug. (we
>	>>>> >should do it inside). Can you please raise a JIRA 
>issue on that.
>	>>>> >
>	>>>> >Thanks
>	>>>> >Dimuthu
>	>>>> >
>	>>>> >
>	>>>> >On Thu, Jan 29, 2009 at 12:48 AM, Haszlakiewicz, Eric
>	>>>> ><EH...@transunion.com> wrote:
>	>>>> >
>	>>>> >
>	>>>> >
>	>>>> >       I have an app that uses adb to construct 
>messages to
>	>>>> >send to a web
>	>>>> >       service.  Everything works fine, unless my data
>	>>>> >contains characters like
>	>>>> >       '<', in which case axis fails to escape 
>the characters
>	>>>> >and generates
>	>>>> >       invalid xml (I'm using xml messages).
>	>>>> >
>	>>>> >       I'm doing things like:
>	>>>> >
>	>>>> >       axis2_stub_t *my_service =
>	>>>> >axis2_stub_create_MyService(env, client_home,
>	>>>> >       url);
>	>>>> >       adb_foo_t *myreq = adb_foo_create(env);
>	>>>> >       adb_foo_set_myfield(myreq, env, "abc<xyz");
>	>>>> >       adb_fooresp_t *response =
>	>>>> >axis2_stub_op_MyService_myOp(an_service, env,
>	>>>> >       myreq);
>	>>>> >
>	>>>> >       The adb code was generated from a wsdl 
>(and xsd) that
>	>>>> >has elements
>	>>>> >       defined like:
>	>>>> >         <xs:element name="foo" type="xs:string"/>
>	>>>> >       and the command used was:
>	>>>> >         axis2.sh org.apache.axis2.wsdl.WSDL2C -uri
>	>>>> >myservice.wsdl -d adb -u
>	>>>> >       -o generated
>	>>>> >
>	>>>> >       Is there some extra step I need to take to 
>make this
>	>>>> >work right?  Or, is
>	>>>> >       there some bug that might be fixed in a more
>	>recent version?
>	>>>> >
>	>>>> >       eric
>	>>>> >
>	>>>> >
>	>>>> >
>	>>>> >
>	>>>> >
>	>>>> >--
>	>>>> >Thanks,
>	>>>> >Dimuthu Gamage
>	>>>> >
>	>>>> >http://www.dimuthu.org
>	>>>> >http://www.wso2.org
>	>>>> >
>	>>>> >
>	>>>
>	>>>
>	>>>
>	>>> --
>	>>> Thanks,
>	>>> Dimuthu Gamage
>	>>>
>	>>> http://www.dimuthu.org
>	>>> http://www.wso2.org
>	>>>
>	>>
>	>
>	
>
>
>
>
>-- 
>Thanks,
>Dimuthu Gamage
>
>http://www.dimuthu.org
>http://www.wso2.org
>
>