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 Shalab Goel <sh...@oracle.com> on 2007/08/03 22:27:23 UTC

.NET Service with MTOM enabled operation

I have a service which exposes one of the operations with MTOM enabled response. Looking at the .NET Service WSDL 

I see the following:

 

<s:element name="exportResponse">

 <s:complexType>

  <s:sequence>

   <s:element minOccurs="0" maxOccurs="1" name="exportResult" type="tns:AContent" /> 

  </s:sequence>

 </s:complexType>

</s:element>

<s:complexType name="AContent">

 <s:sequence>

  <s:element minOccurs="0" maxOccurs="1" name="aData" type="s:base64Binary" /> 

 </s:sequence>

</s:complexType>

 

How does Axis client make the determination that this is MTOM encoded data from server end?

 

I tried setting ENABLE_MTOM property in my client stub constructor code (generated using adb) as follows:

 

       org.apache.axis2.client.Options opts = _serviceClient.getOptions();

       opts.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);

       _serviceClient.setOptions(opts);

 

but that does not solve the problem. Any suggestions on what I can try?

I get the following SOAP Fault, that the server was unreachable.

 

            <soap:Fault>

               <faultcode>soap:Server</faultcode>

               <faultstring>Server unavailable, please try later</faultstring>

               <faultactor>http://hola5/MyService/Service.asmx</faultactor>

            </soap:Fault>

 

 

If I remove Constants.Configuration.ENABLE_MTOM property, and try to run the client, I see base encoded string in TCPMON, something like:

 

           <exportResult>

               <aData>PD94bWwgdmVyc2lvbj0iMS4wIiBlbm......... </aData>

            </exportResult>

 


RE: .NET Service with MTOM enabled operation

Posted by Shalab Goel <sh...@oracle.com>.
Thanks Thilina and Paul for your responses.

I removed the Constants.Configuration.ENABLE_MTOM property, from my Axis2 client accepting MTOM stream from .NET service, and I am able to retrieve the contents, and print them at my client.

Not sure if I got anything streamed in this case, but this is the rudimentary block of code that seems to print the contents on my client:

        	DataHandler dh = contnt.getArtifactData();
        	cntntStream = dh.getInputStream();
        	
        	byte[] myByte= new byte[1];
        	System.out.println("Retrieved Content +++:\n");
        	while (cntntStream.read(myByte) != -1)
        		System.out.print(new String(myByte));

Is this acceptable mechanism to retrieve MTOM encoded stream in Axis 2 client?

Thanks
Shalab Goel

-----Original Message-----
From: Thilina Gunarathne [mailto:csethil@gmail.com] 
Sent: Saturday, August 04, 2007 3:22 AM
To: axis-user@ws.apache.org; shalab.goel@oracle.com
Subject: Re: .NET Service with MTOM enabled operation

> How does Axis client make the determination that this is MTOM encoded data
> from server end?
Axis2 data binding code generator figures out that out by looking at
the "aData" element which has the type as base64Binary..

Axis2 can identify MTOM messages as MTOM binary references even
without code generation or without usign WSDL by looking at the
content type and the payload.

