Thursday, August 11, 2011

Microsoft Web Services, Java Client

Microsoft .asmx?wsdl produces valid WSDL that Java cannot consume. In fact Java produces valid WSDL that Java cannot consume.

Specifically, the Java stub generators (WSDL2Java, JAXWS, etc.) cannot handle method overloading. I have found through trial-and-error that to resolve this you must give the <operation@name> unique values. This involves changing them in both the <porttype> and <binding>.

For example, given this:

<operation name='LoadByKey'>
<input name='LoadByKeySoapIn' />
<output name='LoadByKeySoapOut' />
</operation>

<operation name='LoadByKey'>
<input name='LoadByKey1SoapIn' />
<output name='LoadByKey1SoapOut' />
</operation>

You would need to rename the second operation 'LoadByKey1'. These same <porttype>/<operation> names are found in each <binding>/<operation> and therefore the <operation@name> must change there as well:

<operation name='LoadByKey1'>
<input name='LoadByKey1SoapIn' />
<output name='LoadByKey1SoapOut' />
</operation>

No comments:

Post a Comment