Paul,

I changed the return type to byte[] and it worked, well sort of. The speed was 
a lot quicker but I am unable to convert it back to a String. I am using the 
javax.xml.soap.* classes to parse the response. The only way to retrieve the 
returned value is as a string representation of the byte[]. I then tried to 
convert that string to a byte[] again, write it to a ByteArrayOutputStream, and 
then call toString on the ByteArrayOutputStream but that did not work. I'll 
have to look into that more.


      SOAPBody body = response.getSOAPBody();
      Iterator itr = body.getChildElements(new QName("http://one.testws";, 
"getTestMessageResponse"));
      if (itr.hasNext()) {
        SOAPElement element = (SOAPElement)itr.next();
        Iterator respIter = element.getChildElements();
        if (respIter.hasNext()) {
          SOAPElement returnElement = (SOAPElement)respIter.next();
          if ("return".equals(returnElement.getLocalName())) {
            final String content = returnElement.getValue();
            ByteArrayOutputStream baos = new 
ByteArrayOutputStream(content.length());
            try {
              baos.write(content.getBytes("UTF-8"));
              System.out.println(baos.toString("UTF-8"));
            }
            catch (UnsupportedEncodingException e) {
              e.printStackTrace();
            }
            catch (IOException e) {
              e.printStackTrace();
            }
            finally {
              try {
                baos.close();
              }
              catch (IOException e) {
                e.printStackTrace();
              }
            }
          }
        }
      }

On the plus side, I tried calling URLEncoder.encode on the server side, before 
SOAP does anything with it, and then called URLDecoder.decode on the client 
side and that worked. I was able to quickly get the data from the SOAP message 
and decode it. I'm not in love with this idea since the PowerBuilder client 
would have to do a similar decode but if I cannot get the byte[] to work then I 
may have to use it.

Thanks for your help.

Scott

----- Original Message ----
From: Paul Fremantle <[EMAIL PROTECTED]>
To: [email protected]
Sent: Monday, January 14, 2008 1:24:50 PM
Subject: Re: Process SOAP message containg XHTML


Scott

Did you change the return type in your Java app to be a byte[] when
you made it base64binary? It should have encoded it as base64 but not
modified it.

Are you sure where the problem is? Server or client?

Paul

On Jan 14, 2008 6:17 PM, Scott Malinowski <[EMAIL PROTECTED]> wrote:
>
> Paul,
>
> Thanks. I saw MTOM during my research but I am very new to web
 services and
> SOAP and I am finding some of these other features (including MTOM) a
 bit
> daunting. Mostly, I need to make sure the web service I write can be
> accessed not only by my Java client but also by our sister
 application,
> which is written in PowerBuilder. It looks like you have to enable
 MTOM on
> the client but I am unable to find how that can be done in
 PowerBuilder. It
> appears you have to have PowerBuilder use .NET instead of EasySOAP,
 which is
> PowerBuilder's implementation of SOAP. Sadly, my organization will
 not allow
> .NET so I am limited. This is why I am using plain vanilla SOAP. The
 client
> creates a SOAP message and calls the service. My web service doesn't
 do
> anything with SOAP itself. It is just a Java class which generates
 XHTML and
> returns it. The SOAP container on the server (Axis2) takes care of
> converting the string to a SOAP message response. Somewhere in that
 process
> of taking my string and converting it to a SOAP message is where it
 encodes
> it.
>
> I did try changing the wsdl to have the return type be base64Binary
 but that
> did not keep the XHTML from being encoded. I was hoping there would
 be a
> simple change I can make to the wsdl to tell SOAP to ignore the
 content of
> the return and don't encode it but maybe there isn't an easy way.
>
> I will look further into MTOM. Maybe I can at least get it working
 via a
> Java client. In the meantime, any other ideas from you or anyone else
 would
> be greatly appreciated!
>
> Thanks,
> Scott
>
>
> ----- Original Message ----
> From: Paul Fremantle <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Monday, January 14, 2008 12:07:56 PM
> Subject: Re: Process SOAP message containg XHTML
>
>  One option would be to treat the data as a binary message and use
 MTOM
> to send it. This should reduce the XML processing and will also avoid
> any encoding issues.
>
> Paul
>
> On Jan 14, 2008 3:36 PM, Scott Malinowski <[EMAIL PROTECTED]>
 wrote:
> >
> > Hello,
> >
> > This is probably a SOAP question more than an AXIS2 question. If
 there is
> a
> > better place to post my question please let me know.
> >
> > I have written a SOAP web service using AXIS2. It returns XHTML as
 a
> string.
> > The problem is on the client side. It takes several minutes to
 process the
> > response, which is only a few hundred kilobytes. My research on
 this has
> > pointed me to the fact that the XHTML within the SOAP response has
 become
> > encoded (e.g. '<' has become '&lt;') and that it is taking awhile
 for this
> > data to be converted back. It only takes a second or so for the
 client to
> > send the request and receive a response. The time delay comes when
 I call
> > getSOAPBody() on the client. I have tried wrapping the XHTML in
> '<<![CDATA['
> > and ']]>' but to no avail (it is still encoded in the SOAP
 response). How
> do
> > I return XHTML so that Axis2 and/or SOAP ignores the XHTML when
 building
> the
> > response and leaves it unencoded?
> >
> > Thanks,
> > Scott
> >
> >  ________________________________
> > Looking for last minute shopping deals? Find them fast with Yahoo!
 Search.
>
>
>
> --
> Paul Fremantle
> Co-Founder and VP of Technical Sales, WSO2
> OASIS WS-RX TC Co-chair
>
> blog: http://pzf.fremantle.org
> [EMAIL PROTECTED]
>
> "Oxygenating the Web Service Platform", www.wso2.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>  ________________________________
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.
 Try it
> now.



-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
[EMAIL PROTECTED]

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

Reply via email to