Problems Using Java / AXIS Web Service in .Net Application

I need to use a third party web service written in Java generated using Axis.

I am using .Net Framework 3.5 SP1 and VS 2008.

I made a web link, as we did in .net 2.0, and pointed to the wsdl service.

It worked fine with some service methods, but when I try to call a method that takes an int as a parameter, the following exception is thrown:

JAXRPCTIE01: caught exception while handling request: unexpected element type: expected={http://schemas.xmlsoap.org/soap/encoding/}int, actual={http://www.w3.org/2001/XMLSchema}int 

I checked wsdl and defined five different Xml Schema namespaces:

 <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:servicos/wsdlservicosgmp2" xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns3="urn:servicos/typesservicosgmp2" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="servicosgmp2" targetNamespace="urn:servicos/wsdlservicosgmp2"> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:servicos/typesservicosgmp2" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:servicos/typesservicosgmp2"> 

And the definition of the problematic method:

 <message name="IWsServicosGMP2_buscaConvenio"> <part name="Integer_1" type="ns2:int" /> <part name="Integer_2" type="ns2:int" /> </message> 

Does anyone know what I need to do to solve this problem?

+4
source share
4 answers

The Java / AXIS web service seems to be using SOAP encoding (section 5). This is a refund, and it is very strange to see these days.

Where do you get the web service? how long does it work? Do you have the opportunity to change it? AXIS or AXIS2? Which version? For AXIS1, nothing of AXIS v1.1 onward should work fine, but I would recommend upgrading to version 1.4. If possible, go to AXIS2 and use v1.4. (Confusingly, AXIS and AXIS2 have the same version number.)

Why does the Java side want to use SOAP coding? Was the WSDL first approach on the Java side, or is it one of those dynamic generation WSDL things? AXIS and .NET work together perfectly if you start with WSDL + XSD in the first place , and limit yourself to doc / lit web services and limit the use of xmlschema to less exotic parts: primitives, structures, and arrays of the same. You can nest at any level: arrays of structures containing arrays, structures containing arrays of structures, etc.

Addition . If you start with your Java object model and try to dynamically generate a wired interface from it (for example, WSDL), you usually get a much worse interface, and you tend to think in terms of sending objects by wire instead of messages, which can be harmful .

Things to Avoid: Lists, Restrictions, Substitution Groups, and Other Wacky Things.

+1
source

You will need to go into the proxy classes created by .NET and manually change the namespace for the input parameters to the one that uses the axis code. Hope this works.

I am doing a reading and it seems that Axis does not always work well with .NET.

0
source

I'm not sure if this will help, but it might be worth a try. Have you tried adding a service link (svcutil.exe wrapper) instead of a web link (wsdl.exe wrapper)?

0
source

I also deal with AXIS issues and found some solutions.

I integrate with ITIM 5.0 using unsupported web services that use AXIS 1.3. All the problems that I experienced were fixed in 1.4, and, seeing that the product is older than 5 years, I do not understand why they decided to stick to the older version. There are several issues that I have found, in addition to the well-published one, about how AXIS presents arrays, pointing to a centralized storage of values. One such problem is the namespace. AXIS tends to generate WSDLs with a namespace, but the return values ​​do not have a namespace; .NET simply cannot find the value during deserialization. It took me a long time to find out why, but I solved this by manually removing the namespace requirement from the proxy code. The second issue I ran into was how the WSDL presents collections of elements. The collection is called SomeCollection with elements named Item. When the service returns, the elements have the same name as the collection (SomeCollection contains SomeCollection (s)). I had to manually rename all these links in the proxy so that they were the same as the collection. It cost me countless hours. If I find more, I will post them here. Obviously, the solution is to upgrade to 1.4, but IBM does not support it or translate the source code for this.

Read more on his blog.

http://nbaked.wordpress.com/2010/04/01/issues-integrating-axis-web-services-with-net/

0
source

All Articles