You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Thomas Beaujard <th...@yahoo.fr> on 2007/08/30 17:57:07 UTC

Re : Tr : Axis problem returning byteArray

Thanks for your answer, I will try to explain my problem more precisely:
In fact, I generated my code from WSDL2java with a wsdl file and a xsd file as input. In the xsd file I defined the response as being xsd:base64binary.
Here is the service definition in my server-config.wsdd:
 <service name="DocContent" provider="java:RPC" style="document" use="literal">
  <operation name="getDocument" qname="getDocument" returnQName="ns1:GMDSRESPCT" returnType="ns1:GMDSRESPCT" soapAction="" xmlns:ns1="...">
   <parameter qname="ns1:GMDSREQCT" type="ns1:GMDSREQCT"/>
   <fault class="com.....messages.GMDSERRCT" qname="ns1:GMDSERRCT" type="ns1:GMDSERRCT"/>
  </operation>
  <parameter name="allowedMethods" value="getDocument"/>
  <parameter name="typeMappingVersion" value="1.2"/>
  <parameter name="wsdlPortType" value="DocContent"/>
  <parameter name="className" value="com.....webservice.GetDocumentSoapBindingImpl"/>
  <parameter name="wsdlServicePort" value="DocContent"/>
  <parameter name="wsdlTargetNamespace" value="...."/>
  <parameter name="wsdlServiceElement" value="DocContentService"/>
  <parameter name="schemaUnqualified" value="......"/>
  <typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns2:&gt;GMDSREQCT" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com......messages.GMDSREQCT" xmlns:ns2="....."/>
  <typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns3:&gt;GMDSRESPCT" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.....messages.GMDSRESPCT" xmlns:ns3="....."/>
  <typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="" qname="ns4:&gt;GMDSERRCT" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com....messages.GMDSERRCT" xmlns:ns4="..."/>
 </service>

