用 java 编写但用 c# 调用的 Web 服务

发布于 2024-10-18 22:27:36 字数 5691 浏览 3 评论 0原文

我正在尝试将 Web 服务从另一个应用程序导入到自定义 asp.net 应用程序中。然而,它目前抛出一个错误。您以前见过以下错误吗(见下文)?

自定义工具错误:无法导入 Web 服务/架构。无法导入 绑定“AuthenticateSoapBinding” 名称空间 'http://site:80/LiveTime/WebObjects/LiveTime.woa/ws /验证'。 无法导入操作“连接”。 类型必须在顶部声明 架构中的级别。请查看 命名空间中的模式类型“Map” 'http://xml.apache.org/xml-soap': 元素“item”正在使用匿名类型 声明,匿名类型不是 通过编码的 SOAP 支持。

谷歌的一些初步研究显示以下内容:

Java .Net Interop。轴 java.util.Map http://wiki.apache.org/ws/FrontPage/Axis/DotNetInteropMapInfo

其中提到网络服务需要更改。然而,我认为这不会发生。关于如何解决这个问题有什么想法吗?

以下是我从中获取信息的 Web 服务 XML:

<?xml version="1.0" encoding="UTF-8"?>
<definitions targetNamespace="http://server:80/LiveTime/WebObjects/LiveTime.woa/ws/Authenticate" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://server:80/LiveTime/WebObjects/LiveTime.woa/ws/Authenticate" xmlns:intf="http://server:80/LiveTime/WebObjects/LiveTime.woa/ws/Authenticate" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><wsdl:types><schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema"><import namespace="http://schemas.xmlsoap.org/soap/encoding/"/><complexType name="Map"><sequence><element maxOccurs="unbounded" minOccurs="0" name="item"><complexType><all><element name="key" type="xsd:anyType"/><element name="value" type="xsd:anyType"/></all></complexType></element></sequence></complexType></schema></wsdl:types>
  <message name="keepAliveResponse">
    <part name="keepAliveReturn" type="apachesoap:Map"/>
  </message>
  <message name="connectResponse">
    <part name="connectReturn" type="apachesoap:Map"/>
  </message>
  <message name="connectRequest">
    <part name="username" type="xsd:string"/>
    <part name="password" type="xsd:string"/>
  </message>
  <message name="disconnectRequest">
  </message>
  <message name="disconnectResponse">
    <part name="disconnectReturn" type="apachesoap:Map"/>
  </message>
  <message name="keepAliveRequest">
  </message>
  <portType name="Authenticate">
    <operation name="connect" parameterOrder="username password">
      <input message="impl:connectRequest" name="connectRequest"/>
      <output message="impl:connectResponse" name="connectResponse"/>
    </operation>
    <operation name="keepAlive">
      <input message="impl:keepAliveRequest" name="keepAliveRequest"/>
      <output message="impl:keepAliveResponse" name="keepAliveResponse"/>
    </operation>
    <operation name="disconnect">
      <input message="impl:disconnectRequest" name="disconnectRequest"/>
      <output message="impl:disconnectResponse" name="disconnectResponse"/>
    </operation>
  </portType>
  <binding name="AuthenticateSoapBinding" type="impl:Authenticate">
    <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="connect">
      <wsdlsoap:operation soapAction=""/>
      <input name="connectRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ws.livetime.com" use="encoded"/>
      </input>
      <output name="connectResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://server:80/LiveTime/WebObjects/LiveTime.woa/ws/Authenticate" use="encoded"/>
      </output>
    </operation>
    <operation name="keepAlive">
      <wsdlsoap:operation soapAction=""/>
      <input name="keepAliveRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ws.livetime.com" use="encoded"/>
      </input>
      <output name="keepAliveResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://server:80/LiveTime/WebObjects/LiveTime.woa/ws/Authenticate" use="encoded"/>
      </output>
    </operation>
    <operation name="disconnect">
      <wsdlsoap:operation soapAction=""/>
      <input name="disconnectRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ws.livetime.com" use="encoded"/>
      </input>
      <output name="disconnectResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://server:80/LiveTime/WebObjects/LiveTime.woa/ws/Authenticate" use="encoded"/>
      </output>
    </operation>
  </binding>
  <service name="Authenticate">
    <port binding="impl:AuthenticateSoapBinding" name="Authenticate">
      <wsdlsoap:address location="http://server:80/LiveTime/WebObjects/LiveTime.woa/ws/Authenticate"/>
    </port>
  </service>