> I tried setting ENABLE_MTOM property in my client stub constructor code
> (generated using adb) as follows:
This is needed because .net sends back MTOM only if the request
message is MTOM :(..

Shalab:  I removed the Constants.Configuration.ENABLE_MTOM property, from my Axis2 client accepting MTOM stream from .NET service, and I am able to retrieve the contents, and print them at my client.



> I get the following SOAP Fault, that the server was unreachable.
When it comes to MTOM Axis2 has proven interoperbility with .net. This
error might be something you will need to explore bit more with your
service setup. Unfortunateyl I do not have much .net knowledge to
figure it out..

thanks,
Thilina

>
>
>
>             <soap:Fault>
>
>                <faultcode>soap:Server</faultcode>
>
>                <faultstring>Server unavailable, please try
> later</faultstring>
>
>
> <faultactor>http://hola5/MyService/Service.asmx</faultactor>
>
>             </soap:Fault>
>
>
>
>
>
> If I remove Constants.Configuration.ENABLE_MTOM property,
> and try to run the client, I see base encoded string in TCPMON, something
> like:
>
>
>
>            <exportResult>
>
>
> <aData>PD94bWwgdmVyc2lvbj0iMS4wIiBlbm......... </aData>
>
>             </exportResult>
>
>


--
Thilina Gunarathne  -  http://www.wso2.com - 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



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


Re: .NET Service with MTOM enabled operation

Posted by Thilina Gunarathne <cs...@gmail.com>.
> How does Axis client make the determination that this is MTOM encoded data
> from server end?
Axis2 data binding code generator figures out that out by looking at
the "aData" element which has the type as base64Binary..

Axis2 can identify MTOM messages as MTOM binary references even
without code generation or without usign WSDL by looking at the
content type and the payload.

> I tried setting ENABLE_MTOM property in my client stub constructor code
> (generated using adb) as follows:
This is needed because .net sends back MTOM only if the request
message is MTOM :(..

> I get the following SOAP Fault, that the server was unreachable.
When it comes to MTOM Axis2 has proven interoperbility with .net. This
error might be something you will need to explore bit more with your
service setup. Unfortunateyl I do not have much .net knowledge to
figure it out..

thanks,
Thilina

>
>
>
>             <soap:Fault>
>
>                <faultcode>soap:Server</faultcode>
>
>                <faultstring>Server unavailable, please try
> later</faultstring>
>
>
> <faultactor>http://hola5/MyService/Service.asmx</faultactor>
>
>             </soap:Fault>
>
>
>
>
>
> If I remove Constants.Configuration.ENABLE_MTOM property,
> and try to run the client, I see base encoded string in TCPMON, something
> like:
>
>
>
>            <exportResult>
>
>
> <aData>PD94bWwgdmVyc2lvbj0iMS4wIiBlbm......... </aData>
>
>             </exportResult>
>
>


-- 
Thilina Gunarathne  -  http://www.wso2.com - 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


Re: .NET Service with MTOM enabled operation

Posted by Paul Fremantle <pz...@gmail.com>.
Shalab

The SOAP fault you are getting is being returned from the .NET
service. It seems pretty odd that the .NET server is replying saying
that its unavailable!

I suggest you trace the Axis2 client and also a working .NET client.
You can trace using TCPMON tool from ws.apache.org/commons.

Paul

On 8/3/07, Shalab Goel <sh...@oracle.com> wrote:
>
>
>
>
> I have a service which exposes one of the operations with MTOM enabled
> response. Looking at the .NET Service WSDL
>
> I see the following:
>
>
>
> <s:element name="exportResponse">
>
>  <s:complexType>
>
>   <s:sequence>
>
>    <s:element minOccurs="0" maxOccurs="1" name="exportResult"
> type="tns:AContent" />
>
>   </s:sequence>
>
>  </s:complexType>
>
> </s:element>
>
> <s:complexType name="AContent">
>
>  <s:sequence>
>
>   <s:element minOccurs="0" maxOccurs="1" name="aData" type="s:base64Binary"
> />
>
>  </s:sequence>
>
> </s:complexType>
>
>
>
> How does Axis client make the determination that this is MTOM encoded data
> from server end?
>
>
>
> I tried setting ENABLE_MTOM property in my client stub constructor code
> (generated using adb) as follows:
>
>
>
>        org.apache.axis2.client.Options opts = _serviceClient.getOptions();
>
>
> opts.setProperty(Constants.Configuration.ENABLE_MTOM,
> Constants.VALUE_TRUE);
>
>        _serviceClient.setOptions(opts);
>
>
>
> but that does not solve the problem. Any suggestions on what I can try?
>
> I get the following SOAP Fault, that the server was unreachable.
>
>
>
>             <soap:Fault>
>
>                <faultcode>soap:Server</faultcode>
>
>                <faultstring>Server unavailable, please try
> later</faultstring>
>
>
> <faultactor>http://hola5/MyService/Service.asmx</faultactor>
>
>             </soap:Fault>
>
>
>
>
>
> If I remove Constants.Configuration.ENABLE_MTOM property,
> and try to run the client, I see base encoded string in TCPMON, something
> like:
>
>
>
>            <exportResult>
>
>
> <aData>PD94bWwgdmVyc2lvbj0iMS4wIiBlbm......... </aData>
>
>             </exportResult>
>
>


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

blog: http://pzf.fremantle.org
paul@wso2.com

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

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