2012-08-16 44 views
2

我是WCF新手,我在wcf中写了一些服务。它现在发布在Intranet上,一些应用程序已经在使用该服务。目前,我必须为其他开发人员编写有关输入参数/数据类型和输出参数的文档。没关系,如果我们使用.Net平台来使用服务。它会自动在WebReferences文件夹中创建服务/类,并且Intellisense完美地工作。我们如何知道wcf服务的输入/输出类型?

但是,如果用户使用PHP或传统的ASP,它不会那样工作。他们必须知道确切的名称,参数的类型,我必须非常仔细地记录服务。

通过使用WSDL如下:我们如何知道我们想要使用的服务的数据类型和参数?如果它没有在WSDL中显示,我应该在哪里查看这些信息?如果有人给我WCF服务没有文档,我怎么知道如何使用该服务?

非常感谢。

这下面是我对服务

[ServiceContract] 
public interface IEmail 
{ 
    [OperationContract] 
    bool InsertEmail(string Subject, string SentFrom, string SentTo, int ApplicationID, int TemplateID, string DataText); 
} 

以下是关于我的服务的确切WSDL信息接口。

<?xml version="1.0" encoding="utf-8" ?> 
- <wsdl:definitions name="Email" targetNamespace="http://tempuri.org/" 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://tempuri.org/" 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://tempuri.org/Imports"> 
    <xsd:import schemaLocation="http://myservice/Email.svc?xsd=xsd0" namespace="http://tempuri.org/" /> 
    <xsd:import schemaLocation="http://myservice/Email.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" /> 
    </xsd:schema> 
    </wsdl:types> 
- <wsdl:message name="IEmail_InsertEmail_InputMessage"> 
    <wsdl:part name="parameters" element="tns:InsertEmail" /> 
    </wsdl:message> 
- <wsdl:message name="IEmail_InsertEmail_OutputMessage"> 
    <wsdl:part name="parameters" element="tns:InsertEmailResponse" /> 
    </wsdl:message> 
- <wsdl:portType name="IEmail"> 
- <wsdl:operation name="InsertEmail"> 
    <wsdl:input wsaw:Action="http://tempuri.org/IEmail/InsertEmail" message="tns:IEmail_InsertEmail_InputMessage" /> 
    <wsdl:output wsaw:Action="http://tempuri.org/IEmail/InsertEmailResponse" message="tns:IEmail_InsertEmail_OutputMessage" /> 
    </wsdl:operation> 
    </wsdl:portType> 
- <wsdl:binding name="BasicHttpBinding_IEmail" type="tns:IEmail"> 
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> 
- <wsdl:operation name="InsertEmail"> 
    <soap:operation soapAction="http://tempuri.org/IEmail/InsertEmail" style="document" /> 
- <wsdl:input> 
    <soap:body use="literal" /> 
    </wsdl:input> 
- <wsdl:output> 
    <soap:body use="literal" /> 
    </wsdl:output> 
    </wsdl:operation> 
    </wsdl:binding> 
- <wsdl:service name="Email"> 
- <wsdl:port name="BasicHttpBinding_IEmail" binding="tns:BasicHttpBinding_IEmail"> 
    <soap:address location="http://myservice/Email.svc" /> 
    </wsdl:port> 
    </wsdl:service> 
    </wsdl:definitions> 

回答

2

如果你的意思是你看不到的WSDL服务使用的所有类型,这是因为WSDL WCF创建经常(也许永远)分割成若干位。这些其他位从主WSDL链接到。

因此,如果您浏览到http://myservice/Email.svc?wsdl,您会看到您在问题中提出的WSDL。在这里,您可以看到指向其他两个模式的链接 - http://myservice/Email.svc?xsd=xsd0http://myservice/Email.svc?xsd=xsd1。如果您浏览到这些内容,则会找到您要查找的类型信息。

相关问题