MS Office 2003 - Generated code with no parameter

In the process of getting my Web services integrated with the Office 2003 desktop suite, I run into another issue, which is again anoing. Even with a WSDL that adhers to WS-I BP1.x, the experience, out off the box is not that snooth.

The sympthome: the VBA code generated for each operation, do not have any parameter or return value. Here is a simple example with 2 operations.

Public Sub wsm_getVersion()
...
Public Sub wsm_echoString()
...

At first, this code looks fine, and there is no error message, warning, or hint of any kind that can be used to figure that the code generated is not functional. Before to delve into the WSDL and Schema definition, here is the code that one would have expected.

Public Function wsm_getVersion() As String
...
Public Function wsm_echoString(ByVal str_input As String) As String
...

The problem: The wizard is not able to process the type definition of any top-level element, unless the type definition is inlined. Here is the sample output element/type defition for the echoString operation:

<element name="echoStringResponse" type="tns:echoStringResponse"/>
<complexType name="echoStringResponse">
<sequence>
<element name="result" type="string" nillable="true"/>
</sequence>
</complexType>

The solution: change the XML schema in the WSDL, to follow the format recognized by Office, with anonymous complexType for all the wrapper elements - thoses created to mimic RPC style with document-literal-wrapped.

<element name="echoStringResponseElement">
<complexType>
<sequence>
<element name="result" type="string" nillable="true"/>
</sequence>
</complexType>
</element>

Hard to figure this one out, unless you can put the 2 WSDLs side by side.

Happy Coding,
-Ecco

Comments

Popular posts from this blog

Changing the version of JDK used by JDeveloper

Connection reset from a WCF Web Service

Why ws-rx ?