Cannot consume .NET Web Service with Axis2 Plugin

View: New views
2 Messages — Rating Filter:   Alert me  

Cannot consume .NET Web Service with Axis2 Plugin

by Binh Le Thanh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear all,

I am using Grails 1.0.5 + Axis2 0.6.1 plugin to consume a web service written in .NET and deployed on IIS 6.0. 

Firstly, I use wsdl2java to generate ws client code and unit test with pure java then it run fine.

Secondly, I copy source code to Grails project and invoke it then I got AxisFault from IIS Server: Unsupported Media Type.

Thirdly, I use wireshark to capture the http packet then I got the following:

----------- Using Pure java Unit Test  ------------------
POST /VnpSrv.asmx HTTP/1.1
Content-Type: application/soap+xml; charset=UTF-8; action="http://www.XXXX.vn/abc/abc"
User-Agent: Axis2
Host: 210.245.12.XXX:1122
Transfer-Encoding: chunked

---------- Using Grails + Axis2 Plugin --------------------
POST /VnpSrv.asmx HTTP/1.1
Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_D44A27D3AB199F6F3C1246526414121; type="application/soap+xml"; start="<0.urn%3Auuid%3AD44A27D3AB199F6F3C1246526414122@...>"; action="http://www.XXXX.vn/abc/abc"
User-Agent: Axis2
Host: 210.245.12.XXX:1122
Transfer-Encoding: chunked

I guess the error is caused by using "Content-Type: multipart/related; boundary=..." and IIS server does not support this content-type.

So how can I change this setting of  Axis2 Plugin so that the header become that of when I use Pure java unit test.

Regards,
Binh Le


Re: Cannot consume .NET Web Service with Axis2 Plugin

by Binh Le Thanh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear all,

It take me a a few minutes to read source code of WSO2 WSF/Spring and Axis2 then I found that when MTOM and SwA is enabled then Axis2 will use Header: "Content-Type: multipart/related; boundary= ..."

To fix this, I go to class Axis2GrailsPlugin in Axis plugin folder of the project and change configuration as follow:

        "eMTOM"(org.wso2.spring.ws.beans.ParameterBean) {
            name = "enableMTOM"
            value = "false"
        }
        "eSwA"(org.wso2.spring.ws.beans.ParameterBean) {
            name = "enableSwA"
            value = "false"
        }

Then everything works fine for me but it only work for my project because I dont need MTOM enabled. For the project that need MTOM enabled, I still dont know how to fix it.

Regards,
Binh Le

On Thu, Jul 2, 2009 at 5:43 PM, Binh Le Thanh <binh.lethanh@...> wrote:
Dear all,

I am using Grails 1.0.5 + Axis2 0.6.1 plugin to consume a web service written in .NET and deployed on IIS 6.0. 

Firstly, I use wsdl2java to generate ws client code and unit test with pure java then it run fine.

Secondly, I copy source code to Grails project and invoke it then I got AxisFault from IIS Server: Unsupported Media Type.

Thirdly, I use wireshark to capture the http packet then I got the following:

----------- Using Pure java Unit Test  ------------------
POST /VnpSrv.asmx HTTP/1.1
Content-Type: application/soap+xml; charset=UTF-8; action="http://www.XXXX.vn/abc/abc"
User-Agent: Axis2
Host: 210.245.12.XXX:1122
Transfer-Encoding: chunked

---------- Using Grails + Axis2 Plugin --------------------
POST /VnpSrv.asmx HTTP/1.1
Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_D44A27D3AB199F6F3C1246526414121; type="application/soap+xml"; start="<0.urn%3Auuid%3AD44A27D3AB199F6F3C1246526414122@...>"; action="http://www.XXXX.vn/abc/abc"
User-Agent: Axis2
Host: 210.245.12.XXX:1122
Transfer-Encoding: chunked

I guess the error is caused by using "Content-Type: multipart/related; boundary=..." and IIS server does not support this content-type.

So how can I change this setting of  Axis2 Plugin so that the header become that of when I use Pure java unit test.

Regards,
Binh Le