views:

301

answers:

2

I am working on integrating a .NET application with a Servlet based Java application called Hermes2 (H2O). The Java application exposes several Web services, and I am trying to create Web References to these in Visual Studio 2008. However this only results in an empty proxy, commented with the error message: "CODEGEN: The operation binding 'Request' from namespace 'http://service.ebms.edi.cecid.hku.hk/' was ignored. Specifying a type for use=literal messages is not supported.".

When I try to run the WSDL through the wsdl.exe utility in .NET, I get the following output:

Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation. All rights reserved.
Warning: This web reference does not conform to WS-I Basic Profile v1.1.
R2204: A document-literal binding in a DESCRIPTION MUST refer, in each of its soapbind:body element(s), only to wsdl:part element(s) that have been defined using the element attribute. 
-  Part 'messageId' of message 'EbmsRequestMsg' from service description with targetNamespace='http://service.ebms.edi.cecid.hku.hk/'.
-  Part 'hasMessage' of message 'EbmsResponseMsg' from service description with targetNamespace='http://service.ebms.edi.cecid.hku.hk/'.

For more details on the WS-I Basic Profile v1.1, see the specification 
at http://www.ws-i.org/Profiles/BasicProfile-1.1.html.

Warning: one or more operations were skipped.
Warnings were encountered. Review generated source comments for more details.

Writing file 'C:\Files\Temp\Helsekortet\Hermes\wsdl\EbmsMessageReceiverDownload.cs'.

Does anyone know what the problem is, and possibly how this can be fixed? I would assume that Hermes2 uses some sort of common Webservices library. Is there any such Java library that produces invalid WSDL's or it this simply some feature not supported by .NET?

The WSDL is as follows (I cannot see any way of attaching files here, and I do not have a URL to a WSDL. Sorry for posting a bloated question):

<?xml version="1.0" encoding="utf-8"?> 
<definitions 
 xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
 xmlns:s="http://www.w3.org/2001/XMLSchema" 
 xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
 xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
 xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
 xmlns="http://schemas.xmlsoap.org/wsdl/"
 xmlns:p="http://service.ebms.edi.cecid.hku.hk/" 
 targetNamespace="http://service.ebms.edi.cecid.hku.hk/"&gt;
<types>
</types>
<message name="EbmsRequestMsg">
  <part name="messageId" type="s:string" /> 
</message>
<message name="EbmsResponseMsg">
  <part name="hasMessage" type="s:string" /> 
</message>
<portType name="EbmsReceiverDownload">
  <operation name="Request">
    <input message="p:EbmsRequestMsg" /> 
    <output message="p:EbmsResponseMsg" /> 
  </operation>
</portType>
<binding name="EbmsSoapHttpReceiverDownload" type="p:EbmsReceiverDownload">
  <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> 
  <operation name="Request">
    <soap:operation soapAction="Ebmsreceiverdownload" style="document" /> 
    <input>
      <soap:body use="literal" /> 
    </input>
    <output>
      <soap:body use="literal" /> 
    </output>
  </operation>
</binding>
<service name="EbmsMessageReceiverDownload">
  <documentation>Documentation not available.</documentation> 
  <port name="EbmsReceiverDownload" binding="p:EbmsSoapHttpReceiverDownload">
    <soap:address location="http://127.0.0.1:8080/corvus/httpd/ebms/receiver" /> 
  </port>
</service>
</definitions>

Hope anyone can help.

+1  A: 
<message name="EbmsRequestMsg">
  <part name="messageId" type="s:string" /> 
</message>
<message name="EbmsResponseMsg">
  <part name="hasMessage" type="s:string" />

These must refer to element declarations and not raw simple types. You need to create an element wrapper containing a string simple type.

Martin OConnor
Do you know how this can be done? I am not very experienced in WSDLs so I hope you can give me some pointers. Also I would think that the Java Webservice library that generates this WSDL should generate this as well?
Johnny Egeland
It really depends on which Java library is being used to implement the webservice.
Martin OConnor
Yes, it surely is. But a standard is a standard; who would implement or use a webservice library that does not generate standard WSDLs?
Johnny Egeland
Many people, including users of old libraries, Axis 1.2, and several others. A lot of people don't care about standards.
John Saunders
A: 

I was hoping that somebody would supply information on how to fix the problem pointed out by Martin, but no one did :-/

However after several hours of reading and trying, I finally managed to rewrite the WSDL generated by the Java app to something that conforms to the standards followed by .NETs Webservices implenentation.

It seems that the Java Webservices framework used is the sinner here, but I do not know what library is used as I am not familiar with many of these. In addition to not generating standard conformant WSDL's, there are several other issues with the webservices in this application that to my knowledge was solved ages ago. For example binary data is transfered using mime "multipart/related", but there is no reference to the data in the SOAP xml.

And I who thought that .NET sucked... Anyways, here's the resulting WSDL types and message sections after rewriting (left out the other parts as these was not modified):

<types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://service.ebms.edi.cecid.hku.hk/" elementFormDefault="qualified">
        <xs:element name="messageId" type="xs:string" />
        <xs:element name="hasMessage" type="xs:string" />
    </xs:schema>
</types>
<message name="EbmsRequestMsg">
    <part name="messageId" element="p:messageId" />
</message>
<message name="EbmsResponseMsg">
    <part name="hasMessage" element="p:hasMessage" />
</message>

Thanks to Martin for pointing me in the right direction :-)

Johnny Egeland