在.NET中使用Java的web服务NET、Java、web

2023-09-03 06:43:32 作者:星星失了眸

我努力将使用名为Hermes2(H2O)基于Servlet的Java应用程序,.NET应用程序。 Java应用程序提供了几个Web服务,我想创建Web引用这些在Visual Studio 2008然而,这只是导致一个空的代理,评论与错误信息:codeGEN:操作绑定请求从命名空间 http://service.ebms.edi.cecid.hku.hk/'被忽略了。指定的类型,使用=不支持文字信息。

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.".

当我尝试通过在.NET中的Wsdl.exe用程序运行WSDL,我得到以下的输出:

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'.

有谁知道问题是什么,并有可能这可怎么解决吗?我会认为Hermes2使用某种共同的Web服务库。有没有产生无效的WSDL的或者不支持的.NET这只是一些功能,任何这样的Java库?

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?

的WSDL如下(我看不到任何方式在这里附加文件,我没有一个URL到WSDL对不起张贴臃肿的问题。):

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/">
<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.

推荐答案

我希望有人能提供关于如何解决这个问题指出,马丁的信息,但没有人做的事: - /

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

不过经过数个小时的阅读和努力,我终于成功地改写由Java应用程序生成的东西,符合标准,其次是.NETs Web服务implenentation的WSDL。

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.

看来,使用了Java Web服务框架是罪人这里,但我不知道是什么库使用,因为我不熟悉,许多这些。除了不能产生标准的符合性的WSDL的,还有其他一些问题上与Web服务在这个应用程序,据我所知,解决了很久以前。例如使用默多部分/相关的二进制数据被转移,但有在SOAP的XML没有可参考的数据。

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.

和我谁想到,.NET吸......不管怎么说,这里的所产生的WSDL类型和消息部分改写后(排除在其他地方,因为这些没有被修改):

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 :-)