Here is the class corresponding to the response :
 public class GMDSRESPCT implements Serializable {
    private byte[] CONTENT;
    private 
    public GMDSRESPCT() {
    }

    public GMDSRESPCT(byte[] CONTENT) {
           this.CONTENT = CONTENT;
    }

    public byte[] getCONTENT() {
        return CONTENT;
    }

So the web service should return an object GMDSRESPCT. But I get the error and when I use tcpmon to see the messages exchanged, I notice that the response include <CONTENT> tag for every single byte instead of having the array of byte within the tag <CONTENT>.

Hope it's not too messy.

Cheers

Thom


----- Message d'origine ----
De : WJ Krpelan <kr...@yahoo.com>
À : axis-dev@ws.apache.org
Envoyé le : Jeudi, 30 Août 2007, 17h18mn 03s
Objet : Re: Tr : Axis problem returning byteArray


Hello 
you can't simply send binary data as on the transport
level its converted to xml, which is basically plain
text.

One simple possibility would be to use datatype
base64binary
Cheers,

--- Thomas Beaujard <th...@yahoo.fr> wrote:

> Hello,
>  
> I'm using Axis 1.4.
> I have a document style web service which returns a
> byteArray (actually a pdf file).
> When I invoke the web service, I get the following
> error:
>  
> org.apache.axis.encoding.ser.BeanPropertyTarget set
> Could not convert java.lang.Byte to bean field
> 'CONTENT', type [B
>  
> Does anyone have encounter similar problem?
>  
> Thanks in advance,
>  
> Thom
> 
> 
> 
> 
> 
> 
>        
> Ne gardez plus qu'une seule adresse mail ! Copiez
> vos mails vers Yahoo! Mail 
> 
> 
> 
> 
> 
>      
>
_____________________________________________________________________________
> 
> Ne gardez plus qu'une seule adresse mail ! Copiez
> vos mails vers Yahoo! Mail 



       
____________________________________________________________________________________
Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games.
http://sims.yahoo.com/  

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org








      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

Re: Re : Tr : Axis problem returning byteArray

Posted by Saminda Abeyruwan <sa...@gmail.com>.
Hi Thomas,

There is an open source project called WSO2 Web Services Application Server
(WSAS) that build on top of Apache Axis2. Apache Axis2 handles MTOM. WSAS
has the backward compatibility to support Axis1.

Just download the server and run it [1]. Once logged in you'll be directed
to upload an existing WSDD file. More info will be available in userguide.
[2]

Thank you

Saminda

Reference:
[1]. http://dist.wso2.org/products/wsas/java/2.0/]
[2].
http://wso2.org/project/wsas/java/2.0/docs/administratorguide.html#Deploy


On 8/31/07, WJ Krpelan <kr...@yahoo.com> wrote:
>
> Hi
> Could you provice a SOAP-Trace (TCPMon)? Would it look
> similar to the one below?
> A less than satisfactory workaround, if you control
> both sides of the wire, would be to change type to
> xs:string and do the conversion within java.
> Cheers
>
> POST /axis/CalcArr.jws HTTP/1.0
> Content-Type: text/xml; charset=utf-8
> Accept: application/soap+xml, application/dime,
> multipart/related, text/*
> User-Agent: Axis/1.4
> Host: 127.0.0.1:8088
> Cache-Control: no-cache
> Pragma: no-cache
> SOAPAction: ""
> Content-Length: 334
>
> <?xml version="1.0" encoding="UTF-8"?>
>    <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>       <soapenv:Body>
>          <Add xmlns="http://tempuri.org/">
>             <i1>ITAMWA==</i1>
>             <i2>FxdiAg==</i2>
>          </Add>
>       </soapenv:Body>
>    </soapenv:Envelope>
>
>
> HTTP/1.1 200 OK
> Server: Apache-Coyote/1.1
> Set-Cookie:
> JSESSIONID=887A1E5E02B52B88387CAD9B3FEA7F6C;
> Path=/axis
> Content-Type: text/xml;charset=utf-8
> Date: Fri, 31 Aug 2007 10:16:54 GMT
> Connection: close
>
> <?xml version="1.0" encoding="utf-8"?>
>    <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>       <soapenv:Body>
>          <ns1:AddResponse
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:ns1="http://tempuri.org/">
>             <AddReturn
> xsi:type="xsd:base64Binary">OEduWg==</AddReturn>
>          </ns1:AddResponse>
>       </soapenv:Body>
>    </soapenv:Envelope>
>
>
> --- Thomas Beaujard <th...@yahoo.fr> wrote:
>
> > Thanks for your answer, I will try to explain my
> > problem more precisely:
> > In fact, I generated my code from WSDL2java with a
> > wsdl file and a xsd file as input. In the xsd file I
> > defined the response as being xsd:base64binary.
> > Here is the service definition in my
> > server-config.wsdd:
> >  <service name="DocContent" provider="java:RPC"
> > style="document" use="literal">
> >   <operation name="getDocument" qname="getDocument"
> > returnQName="ns1:GMDSRESPCT"
> > returnType="ns1:GMDSRESPCT" soapAction=""
> > xmlns:ns1="...">
> >    <parameter qname="ns1:GMDSREQCT"
> > type="ns1:GMDSREQCT"/>
> >    <fault class="com.....messages.GMDSERRCT"
> > qname="ns1:GMDSERRCT" type="ns1:GMDSERRCT"/>
> >   </operation>
> >   <parameter name="allowedMethods"
> > value="getDocument"/>
> >   <parameter name="typeMappingVersion" value="1.2"/>
> >   <parameter name="wsdlPortType"
> > value="DocContent"/>
> >   <parameter name="className"
> >
> value="com.....webservice.GetDocumentSoapBindingImpl"/>
> >   <parameter name="wsdlServicePort"
> > value="DocContent"/>
> >   <parameter name="wsdlTargetNamespace"
> > value="...."/>
> >   <parameter name="wsdlServiceElement"
> > value="DocContentService"/>
> >   <parameter name="schemaUnqualified"
> > value="......"/>
> >   <typeMapping
> >
> deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
> > encodingStyle="" qname="ns2:>GMDSREQCT"
> >
> serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
> > type="java:com......messages.GMDSREQCT"
> > xmlns:ns2="....."/>
> >   <typeMapping
> >
> deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
> > encodingStyle="" qname="ns3:>GMDSRESPCT"
> >
> serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
> > type="java:com.....messages.GMDSRESPCT"
> > xmlns:ns3="....."/>
> >   <typeMapping
> >
> deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
> > encodingStyle="" qname="ns4:>GMDSERRCT"
> >
> serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
> > type="java:com....messages.GMDSERRCT"
> > xmlns:ns4="..."/>
> >  </service>
> >
> > Here is the class corresponding to the response :
> >  public class GMDSRESPCT implements Serializable {
> >     private byte[] CONTENT;
> >     private
> >     public GMDSRESPCT() {
> >     }
> >
> >     public GMDSRESPCT(byte[] CONTENT) {
> >            this.CONTENT = CONTENT;
> >     }
> >
> >     public byte[] getCONTENT() {
> >         return CONTENT;
> >     }
> >
> > So the web service should return an object
> > GMDSRESPCT. But I get the error and when I use
> > tcpmon to see the messages exchanged, I notice that
> > the response include <CONTENT> tag for every single
> > byte instead of having the array of byte within the
> > tag <CONTENT>.
> >
> > Hope it's not too messy.
> >
> > Cheers
> >
> > Thom
> >
> >
> > ----- Message d'origine ----
> > De : WJ Krpelan <kr...@yahoo.com>
> > À : axis-dev@ws.apache.org
> > Envoyé le : Jeudi, 30 Août 2007, 17h18mn 03s
> > Objet : Re: Tr : Axis problem returning byteArray
> >
> >
> > Hello
> > you can't simply send binary data as on the
> > transport
> > level its converted to xml, which is basically plain
> > text.
> >
> > One simple possibility would be to use datatype
> > base64binary
> > Cheers,
> >
> > --- Thomas Beaujard <th...@yahoo.fr> wrote:
> >
> > > Hello,
> > >
> > > I'm using Axis 1.4.
> > > I have a document style web service which returns
> > a
> > > byteArray (actually a pdf file).
> > > When I invoke the web service, I get the following
> > > error:
> > >
> > > org.apache.axis.encoding.ser.BeanPropertyTarget
> > set
> > > Could not convert java.lang.Byte to bean field
> > > 'CONTENT', type [B
> > >
> > > Does anyone have encounter similar problem?
> > >
> > > Thanks in advance,
> > >
> > > Thom
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Ne gardez plus qu'une seule adresse mail ! Copiez
> > > vos mails vers Yahoo! Mail
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
>
> _____________________________________________________________________________
> > >
> > > Ne gardez plus qu'une seule adresse mail ! Copiez
> > > vos mails vers Yahoo! Mail
> >
> >
> >
> >
> >
>
> ____________________________________________________________________________________
> > Moody friends. Drama queens. Your life? Nope! -
> > their life, your story. Play Sims Stories at Yahoo!
> > Games.
> > http://sims.yahoo.com/
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > axis-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail:
> > axis-dev-help@ws.apache.org
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
> _____________________________________________________________________________
> >
> > Ne gardez plus qu'une seule adresse mail ! Copiez
> > vos mails vers Yahoo! Mail
>
>
>
>
>
> ____________________________________________________________________________________
> Choose the right car based on your needs.  Check out Yahoo! Autos new Car
> Finder tool.
> http://autos.yahoo.com/carfinder/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>


-- 
Saminda Abeyruwan

Software Engineer
WSO2 Inc. - www.wso2.org

Re: Re : Tr : Axis problem returning byteArray

Posted by WJ Krpelan <kr...@yahoo.com>.
Hi
Could you provice a SOAP-Trace (TCPMon)? Would it look
similar to the one below?
A less than satisfactory workaround, if you control
both sides of the wire, would be to change type to
xs:string and do the conversion within java.
Cheers

POST /axis/CalcArr.jws HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime,
multipart/related, text/*
User-Agent: Axis/1.4
Host: 127.0.0.1:8088
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 334

<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
         <Add xmlns="http://tempuri.org/">
            <i1>ITAMWA==</i1>
            <i2>FxdiAg==</i2>
         </Add>
      </soapenv:Body>
   </soapenv:Envelope>


HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie:
JSESSIONID=887A1E5E02B52B88387CAD9B3FEA7F6C;
Path=/axis
Content-Type: text/xml;charset=utf-8
Date: Fri, 31 Aug 2007 10:16:54 GMT
Connection: close

<?xml version="1.0" encoding="utf-8"?>
   <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
         <ns1:AddResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://tempuri.org/">
            <AddReturn
xsi:type="xsd:base64Binary">OEduWg==</AddReturn>
         </ns1:AddResponse>
      </soapenv:Body>
   </soapenv:Envelope>


--- Thomas Beaujard <th...@yahoo.fr> wrote:

> Thanks for your answer, I will try to explain my
> problem more precisely:
> In fact, I generated my code from WSDL2java with a
> wsdl file and a xsd file as input. In the xsd file I
> defined the response as being xsd:base64binary.
> Here is the service definition in my
> server-config.wsdd:
>  <service name="DocContent" provider="java:RPC"
> style="document" use="literal">
>   <operation name="getDocument" qname="getDocument"
> returnQName="ns1:GMDSRESPCT"
> returnType="ns1:GMDSRESPCT" soapAction=""
> xmlns:ns1="...">
>    <parameter qname="ns1:GMDSREQCT"
> type="ns1:GMDSREQCT"/>
>    <fault class="com.....messages.GMDSERRCT"
> qname="ns1:GMDSERRCT" type="ns1:GMDSERRCT"/>
>   </operation>
>   <parameter name="allowedMethods"
> value="getDocument"/>
>   <parameter name="typeMappingVersion" value="1.2"/>
>   <parameter name="wsdlPortType"
> value="DocContent"/>
>   <parameter name="className"
>
value="com.....webservice.GetDocumentSoapBindingImpl"/>
>   <parameter name="wsdlServicePort"
> value="DocContent"/>
>   <parameter name="wsdlTargetNamespace"
> value="...."/>
>   <parameter name="wsdlServiceElement"
> value="DocContentService"/>
>   <parameter name="schemaUnqualified"
> value="......"/>
>   <typeMapping
>
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
> encodingStyle="" qname="ns2:&gt;GMDSREQCT"
>
serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
> type="java:com......messages.GMDSREQCT"
> xmlns:ns2="....."/>
>   <typeMapping
>
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
> encodingStyle="" qname="ns3:&gt;GMDSRESPCT"
>
serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
> type="java:com.....messages.GMDSRESPCT"
> xmlns:ns3="....."/>
>   <typeMapping
>
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
> encodingStyle="" qname="ns4:&gt;GMDSERRCT"
>
serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
> type="java:com....messages.GMDSERRCT"
> xmlns:ns4="..."/>
>  </service>
> 
> Here is the class corresponding to the response :
>  public class GMDSRESPCT implements Serializable {
>     private byte[] CONTENT;
>     private 
>     public GMDSRESPCT() {
>     }
> 
>     public GMDSRESPCT(byte[] CONTENT) {
>            this.CONTENT = CONTENT;
>     }
> 
>     public byte[] getCONTENT() {
>         return CONTENT;
>     }
> 
> So the web service should return an object
> GMDSRESPCT. But I get the error and when I use
> tcpmon to see the messages exchanged, I notice that
> the response include <CONTENT> tag for every single
> byte instead of having the array of byte within the
> tag <CONTENT>.
> 
> Hope it's not too messy.
> 
> Cheers
> 
> Thom
> 
> 
> ----- Message d'origine ----
> De : WJ Krpelan <kr...@yahoo.com>
> À : axis-dev@ws.apache.org
> Envoyé le : Jeudi, 30 Août 2007, 17h18mn 03s
> Objet : Re: Tr : Axis problem returning byteArray
> 
> 
> Hello 
> you can't simply send binary data as on the
> transport
> level its converted to xml, which is basically plain
> text.
> 
> One simple possibility would be to use datatype
> base64binary
> Cheers,
> 
> --- Thomas Beaujard <th...@yahoo.fr> wrote:
> 
> > Hello,
> >  
> > I'm using Axis 1.4.
> > I have a document style web service which returns
> a
> > byteArray (actually a pdf file).
> > When I invoke the web service, I get the following
> > error:
> >  
> > org.apache.axis.encoding.ser.BeanPropertyTarget
> set
> > Could not convert java.lang.Byte to bean field
> > 'CONTENT', type [B
> >  
> > Does anyone have encounter similar problem?
> >  
> > Thanks in advance,
> >  
> > Thom
> > 
> > 
> > 
> > 
> > 
> > 
> >        
> > Ne gardez plus qu'une seule adresse mail ! Copiez
> > vos mails vers Yahoo! Mail 
> > 
> > 
> > 
> > 
> > 
> >      
> >
>
_____________________________________________________________________________
> > 
> > Ne gardez plus qu'une seule adresse mail ! Copiez
> > vos mails vers Yahoo! Mail 
> 
> 
> 
>        
>
____________________________________________________________________________________
> Moody friends. Drama queens. Your life? Nope! -
> their life, your story. Play Sims Stories at Yahoo!
> Games.
> http://sims.yahoo.com/  
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail:
> axis-dev-help@ws.apache.org
> 
> 
> 
> 
> 
> 
> 
> 
>      
>
_____________________________________________________________________________
> 
> Ne gardez plus qu'une seule adresse mail ! Copiez
> vos mails vers Yahoo! Mail 



       
____________________________________________________________________________________
Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.
http://autos.yahoo.com/carfinder/

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org