【发布时间】:2011-11-14 21:58:29
【问题描述】:
我创建了几个 WCF 服务。一种非常健壮的,可以接受 SOAP 和 RESTful 请求,并提供 XML 和 JSON 响应。
--编辑:仅供参考:启用 SOAP 端点以接受 RESTful 请求需要使用 [WebGet...,因此,所有输入参数必须是字符串类型。
另一个,一个简单的 RESTful 连接器。第一个服务的 WSDL 验证,但是对于第二个非常简单的 RESTful 连接器 - 无效。
我使用 WSDL2Java 来完成连接过程,但由于 WSDL 无效而失败。
我是否误以为正在生成 WSDL v2.0?
这是来自服务的 WSDL:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="RESTService" targetNamespace="http://antennasoftware.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://antennasoftware.com" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<wsdl:types>
<xsd:schema targetNamespace="http://antennasoftware.com/Imports">
<xsd:import schemaLocation="http://localhost/VRPCWebServices/RestService.svcxsd=xsd0" namespace="http://antennasoftware.com"/>
<xsd:import schemaLocation="http://localhost/VRPCWebServices/RestService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IRESTService_GetXMLData_InputMessage">
<wsdl:part name="parameters" element="tns:GetXMLData"/>
</wsdl:message>
<wsdl:message name="IRESTService_GetXMLData_OutputMessage">
<wsdl:part name="parameters" element="tns:GetXMLDataResponse"/>
</wsdl:message>
<wsdl:message name="IRESTService_GetJSONData_InputMessage">
<wsdl:part name="parameters" element="tns:GetJSONData"/>
</wsdl:message>
<wsdl:message name="IRESTService_GetJSONData_OutputMessage">
<wsdl:part name="parameters" element="tns:GetJSONDataResponse"/>
</wsdl:message>
<wsdl:portType name="IRESTService">
<wsdl:operation name="GetXMLData">
<wsdl:input wsaw:Action="http://antennasoftware.com/IRESTService/GetXMLData" message="tns:IRESTService_GetXMLData_InputMessage"/>
<wsdl:output wsaw:Action="http://antennasoftware.com/IRESTService/GetXMLDataResponse" message="tns:IRESTService_GetXMLData_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="GetJSONData">
<wsdl:input wsaw:Action="http://antennasoftware.com/IRESTService/GetJSONData" message="tns:IRESTService_GetJSONData_InputMessage"/>
<wsdl:output wsaw:Action="http://antennasoftware.com/IRESTService/GetJSONDataResponse" message="tns:IRESTService_GetJSONData_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:service name="RESTService"/>
</wsdl:definitions>
【问题讨论】:
-
有其他人在尝试使用 .Net v4.0 读取为 RESTful 服务创建的 WSDL 时遇到问题吗?
标签: asp.net wcf wsdl wcf-rest wsdl2java