</definitions>

I am trying to import a web service from another application into a custom asp.net application. However, it’s throwing an error at the moment. Have you seen the following error before (see below)?

Custom tool error: Unable to import
WebService/Schema. Unable to import
binding 'AuthenticateSoapBinding' from
namespace
'http://site:80/LiveTime/WebObjects/LiveTime.woa/ws/Authenticate'.
Unable to import operation 'connect'.
Types must be declared at the top
level in the schema. Please review
schema type 'Map' from namespace
'http://xml.apache.org/xml-soap':
element 'item' is using anonymous type
declaration, anonymous types are not
supported with encoded SOAP.

Some initial research in google shows the following:

Java .Net Interop. Axis java.util.Map
http://wiki.apache.org/ws/FrontPage/Axis/DotNetInteropMapInfo

Which mentioned that the web service need to be changed. However, I don’t think this is going to happened. Any idea on how to get around this?

The following is the web service XML that I get the information from:

<?xml version="1.0" encoding="UTF-8"?>
<definitions targetNamespace="http://server:80/LiveTime/WebObjects/LiveTime.woa/ws/Authenticate" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://server:80/LiveTime/WebObjects/LiveTime.woa/ws/Authenticate" xmlns:intf="http://server:80/LiveTime/WebObjects/LiveTime.woa/ws/Authenticate" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><wsdl:types><schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema"><import namespace="http://schemas.xmlsoap.org/soap/encoding/"/><complexType name="Map"><sequence><element maxOccurs="unbounded" minOccurs="0" name="item"><complexType><all><element name="key" type="xsd:anyType"/><element name="value" type="xsd:anyType"/></all></complexType></element></sequence></complexType></schema></wsdl:types>
  <message name="keepAliveResponse">
    <part name="keepAliveReturn" type="apachesoap:Map"/>
  </message>
  <message name="connectResponse">
    <part name="connectReturn" type="apachesoap:Map"/>
  </message>
  <message name="connectRequest">
    <part name="username" type="xsd:string"/>
    <part name="password" type="xsd:string"/>
  </message>
  <message name="disconnectRequest">
  </message>
  <message name="disconnectResponse">
    <part name="disconnectReturn" type="apachesoap:Map"/>
  </message>
  <message name="keepAliveRequest">
  </message>
  <portType name="Authenticate">
    <operation name="connect" parameterOrder="username password">
      <input message="impl:connectRequest" name="connectRequest"/>
      <output message="impl:connectResponse" name="connectResponse"/>
    </operation>
    <operation name="keepAlive">
      <input message="impl:keepAliveRequest" name="keepAliveRequest"/>
      <output message="impl:keepAliveResponse" name="keepAliveResponse"/>
    </operation>
    <operation name="disconnect">
      <input message="impl:disconnectRequest" name="disconnectRequest"/>
      <output message="impl:disconnectResponse" name="disconnectResponse"/>
    </operation>
  </portType>
  <binding name="AuthenticateSoapBinding" type="impl:Authenticate">
    <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="connect">
      <wsdlsoap:operation soapAction=""/>
      <input name="connectRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ws.livetime.com" use="encoded"/>
      </input>
      <output name="connectResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://server:80/LiveTime/WebObjects/LiveTime.woa/ws/Authenticate" use="encoded"/>
      </output>
    </operation>
    <operation name="keepAlive">
      <wsdlsoap:operation soapAction=""/>
      <input name="keepAliveRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ws.livetime.com" use="encoded"/>
      </input>
      <output name="keepAliveResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://server:80/LiveTime/WebObjects/LiveTime.woa/ws/Authenticate" use="encoded"/>
      </output>
    </operation>
    <operation name="disconnect">
      <wsdlsoap:operation soapAction=""/>
      <input name="disconnectRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ws.livetime.com" use="encoded"/>
      </input>
      <output name="disconnectResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://server:80/LiveTime/WebObjects/LiveTime.woa/ws/Authenticate" use="encoded"/>
      </output>
    </operation>
  </binding>
  <service name="Authenticate">
    <port binding="impl:AuthenticateSoapBinding" name="Authenticate">
      <wsdlsoap:address location="http://server:80/LiveTime/WebObjects/LiveTime.woa/ws/Authenticate"/>
    </port>
  </service>
</definitions>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文