Using Java Webservice in .NET.

I am working on integrating a .NET application with a servlet based Java application called Hermes2 (H2O). Java application exposes several web services and I am trying to link to them in Visual Studio 2008. However, this only results in an empty proxy commented out with an error message: "CODEGEN: Binding of a 'Request' operation from a namespace ' http: // service.ebms.edi.cecid.hku.hk/ 'was ignored. Specifying a type to use = literals is not supported. ".

When I try to run WSDL using 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 maybe how can this be fixed? I would guess Hermes2 is using some kind of shared Webservices library. Is there a Java library that creates an invalid WSDL, or is it just some feature not supported by .NET?

The WSDL looks like this (I don't see any way to attach files here, and I don't have a URL for WSDL. Sorry for posting the 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 someone can help.

+2


source to share


2 answers


I was hoping for someone to provide information on how to fix the problem Martin pointed out, but nobody did: - /

However, after several hours of reading and trying, I was able to rewrite the WSDL generated by the Java application to conform to the standards followed by the implementation of .NETs Webservices.

It seems that the Java Webservices framework being used is the sinner here, but I don't know which library is used as I am not familiar with many of them. In addition to not creating standard compliant WSDLs, there are several other web services issues in this application that, as far as I know, were resolved many years ago. For example, binary data is transferred using the "multipart / related" mime, but there are no references to the data in the SOAP xml.



And I, who thought .NET sucked in ... Anyway, here's where the WSDL types and message sections will appear after rewriting (the rest of the rest of the parts as they haven't changed):

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

+1


source


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

      



They should refer to element declarations, not simple simple types. You need to wrap the element containing a simple string type.

+1


source







All Articles