相关疑难解决方法(0)

此WCF错误意味着什么:"自定义工具警告:无法导入wsdl:portType"

我在我的解决方案中创建了一个WCF服务库项目,并提供了对此的服务引用.我使用类库中的服务,所以除了类库之外,我还有来自WPF应用程序项目的引用.服务直接设置 - 仅更改为获取异步服务功能.

一切都很好 - 直到我想更新我的服务参考.它失败了,所以我最终回滚并重试,但即便如此也失败了!因此 - 更新服务引用失败而不对其进行任何更改.为什么?!

我得到的错误就是这个:

Custom tool error: Failed to generate code for the service reference 
'MyServiceReference'.  Please check other error and warning messages for details.   
Run Code Online (Sandbox Code Playgroud)

警告提供了更多信息:

Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: 
System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: List of referenced types contains more than one type with data contract name 'Patient' in  
namespace 'http://schemas.datacontract.org/2004/07/MyApp.Model'. Need to exclude all but one of the 
following types. Only matching types …
Run Code Online (Sandbox Code Playgroud)

wpf wcf service-reference

83
推荐指数
5
解决办法
8万
查看次数

WSDL - 没有输入 - 最佳实践

我正在开发一个SOAP Web服务.其中一个函数是isAlive().它没有输入参数.WSDL的最佳实践是什么?我试过了...

<wsdl:operation name="isAlive">
    <wsdl:output message="tns1:isAliveMessage"/>
</wsdl:operation>
Run Code Online (Sandbox Code Playgroud)

...但由于缺少输入,我的一个工具中出现了解析错误.我找到了几个例子,其中定义了输入和消息,相应的类型定义是空的,即<xsd:complexType name="somename"/>.这是否更好?

谢谢!

soap wsdl

11
推荐指数
2
解决办法
9206
查看次数

来自wsdl文件的svcutil:找不到具有目标命名空间的错误架构

在我的机器上,我有一个WSDL文件和所有必要的模式文件.我正在尝试使用svcutil从WSDL创建客户端代理代码.命令:

svcutil myfile.wsdl
Run Code Online (Sandbox Code Playgroud)

我在使用svcutil时遇到错误,但在使用soapUI加载wsdl时没有问题,如果这意味着什么.

我一直收到这个错误:

Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Schema with target namespace 'http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0' could not be found.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0']/wsdl:portType[@name='areventservice']
Run Code Online (Sandbox Code Playgroud)

这是WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    name="areventservice"
    targetNamespace="http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0"
    xmlns:tns="http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0"
    xmlns:es="http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0">



    <wsdl:types>
        <xsd:schema targetNamespace="http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0"
                    xmlns:tns="http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0"
                    xmlns:es="http://www.crsoftwareinc.com/xml/ns/titanium/event/areventservice/v1_0">

            <xsd:include schemaLocation="arevent-service.xsd"/>
        </xsd:schema>
    </wsdl:types>

    <wsdl:message name="SaveAREventWithShortNames">
        <wsdl:part element="es:save-arevent-with-shortnames" name="SaveAREventWithShortNames"/>
    </wsdl:message>

    <wsdl:message name="RetrieveAREventByConsumerIdentifier">
        <wsdl:part element="es:retrieve-arevent-by-consumer-agency-identifier" name="RetrieveAREventByConsumerIdentifier"/>
    </wsdl:message>

    <wsdl:message name="RetrieveAREventByConsumerAccountIdentifier">
        <wsdl:part element="es:retrieve-arevent-by-consumer-account-agency-identifier" name="RetrieveAREventByConsumerAccountIdentifier"/>
    </wsdl:message>

    <wsdl:message name="RetrieveAREventResponse">
        <wsdl:part element="es:retrieve-arevent-response" name="RetrieveAREventResponse"/> …
Run Code Online (Sandbox Code Playgroud)

wcf svcutil.exe

8
推荐指数
1
解决办法
1万
查看次数

手卷SOAP请求

我正在尝试构建一个手动滚动的HTTP请求,以便从我认为是一个相当简单的SOAP Web服务调用返回响应.但是,我无法正确构建请求,并且没有得到我期望的响应.


适用wsdl声明:

wsdl目标命名空间:

targetNamespace="http://tempuri.org/"
Run Code Online (Sandbox Code Playgroud)

wsdl服务

<wsdl:service name="TrackerService">
  <wsdl:port name="BasicHttpBinding_ITrackerService" binding="tns:BasicHttpBinding_ITrackerService">
    <soap:address location="http://mydomain.com/TrackerServiceSite/wctest2.TrackerService.svc"/>
  </wsdl:port>
</wsdl:service>
Run Code Online (Sandbox Code Playgroud)

wsdl消息

<wsdl:message name="ITrackerService_GetStub_InputMessage">
  <wsdl:part name="parameters" element="tns:GetStub" /> 
</wsdl:message>
<wsdl:message name="ITrackerService_GetStub_OutputMessage">
  <wsdl:part name="parameters" element="tns:GetStubResponse" /> 
</wsdl:message>
Run Code Online (Sandbox Code Playgroud)

wsdl绑定和SOAP操作

<wsdl:binding name="BasicHttpBinding_ITrackerService" type="tns:ITrackerService">
  <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
        .
        . <!—- Omitted for brevity --> 
        .
  <wsdl:operation name="GetStub">
    <soap:operation soapAction="http://tempuri.org/ITrackerService/GetStub" style="document"/>
    <wsdl:input>
        <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
        <soap:body use="literal"/>
    </wsdl:output>
  </wsdl:operation>
</wsdl:binding>
Run Code Online (Sandbox Code Playgroud)

预期退货响应

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header />
  <s:Body>
      <GetStubResponse xmlns="http://tempuri.org/">
        <GetStubResult xmlns:a=http://schemas.datacontract.org/2004/07/wctest2 xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
          <a:Password>SOMEPASS</a:Password>
          <a:Username>SOMEUSER</a:Username>
        </GetStubResult>
      </GetStubResponse>
  </s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)

到目前为止的HTTP请求:

POST …
Run Code Online (Sandbox Code Playgroud)

soap wsdl http-headers

3
推荐指数
1
解决办法
5040
查看次数

标签 统计

soap ×2

wcf ×2

wsdl ×2

http-headers ×1

service-reference ×1

svcutil.exe ×1

wpf ×1