You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Yong Yang <y....@querix.com> on 2007/01/04 17:38:01 UTC

re[2]: How can I return complex data structure and attachment to web service client?

Hi Thilina,
    Thank you very much for reply.    

 >>  > When we look at the WSDL generated from the source code, the data type
 >>  of >method1Response is anyType.
 >>  That's correct.. Axis2 couldn't figure out the actual schema when the
 >>  parameters are OMElements. An OMElement can contain any arbitrary
 >>  piece of XML.  When using OMElements, it is advised to hand craft a
 >>  WSDL for the service.. See here[1] for more info.

   It is unlikely that our customer change the generated WSDL manually when the web service returns a complex data structure and attachmetns using AXIOM. The only possible way I can think about is the second way I mentioned in my previous email, see follows:

public class Service1
{
   ....
   public Method1Response method1(....)
   {
         ....
         Method1Response res = new Method1Response(...);
         .....
        return res;
   }
  ...

}

public class Method1Response
{
   int var_i;
   double var_d;
   DATATYPE attachment1;
   ....
}

If the DATATYPE for the variable attachment1 in the class Method1Response is OMElement, it seems the binary data is sending by value, not by reference when I traced the SOAP message using TCPMonitor.

<ns:echoResponse xmlns:ns="http://ws.apache.org/axis2/xsd">
    <ns:return>
    <amount xmlns="http://ws.apache.org/axis2/xsd">20</amount>
    <attachment>
           dGhpcyBpcyB0ZXN0IHR4dGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRmYXNmYXNkZmFzZGZhc2ZkYXNkZmFzZGZhc2RmYXNkZmFzZGZhc2RmYXNkZmFzZGZhc2RmYXNkZmFzZGZh
    </attachment>
    <name xmlns="http://ws.apache.org/axis2/xsd">yang</name>
</ns:return></ns:echoResponse>

And it also seems that large portion of the attachment data was discarded as the size of the file is about 3M.

May I know How I can set the data type of attachment variable in this approach? or there is any other alternative way to return complex data structure and attachment? Many thanks in advance.

best regards
yong
 
 

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


re[4]: How can I return complex data structure and attachment to web service client?

Posted by Yong Yang <y....@querix.com>.
Hi Thilina,
      Thank you very much for your reply.

 >>  > If the DATATYPE for the variable attachment1 in the class
 >>  Method1Response is >OMElement, it seems the binary data is sending by
 >>  value, not by reference when I >traced the SOAP message using TCPMonitor.
 >>  Please make sure to set the optimize flag to "true" in the OMText
 >>  child of that attachment element..
 >>  eg: text.setOptimize(true);
 >>  Also make sure to enable MTOM [1] in the server..

I followed your suggestion, the binary data is still sent by value, not by reference when the attachmetn variable in the class Method1Response is OMElement.

best regards
yong
 

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


Re: re[2]: How can I return complex data structure and attachment to web service client?

Posted by Thilina Gunarathne <cs...@gmail.com>.
Hi,
> If the DATATYPE for the variable attachment1 in the class Method1Response is >OMElement, it seems the binary data is sending by value, not by reference when I >traced the SOAP message using TCPMonitor.
Please make sure to set the optimize flag to "true" in the OMText
child of that attachment element..
    eg: text.setOptimize(true);
Also make sure to enable MTOM [1] in the server..

> And it also seems that large portion of the attachment data was discarded as >the size of the file is about 3M.
This is an unexpected behaviour.. Axis2 should fail with a fault if it
cannot handle the load..  Please log a bug report in the Jira if you
continue to experience this behaviour(discarding data)..

> May I know How I can set the data type of attachment variable in this approach? >or there is any other alternative way to return complex data structure and >attachment? Many thanks in advance.
You can follow the contract first approach.. Design the WSDL first.
Then code generate according to that WSDL using the Axis2 WSDL2Java
tool..  There are lot of tools available to help you in designing a
WSDL. (Ex: Eclipse WTK).. See here[2] understand how to specify the
attachments in the WSDL..

~Thilina

[1] http://wso2.org/library/264
[2] http://ws.apache.org/axis2/1_1/mtom-guide.html#251

>
> best regards
> yong
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/

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