The solution I adopted is to use CDATA instead of string. You don't need to
do escaping by yourself.
Regards,
Xinjun
On 6/14/07, Chad DeBauch <[EMAIL PROTECTED]> wrote:
Another approach I have taken is have the service accept a string like you
originally did but encode it in UTF-8 encoding. The downside to this is
that clients will need to know that you are expecting a string that is in
UTF-8 encoding.
Chad
On 6/13/07, Rick Reumann <[EMAIL PROTECTED]> wrote:
>
> On 6/13/07, robert lazarski <[EMAIL PROTECTED]> wrote:
> > I tend to tackle this in two ways: Convert / unconvert the string to
> base64
> > and send it that way. Or use mtom and send the string as an
> attachment.
>
> Thanks Robert. I figured I'd try just using a byte array to start
> with. Maybe someone can help though - I'm a bit unsure how implement
> the client stub that gets generated based off the method:
> getResults(byte[] bytes)
>
> Where I'm running into trouble is that the client stub seems to want
> to use a DataHandler? Instead of dealing with a byte[] it's dealing
> with this DataHandler that I'm unsure how to set this up with my byte
> array?
>
> I have..
> GetResults params = new GetResults();
> params.localBytes = //wants an instance of DataHandler which I'm
> assuming needs my byte[]? but not sure how to set that up
>
> then I can call
> stub.getResults(params);
>
> Thanks for some help.
>
> Original message thread below for reference.
>
> ------------------------------------
>
> > On 6/13/07, Rick Reumann < [EMAIL PROTECTED]> wrote:
> > >
> > > I have an Axis2 service set up. It's super simple. I want the user
> to
> > > be able to send some XML to the service so I figured I'd set up my
> > > POJO service to just accept a String...
> > >
> > > public String getResults( String xmlSpec) { ... }
> > >
> > > I built my client stubs with java2wsdl (actually used Eclipse's
> > > plugin) and if I pass in a simple String like "Hello World,"
> > > everything is fine. However, when I try to send some XML as a
> String,
> > > I end up with the service never receiving the XML and get an error
> > > like:
> > >
> > > org.apache.axis2.AxisFault :
> > com.ctc.wstx.exc.WstxParsingException:
> > > Unexpected close tag </body>; expected </HR>.
> > > at [row,col {unknown-source}]: [11,187]
> > > at
> > org.apache.axis2.transport.TransportUtils.createSOAPMessage (
> TransportUtils.java:81)
> > > at
> > org.apache.axis2.description.OutInAxisOperationClient.send(
> OutInAxisOperation.java:356)
> > > at
> > org.apache.axis2.description.OutInAxisOperationClient.execute
> > (OutInAxisOperation.java:294)
> > > at
> >
>
com.nielsen.webservices.SampleWebServiceSampleWebServiceHttpportStub.getResults
> (SampleWebServiceSampleWebServiceHttpportStub.java:164)
> > > at com.nielsen.webservices.Client.main
> > (Client.java:31)
> > >
> > >
> > > I even tried wrapping the String with <![CDATA[ ]]> but it didn't
> seem
> > > to help. What is the best way to send XML over the wire to an
> exposed
> > > service?
> > >
> > > --
> > > Rick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>