Problems invoking Attachment Enabled WM Service from .NET Client

Hello,

I am having extreme difficulty in calling a webMethods 7.1.2 service I create with a .NET client.

The service I created is exposed via a webservice descriptor with “Attachments Enabled”.
It is designed to take a search input parameter and return binary data, if found.

I successfully imported the WSDL into a .NET 2.0 client (using WSE).

When trying to run, here is the issue.

With correct search parameters, the service executes successfully and returns the attachment.

When it fails, the service returns a SOAP Fault.

The problem is, that .NET always expects a multipart/related MIME Message for a response.

WebMethods only returns a multi-part message when successful, otherwise it’s a standard application/SOAP+XML response message.

.NET throws an exception:

“WSE839: An HTTP response was received that used the following content type: application/soap+xml; charset=UTF-8. The following content type was expected: multipart/related; type=application/xop+xml.”

How can you compensate for this? Is there a way to always force a multipart/related message type in webMethods using a webservice descriptor? Or, how about in the .NET client? Can you set something to allows any response format?

Thanks,
Matt

Hi Matt,

I never let webMethods actually do my error recovery. I do a try/catch block around any operation that might fail. Then I extract the error information from the error object returned from the getLastError call. I used this information to format a standard XML return with a multiple segment document and all the correct elements. In your case you need to detect the empty result set and create your own error message as follows.

Example:
branch on /costsListSize
0: sequence (no data returned)
map (create no fine message)
map (create no fine document)
documentToXMLString (convert error document to xml string)

In this way I will always return the XML string in all cases.